File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
arch/risc-v/src/common/espressif Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 80
80
#define I2C_SLAVE_POLL_RATE 10
81
81
#endif
82
82
83
+ #if !SOC_RCC_IS_INDEPENDENT
84
+ # define I2C_RCC_ATOMIC () PERIPH_RCC_ATOMIC()
85
+ #else
86
+ # define I2C_RCC_ATOMIC ()
87
+ #endif
88
+
83
89
/****************************************************************************
84
90
* Private Types
85
91
****************************************************************************/
@@ -540,7 +546,11 @@ static void esp_i2c_slave_init(struct esp_i2c_priv_s *priv)
540
546
541
547
/* Enable I2C hardware */
542
548
543
- periph_module_enable (PERIPH_I2C0_MODULE );
549
+ I2C_RCC_ATOMIC ()
550
+ {
551
+ i2c_ll_enable_bus_clock (priv -> id , true);
552
+ i2c_ll_reset_register (priv -> id );
553
+ }
544
554
545
555
i2c_hal_init (priv -> ctx , priv -> id );
546
556
@@ -583,7 +593,10 @@ static void esp_i2c_slave_deinit(struct esp_i2c_priv_s *priv)
583
593
const struct esp_i2c_config_s * config = priv -> config ;
584
594
585
595
i2c_hal_deinit (priv -> ctx );
586
- periph_module_disable (PERIPH_I2C0_MODULE );
596
+ I2C_RCC_ATOMIC ()
597
+ {
598
+ i2c_ll_enable_bus_clock (priv -> id , false);
599
+ }
587
600
}
588
601
589
602
/****************************************************************************
You can’t perform that action at this time.
0 commit comments