diff options
-rw-r--r-- | chip/stm32/i2c-stm32f0.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c index 4d2da2a353..8685ef5911 100644 --- a/chip/stm32/i2c-stm32f0.c +++ b/chip/stm32/i2c-stm32f0.c @@ -12,6 +12,7 @@ #include "host_command.h" #include "i2c.h" #include "registers.h" +#include "system.h" #include "task.h" #include "timer.h" #include "usb_pd_tcpc.h" @@ -267,6 +268,8 @@ static void i2c_event_handler(int port) /* Clear ADDR bit by writing to ADDRCF bit */ STM32_I2C_ICR(port) |= STM32_I2C_ICR_ADDRCF; + /* Inhibit stop mode when addressed until STOPF flag is set */ + disable_sleep(SLEEP_MASK_I2C_SLAVE); } /* Stop condition on bus */ @@ -289,6 +292,9 @@ static void i2c_event_handler(int port) /* Clear STOPF bit by writing to STOPCF bit */ STM32_I2C_ICR(port) |= STM32_I2C_ICR_STOPCF; + + /* No longer inhibit deep sleep after stop condition */ + enable_sleep(SLEEP_MASK_I2C_SLAVE); } /* Receiver full event */ |