Skip to content

Commit

Permalink
cpu/esp32: remove ESP-IDF periph_ctrl interface API
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Mar 26, 2023
1 parent 4354089 commit 3e52e73
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 82 deletions.
30 changes: 0 additions & 30 deletions cpu/esp32/esp-idf-api/periph_ctrl.c

This file was deleted.

39 changes: 0 additions & 39 deletions cpu/esp32/include/esp_idf_api/periph_ctrl.h

This file was deleted.

7 changes: 3 additions & 4 deletions cpu/esp32/periph/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@
#include "periph/pwm.h"
#include "periph/gpio.h"

#include "driver/periph_ctrl.h"
#include "esp_common.h"
#include "esp_rom_gpio.h"
#include "hal/ledc_hal.h"
#include "soc/ledc_struct.h"
#include "soc/rtc.h"

#include "esp_idf_api/periph_ctrl.h"

#define ENABLE_DEBUG 0
#include "debug.h"

Expand Down Expand Up @@ -253,7 +252,7 @@ void pwm_poweron(pwm_t pwm)
DEBUG("%s pwm=%u\n", __func__, pwm);

/* enable and init the module and select the right clock source */
esp_idf_periph_module_enable(_CFG.module);
periph_module_enable(_CFG.module);
ledc_hal_init(&_DEV.hw, _CFG.group);
ledc_hal_set_slow_clk_sel(&_DEV.hw, LEDC_SLOW_CLK_APB);
ledc_hal_set_clock_source(&_DEV.hw, _CFG.timer, LEDC_APB_CLK);
Expand Down Expand Up @@ -317,7 +316,7 @@ void pwm_poweroff(pwm_t pwm)

/* if all devices of the same hardware module are disable, it is powered off */
if (i == PWM_NUMOF) {
esp_idf_periph_module_disable(_CFG.module);
periph_module_disable(_CFG.module);
}
}

Expand Down
4 changes: 2 additions & 2 deletions cpu/esp32/periph/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
#include "periph/spi.h"
#include "syscalls.h"

#include "driver/periph_ctrl.h"
#include "esp_attr.h"
#include "esp_rom_gpio.h"
#include "hal/spi_hal.h"
#include "hal/spi_types.h"
#include "soc/rtc.h"

#include "esp_idf_api/periph_ctrl.h"
#include "esp_idf_api/gpio.h"

#undef MHZ
Expand Down Expand Up @@ -117,7 +117,7 @@ void IRAM_ATTR spi_init(spi_t bus)
}

/* enable (power on) the according SPI module */
esp_idf_periph_module_enable(_spi[bus].periph->module);
periph_module_enable(_spi[bus].periph->module);

/* initialize SPI peripheral */
spi_ll_master_init(_spi[bus].periph->hw);
Expand Down
5 changes: 2 additions & 3 deletions cpu/esp32/periph/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
#include "periph/timer.h"

#include "driver/periph_ctrl.h"
#include "esp/common_macros.h"
#include "hal/interrupt_controller_types.h"
#include "hal/interrupt_controller_ll.h"
Expand All @@ -40,8 +41,6 @@
#include "xtensa/xtensa_api.h"
#endif

#include "esp_idf_api/periph_ctrl.h"

#include "esp_common.h"
#include "irq_arch.h"
#include "syscalls.h"
Expand Down Expand Up @@ -244,7 +243,7 @@ int timer_init(tim_t dev, uint32_t freq, timer_cb_t cb, void *arg)
intr_cntrl_ll_enable_interrupts(BIT(CPU_INUM_TIMER));

/* enable TMG module */
esp_idf_periph_module_enable(_timers_desc[dev].module);
periph_module_enable(_timers_desc[dev].module);

/* hardware timer configuration */
timer_hal_init(&_timers[dev].hw, _timers_desc[dev].group, _timers_desc[dev].index);
Expand Down
7 changes: 3 additions & 4 deletions cpu/esp_common/periph/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

#else /* defined(MCU_ESP8266) */

#include "driver/periph_ctrl.h"
#include "esp_rom_gpio.h"
#include "esp_rom_uart.h"
#include "hal/interrupt_controller_types.h"
Expand All @@ -73,8 +74,6 @@
#include "soc/uart_reg.h"
#include "soc/uart_struct.h"

#include "esp_idf_api/periph_ctrl.h"

#undef UART_CLK_FREQ
#define UART_CLK_FREQ rtc_clk_apb_freq_get() /* APB_CLK is used */

Expand Down Expand Up @@ -232,7 +231,7 @@ void uart_poweron(uart_t uart)
assert(uart < UART_NUMOF);

#ifndef MCU_ESP8266
esp_idf_periph_module_enable(_uarts[uart].mod);
periph_module_enable(_uarts[uart].mod);
#endif
_uart_config(uart);
}
Expand All @@ -242,7 +241,7 @@ void uart_poweroff(uart_t uart)
assert(uart < UART_NUMOF);

#ifndef MCU_ESP8266
esp_idf_periph_module_disable(_uarts[uart].mod);
periph_module_disable(_uarts[uart].mod);
#endif
}

Expand Down

0 comments on commit 3e52e73

Please sign in to comment.