Adapt source files

Adapt some source files to compile for ESP32 S3
This commit is contained in:
rgomezwap 2024-08-16 16:10:50 +02:00
parent 496ba4ae61
commit e9cdef4a03
2 changed files with 18 additions and 12 deletions

View File

@ -22,7 +22,7 @@
#define UNUSED(x) (void)(x)
#if ESP_IDF_VERSION_MAJOR>=5 || CONFIG_IDF_TARGET_ESP32C3
#if ESP_IDF_VERSION_MAJOR>=5 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
#define SPICHANNEL0_HOST SPI2_HOST
#define SPICHANNEL1_HOST SPI3_HOST
#else
@ -30,7 +30,6 @@
#define SPICHANNEL1_HOST VSPI_HOST
#endif
int getSPIChannelPnt(IOEventFlags device){
return device - EV_SPI1;
}

View File

@ -160,18 +160,25 @@ void taskWaitNotify(){
#define TIMER_INTR_SEL TIMER_INTR_LEVEL /*!< Timer level interrupt */
#define TIMER_GROUP TIMER_GROUP_0 /*!< Test on timer group 0 */
#define TIMER_DIVIDER 80 /*!< Hardware timer clock divider */
#if (ESP_IDF_VERSION_MAJOR>=5) || CONFIG_IDF_TARGET_ESP32C3
#define TIMER_FINE_ADJ (1.4*(esp_clk_apb_freq() / TIMER_DIVIDER)/1000000) /*!< used to compensate alarm value */
#define TIMER_TX_UPDATE(TIMER_N) TIMERG0.hw_timer[TIMER_N].update.tx_update = 1
#define TIMER_ALARM_EN(TIMER_N) TIMERG0.hw_timer[TIMER_N].config.tx_alarm_en = 1;
#define TIMER_0_INT_CLR() TIMERG0.int_clr_timers.t0_int_clr = 1
#define TIMER_1_INT_CLR() TIMERG0.int_clr_timers.t1_int_clr = 1
#define TIMER_FINE_ADJ (1.4*(esp_clk_apb_freq() / TIMER_DIVIDER)/1000000) /*!< used to compensate alarm value */
#define TIMER_TX_UPDATE(TIMER_N) TIMERG0.hw_timer[TIMER_N].update.tx_update = 1
#define TIMER_ALARM_EN(TIMER_N) TIMERG0.hw_timer[TIMER_N].config.tx_alarm_en = 1;
#define TIMER_0_INT_CLR() TIMERG0.int_clr_timers.t0_int_clr = 1
#define TIMER_1_INT_CLR() TIMERG0.int_clr_timers.t1_int_clr = 1
#elif CONFIG_IDF_TARGET_ESP32S3
#define TIMER_FINE_ADJ (1.4*(esp_clk_apb_freq() / TIMER_DIVIDER)/1000000) /*!< used to compensate alarm value */
#define TIMER_TX_UPDATE(TIMER_N) TIMERG0.hw_timer[TIMER_N].update.tn_update = 1
#define TIMER_ALARM_EN(TIMER_N) TIMERG0.hw_timer[TIMER_N].config.tn_alarm_en = 1;
#define TIMER_0_INT_CLR() TIMERG0.int_clr_timers.t0_int_clr = 1
#define TIMER_1_INT_CLR() TIMERG0.int_clr_timers.t1_int_clr = 1
#else
#define TIMER_FINE_ADJ (1.4*(TIMER_BASE_CLK / TIMER_DIVIDER)/1000000) /*!< used to compensate alarm value */
#define TIMER_TX_UPDATE(TIMER_N) TIMERG0.hw_timer[TIMER_N].update = 1
#define TIMER_ALARM_EN(TIMER_N) TIMERG0.hw_timer[TIMER_N].config.alarm_en = 1
#define TIMER_0_INT_CLR() TIMERG0.int_clr_timers.t0 = 1;
#define TIMER_1_INT_CLR() TIMERG0.int_clr_timers.t1 = 1;
#define TIMER_FINE_ADJ (1.4*(TIMER_BASE_CLK / TIMER_DIVIDER)/1000000) /*!< used to compensate alarm value */
#define TIMER_TX_UPDATE(TIMER_N) TIMERG0.hw_timer[TIMER_N].update = 1
#define TIMER_ALARM_EN(TIMER_N) TIMERG0.hw_timer[TIMER_N].config.alarm_en = 1
#define TIMER_0_INT_CLR() TIMERG0.int_clr_timers.t0 = 1;
#define TIMER_1_INT_CLR() TIMERG0.int_clr_timers.t1 = 1;
#endif
BaseType_t xHigherPriorityTaskWoken = pdFALSE;