Skip to content

Commit 7c96387

Browse files
sago35deadprogram
authored andcommitted
sh1106: fix I2C interface and add smoketest
1 parent 182d4c6 commit 7c96387

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sh1106/sh1106.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111

1212
"tinygo.org/x/drivers"
13+
"tinygo.org/x/drivers/internal/legacy"
1314
)
1415

1516
// Device wraps an SPI connection.
@@ -283,9 +284,10 @@ func (d *Device) Tx(data []byte, isCommand bool) {
283284
// tx sends data to the display (I2CBus implementation)
284285
func (b *I2CBus) tx(data []byte, isCommand bool) {
285286
if isCommand {
287+
legacy.WriteRegister(b.wire, uint8(b.Address), 0x00, data)
286288
b.wire.WriteRegister(uint8(b.Address), 0x00, data)
287289
} else {
288-
b.wire.WriteRegister(uint8(b.Address), 0x40, data)
290+
legacy.WriteRegister(b.wire, uint8(b.Address), 0x40, data)
289291
}
290292
}
291293

smoketest.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,4 @@ tinygo build -size short -o ./build/test.hex -target=pico ./examples/ndir/main_n
136136
tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ndir/main_ndir.go
137137
tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/ndir/main_ndir.go
138138
tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/mpu9150/main.go
139+
tinygo build -size short -o ./build/test.hex -target=macropad-rp2040 ./examples/sh1106/macropad_spi

0 commit comments

Comments
 (0)