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.
This commit is contained in:
Ayke van Laethem
2020-01-05 07:45:10 +01:00
committed by Ron Evans
parent 3745fb1c40
commit bdfa4d28cf
+1 -1
View File
@@ -1008,7 +1008,7 @@ func (i2c I2C) WriteByte(data byte) error {
timeout := i2cTimeout
for !i2c.Bus.INTFLAG.HasBits(sam.SERCOM_I2CM_INTFLAG_MB) {
// check for bus error
if sam.SERCOM3_I2CM.STATUS.HasBits(sam.SERCOM_I2CM_STATUS_BUSERR) {
if i2c.Bus.STATUS.HasBits(sam.SERCOM_I2CM_STATUS_BUSERR) {
return errors.New("I2C bus error")
}
timeout--