Skip to content

Commit a619d31

Browse files
committed
Replace periph_ctrl.h use because of deprecation
1 parent 3454aba commit a619d31

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

cores/esp32/esp32-hal-i2c-slave.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
#include "freertos/ringbuf.h"
3737

3838
#include "esp_intr_alloc.h"
39-
#include "driver/periph_ctrl.h"
4039
#include "soc/i2c_reg.h"
4140
#include "soc/i2c_struct.h"
4241
#include "hal/i2c_ll.h"
42+
#include "hal/clk_gate_ll.h"
4343
#include "esp32-hal-log.h"
4444
#include "esp32-hal-i2c-slave.h"
4545

@@ -292,10 +292,10 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
292292
frequency = (frequency * 5) / 4;
293293

294294
if (i2c->num == 0) {
295-
periph_module_enable(PERIPH_I2C0_MODULE);
295+
periph_ll_enable_clk_clear_rst(PERIPH_I2C0_MODULE);
296296
#if SOC_I2C_NUM > 1
297297
} else {
298-
periph_module_enable(PERIPH_I2C1_MODULE);
298+
periph_ll_enable_clk_clear_rst(PERIPH_I2C1_MODULE);
299299
#endif
300300
}
301301

cores/esp32/esp32-hal-spi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "soc/io_mux_reg.h"
2424
#include "soc/gpio_sig_map.h"
2525
#include "soc/rtc.h"
26-
#include "driver/periph_ctrl.h"
26+
#include "hal/clk_gate_ll.h"
2727

2828
#include "esp_system.h"
2929
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
@@ -729,11 +729,11 @@ spi_t * spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_
729729
}
730730
#elif CONFIG_IDF_TARGET_ESP32S3
731731
if(spi_num == FSPI) {
732-
periph_module_reset( PERIPH_SPI2_MODULE );
733-
periph_module_enable( PERIPH_SPI2_MODULE );
732+
periph_ll_reset( PERIPH_SPI2_MODULE );
733+
periph_ll_enable_clk_clear_rst( PERIPH_SPI2_MODULE );
734734
} else if(spi_num == HSPI) {
735-
periph_module_reset( PERIPH_SPI3_MODULE );
736-
periph_module_enable( PERIPH_SPI3_MODULE );
735+
periph_ll_reset( PERIPH_SPI3_MODULE );
736+
periph_ll_enable_clk_clear_rst( PERIPH_SPI3_MODULE );
737737
}
738738
#elif CONFIG_IDF_TARGET_ESP32
739739
if(spi_num == HSPI) {
@@ -747,8 +747,8 @@ spi_t * spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_
747747
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_SPI01_RST);
748748
}
749749
#elif CONFIG_IDF_TARGET_ESP32C3
750-
periph_module_reset( PERIPH_SPI2_MODULE );
751-
periph_module_enable( PERIPH_SPI2_MODULE );
750+
periph_ll_reset( PERIPH_SPI2_MODULE );
751+
periph_ll_enable_clk_clear_rst( PERIPH_SPI2_MODULE );
752752
#endif
753753

754754
SPI_MUTEX_LOCK();

cores/esp32/esp32-hal-tinyusb.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323
#include "hal/usb_hal.h"
2424
#include "hal/gpio_ll.h"
25+
#include "hal/clk_gate_ll.h"
2526

2627
#include "freertos/FreeRTOS.h"
2728
#include "freertos/task.h"
2829

2930
#include "driver/gpio.h"
30-
#include "driver/periph_ctrl.h"
3131

3232
#include "esp_rom_gpio.h"
3333

@@ -395,9 +395,9 @@ static void hw_cdc_reset_handler(void *arg) {
395395

396396
static void usb_switch_to_cdc_jtag(){
397397
// Disable USB-OTG
398-
periph_module_reset(PERIPH_USB_MODULE);
399-
//periph_module_enable(PERIPH_USB_MODULE);
400-
periph_module_disable(PERIPH_USB_MODULE);
398+
periph_ll_reset(PERIPH_USB_MODULE);
399+
//periph_ll_enable_clk_clear_rst(PERIPH_USB_MODULE);
400+
periph_ll_disable_clk_set_rst(PERIPH_USB_MODULE);
401401

402402
// Switch to hardware CDC+JTAG
403403
CLEAR_PERI_REG_MASK(RTC_CNTL_USB_CONF_REG, (RTC_CNTL_SW_HW_USB_PHY_SEL|RTC_CNTL_SW_USB_PHY_SEL|RTC_CNTL_USB_PAD_ENABLE));
@@ -457,8 +457,8 @@ static void IRAM_ATTR usb_persist_shutdown_handler(void)
457457
chip_usb_set_persist_flags(USBDC_PERSIST_ENA);
458458
#if CONFIG_IDF_TARGET_ESP32S2
459459
} else {
460-
periph_module_reset(PERIPH_USB_MODULE);
461-
periph_module_enable(PERIPH_USB_MODULE);
460+
periph_ll_reset(PERIPH_USB_MODULE);
461+
periph_ll_enable_clk_clear_rst(PERIPH_USB_MODULE);
462462
#endif
463463
}
464464
REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
@@ -696,8 +696,8 @@ esp_err_t tinyusb_init(tinyusb_device_config_t *config) {
696696
//} else
697697
if(!usb_did_persist || !usb_persist_enabled){
698698
// Reset USB module
699-
periph_module_reset(PERIPH_USB_MODULE);
700-
periph_module_enable(PERIPH_USB_MODULE);
699+
periph_ll_reset(PERIPH_USB_MODULE);
700+
periph_ll_enable_clk_clear_rst(PERIPH_USB_MODULE);
701701
}
702702

703703
tinyusb_config_t tusb_cfg = {

0 commit comments

Comments
 (0)