Merge pull request #12101 from OTAkeys/pr/fix_i2c_release
cpu/stm32_common: disable i2c in release
This commit is contained in:
commit
25c609f2d3
@ -143,6 +143,9 @@ int i2c_acquire(i2c_t dev)
|
||||
|
||||
periph_clk_en(i2c_config[dev].bus, i2c_config[dev].rcc_mask);
|
||||
|
||||
/* enable device */
|
||||
i2c_config[dev].dev->CR1 |= I2C_CR1_PE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -150,6 +153,11 @@ void i2c_release(i2c_t dev)
|
||||
{
|
||||
assert(dev < I2C_NUMOF);
|
||||
|
||||
/* disable device */
|
||||
i2c_config[dev].dev->CR1 &= ~(I2C_CR1_PE);
|
||||
|
||||
_wait_for_bus(i2c_config[dev].dev);
|
||||
|
||||
periph_clk_dis(i2c_config[dev].bus, i2c_config[dev].rcc_mask);
|
||||
|
||||
mutex_unlock(&locks[dev]);
|
||||
|
||||
@ -193,6 +193,9 @@ int i2c_acquire(i2c_t dev)
|
||||
|
||||
periph_clk_en(i2c_config[dev].bus, i2c_config[dev].rcc_mask);
|
||||
|
||||
/* enable device */
|
||||
i2c_config[dev].dev->CR1 |= I2C_CR1_PE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -200,6 +203,11 @@ void i2c_release(i2c_t dev)
|
||||
{
|
||||
assert(dev < I2C_NUMOF);
|
||||
|
||||
/* disable device */
|
||||
i2c_config[dev].dev->CR1 &= ~(I2C_CR1_PE);
|
||||
|
||||
_wait_for_bus(i2c_config[dev].dev);
|
||||
|
||||
periph_clk_dis(i2c_config[dev].bus, i2c_config[dev].rcc_mask);
|
||||
|
||||
#ifdef STM32_PM_STOP
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user