mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-19 06:03:57 +00:00
Added TMC5160 support (#725)
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
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user