Skip to content

Commit bdfa4d2

Browse files
aykevldeadprogram
authored andcommitted
machine/atsamd51: fix obvious bug in I2C code
I2C uses a hardcoded peripheral instead of referring to a specific peripheral. In addition to that, it refers to the wrong SERCOM (SERCOM3), which isn't used on any of the atsamd51 boards for I2C.
1 parent 3745fb1 commit bdfa4d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/machine/machine_atsamd51.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ func (i2c I2C) WriteByte(data byte) error {
10081008
timeout := i2cTimeout
10091009
for !i2c.Bus.INTFLAG.HasBits(sam.SERCOM_I2CM_INTFLAG_MB) {
10101010
// check for bus error
1011-
if sam.SERCOM3_I2CM.STATUS.HasBits(sam.SERCOM_I2CM_STATUS_BUSERR) {
1011+
if i2c.Bus.STATUS.HasBits(sam.SERCOM_I2CM_STATUS_BUSERR) {
10121012
return errors.New("I2C bus error")
10131013
}
10141014
timeout--

0 commit comments

Comments
 (0)