Skip to content

Commit 996f1b0

Browse files
kenbelldeadprogram
authored andcommitted
fix uses of legacy i2c WriteRegister calls
1 parent eef0391 commit 996f1b0

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

as560x/i2c_register.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (r *i2cRegister) write(bus drivers.I2C, deviceAddress uint8, value uint16)
159159
}
160160

161161
// Write the register from the buffer over I2C
162-
err := bus.WriteRegister(deviceAddress, r.host.address, buf)
162+
err := legacy.WriteRegister(bus, deviceAddress, r.host.address, buf)
163163
// after successful I2C write, cache this value if the host register (if also readable)
164164
// Note we cache the entire buffer without applying shift/mask
165165
if nil == err && r.host.attributes&reg_read != 0 {

lps22hb/lps22hb_nano_33_ble.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ package lps22hb
55
import (
66
"machine"
77
"time"
8+
9+
"tinygo.org/x/drivers/internal/legacy"
810
)
911

1012
// Configure sets up the LPS22HB device for communication.

ssd1306/ssd1306.go

Lines changed: 3 additions & 2 deletions
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 I2C or SPI connection.
@@ -277,9 +278,9 @@ func (d *Device) Tx(data []byte, isCommand bool) {
277278
// tx sends data to the display (I2CBus implementation)
278279
func (b *I2CBus) tx(data []byte, isCommand bool) {
279280
if isCommand {
280-
b.wire.WriteRegister(uint8(b.Address), 0x00, data)
281+
legacy.WriteRegister(b.wire, uint8(b.Address), 0x00, data)
281282
} else {
282-
b.wire.WriteRegister(uint8(b.Address), 0x40, data)
283+
legacy.WriteRegister(b.wire, uint8(b.Address), 0x40, data)
283284
}
284285
}
285286

0 commit comments

Comments
 (0)