From a66eebb8acd907ed00fac5ae7028c8749f7d738b Mon Sep 17 00:00:00 2001 From: Dylan Laduranty Date: Mon, 10 Jun 2024 16:52:11 +0200 Subject: [PATCH] cpu/sam0/periph: remove bitfield usage in I2C driver Signed-off-by: Dylan Laduranty --- cpu/sam0_common/periph/i2c.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cpu/sam0_common/periph/i2c.c b/cpu/sam0_common/periph/i2c.c index 2adcd4eac0..2772ccec65 100644 --- a/cpu/sam0_common/periph/i2c.c +++ b/cpu/sam0_common/periph/i2c.c @@ -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)); }