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

digispark i2c bug in ReadByte() & WriteByte() #787

Closed
gen2thomas opened this issue Mar 26, 2021 · 0 comments
Closed

digispark i2c bug in ReadByte() & WriteByte() #787

gen2thomas opened this issue Mar 26, 2021 · 0 comments

Comments

@gen2thomas
Copy link
Collaborator

gen2thomas commented Mar 26, 2021

ReadByte()/WriteByte() don't rely on Read(buf)/Write(buf) but call the "littlewire.i2cRead(b, 1, 1)"/"littleWire.i2cWrite(b, 1, 1)" directly. This results in missing START-condition, which is normally done with littleWire.i2cStart(c.address, 1), refer to Read(buf)/Write(buf)-function. Therefore all functions based on ReadByte()/WriteByte will not working like expected, which is currently only ReadByteData(). For working example, see firmata_i2c.go

I will provide a bugfix asap, this could be a workaround:
func (c *digisparkI2cConnection) ReadByte() (val byte, err error) {
buf := []byte{0}
if _, err = c.Read(buf); err != nil {
return
}
val = buf[0]
return
}

@gen2thomas gen2thomas changed the title digispark i2c bug in ReadByte() digispark i2c bug in ReadByte() & WriteByte() Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant