mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/sam0/periph: remove bitfield usage in I2C driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
This commit is contained in:
parent
37b03d8172
commit
a66eebb8ac
@ -76,7 +76,7 @@ static inline SercomI2cm *bus(i2c_t dev)
|
||||
static void _syncbusy(SercomI2cm *dev)
|
||||
{
|
||||
#ifdef SERCOM_I2CM_STATUS_SYNCBUSY
|
||||
while (dev->STATUS.bit.SYNCBUSY) {}
|
||||
while (dev->STATUS.reg & SERCOM_I2CM_STATUS_SYNCBUSY) {}
|
||||
#else
|
||||
while (dev->SYNCBUSY.reg) {}
|
||||
#endif
|
||||
@ -88,9 +88,9 @@ static void _reset(SercomI2cm *dev)
|
||||
while (dev->CTRLA.reg & SERCOM_SPI_CTRLA_SWRST) {}
|
||||
|
||||
#ifdef SERCOM_I2CM_STATUS_SYNCBUSY
|
||||
while (dev->STATUS.bit.SYNCBUSY) {}
|
||||
while (dev->STATUS.reg & SERCOM_I2CM_STATUS_SYNCBUSY) {}
|
||||
#else
|
||||
while (dev->SYNCBUSY.bit.SWRST) {}
|
||||
while (dev->SYNCBUSY.reg & SERCOM_I2CM_SYNCBUSY_SWRST) {}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ void _i2c_poweron(i2c_t dev)
|
||||
if (bus(dev) == NULL) {
|
||||
return;
|
||||
}
|
||||
bus(dev)->CTRLA.bit.ENABLE = 1;
|
||||
bus(dev)->CTRLA.reg |= SERCOM_I2CM_CTRLA_ENABLE;
|
||||
_syncbusy(bus(dev));
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ void _i2c_poweroff(i2c_t dev)
|
||||
if (bus(dev) == NULL) {
|
||||
return;
|
||||
}
|
||||
bus(dev)->CTRLA.bit.ENABLE = 0;
|
||||
bus(dev)->CTRLA.reg &= ~SERCOM_I2CM_CTRLA_ENABLE;
|
||||
_syncbusy(bus(dev));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user