diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/platforms/STM32/i2c_lld.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/os/hal/platforms/STM32/i2c_lld.c b/os/hal/platforms/STM32/i2c_lld.c index 9038d351f..d10cb4031 100644 --- a/os/hal/platforms/STM32/i2c_lld.c +++ b/os/hal/platforms/STM32/i2c_lld.c @@ -721,8 +721,10 @@ void i2c_lld_master_transmit(I2CDriver *i2cp, uint16_t slave_addr, #else chDbgAssert(!(i2cp->flags & I2C_FLG_TIMER_ARMED), "i2c_lld_master_transmit(), #1", "time to STOP is out"); if ((i2cp->id_i2c->CR1 & I2C_CR1_STOP) && i2cp->timer != NULL && i2cp->timer_cfg != NULL){ + chSysLockFromIsr(); gptStartOneShotI(i2cp->timer, I2C_STOP_GPT_TIMEOUT); i2cp->flags |= I2C_FLG_TIMER_ARMED; + chSysUnlockFromIsr(); return; } #endif /* STM32_I2C_I2C1_USE_POLLING_WAIT */ @@ -779,8 +781,10 @@ void i2c_lld_master_receive(I2CDriver *i2cp, uint16_t slave_addr, #else chDbgAssert(!(i2cp->flags & I2C_FLG_TIMER_ARMED), "i2c_lld_master_receive(), #1", "time to STOP is out"); if ((i2cp->id_i2c->CR1 & I2C_CR1_STOP) && i2cp->timer != NULL && i2cp->timer_cfg != NULL){ + chSysLockFromIsr(); gptStartOneShotI(i2cp->timer, I2C_STOP_GPT_TIMEOUT); i2cp->flags |= I2C_FLG_TIMER_ARMED; + chSysUnlockFromIsr(); return; } #endif /* STM32_I2C_I2C1_USE_POLLING_WAIT */ @@ -845,8 +849,10 @@ void i2c_lld_master_transceive(I2CDriver *i2cp){ #else chDbgAssert(!(i2cp->flags & I2C_FLG_TIMER_ARMED), "i2c_lld_master_transceive(), #1", "time to START is out"); if ((i2cp->id_i2c->CR1 & I2C_CR1_START) && i2cp->timer != NULL && i2cp->timer_cfg != NULL){ + chSysLockFromIsr(); gptStartOneShotI(i2cp->timer, I2C_START_GPT_TIMEOUT); i2cp->flags |= I2C_FLG_TIMER_ARMED; + chSysUnlockFromIsr(); return; } #endif /* STM32_I2C_I2C1_USE_POLLING_WAIT */ |