Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix i2c legacy calls #589

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion as560x/i2c_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (r *i2cRegister) write(bus drivers.I2C, deviceAddress uint8, value uint16)
}

// Write the register from the buffer over I2C
err := bus.WriteRegister(deviceAddress, r.host.address, buf)
err := legacy.WriteRegister(bus, deviceAddress, r.host.address, buf)
// after successful I2C write, cache this value if the host register (if also readable)
// Note we cache the entire buffer without applying shift/mask
if nil == err && r.host.attributes&reg_read != 0 {
Expand Down
2 changes: 2 additions & 0 deletions lps22hb/lps22hb_nano_33_ble.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package lps22hb
import (
"machine"
"time"

"tinygo.org/x/drivers/internal/legacy"
)

// Configure sets up the LPS22HB device for communication.
Expand Down
5 changes: 3 additions & 2 deletions ssd1306/ssd1306.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"tinygo.org/x/drivers"
"tinygo.org/x/drivers/internal/legacy"
)

// Device wraps I2C or SPI connection.
Expand Down Expand Up @@ -277,9 +278,9 @@ func (d *Device) Tx(data []byte, isCommand bool) {
// tx sends data to the display (I2CBus implementation)
func (b *I2CBus) tx(data []byte, isCommand bool) {
if isCommand {
b.wire.WriteRegister(uint8(b.Address), 0x00, data)
legacy.WriteRegister(b.wire, uint8(b.Address), 0x00, data)
} else {
b.wire.WriteRegister(uint8(b.Address), 0x40, data)
legacy.WriteRegister(b.wire, uint8(b.Address), 0x40, data)
}
}

Expand Down