mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-07-26 10:38:41 +00:00
486949686c
TMC5160: Added TMC5160 support * Added example code for tmc5160 and smoke test * Update go.mod * Updated mod file * Cleaned up commented out code and updated readme. * ran go fmt * Fixed setrampspeed func * Removed spi1 pin setup in example.go. Renamed SPIComm to spicomm.go * Removed unused test file * Removed commented line
14 lines
262 B
Go
14 lines
262 B
Go
package tmc5160
|
|
|
|
func ToHex(value uint32) string {
|
|
hexChars := "0123456789ABCDEF"
|
|
result := ""
|
|
|
|
for i := 0; i < 8; i++ { // 8 nibbles for a 32-bit number
|
|
nibble := (value >> (28 - i*4)) & 0xF
|
|
result += string(hexChars[nibble])
|
|
}
|
|
|
|
return "0x" + result
|
|
}
|