Commit 7155d719 authored by Tom Sutcliffe's avatar Tom Sutcliffe Committed by Johny Mattsson
Browse files

Fix platform_rmt_allocate for esp32-S3

By not relying on ifdefing for specific targets, but instead using the
SOC_RMT_xxx macros to figure it out.
parent 1b38d8e6
......@@ -24,19 +24,19 @@ static bool rmt_channel_check( uint8_t channel, uint8_t num_mem )
return rmt_channel_check( channel-1, num_mem-1);
}
#if defined(CONFIG_IDF_TARGET_ESP32C3)
int platform_rmt_allocate( uint8_t num_mem, rmt_mode_t mode )
#else
int platform_rmt_allocate( uint8_t num_mem, rmt_mode_t mode __attribute__((unused)))
#endif
{
int channel;
int alloc_min;
int alloc_max;
uint8_t tag = 1;
#if defined(CONFIG_IDF_TARGET_ESP32C3)
/* The ESP32-C3 is limited to TX on channel 0-1 and RX on channel 2-3. */
#if SOC_RMT_TX_CANDIDATES_PER_GROUP == SOC_RMT_CHANNELS_PER_GROUP
alloc_min = 0;
alloc_max = RMT_CHANNEL_MAX - 1;
#else
/* On platforms where channels cannot do both TX and RX, the TX ones always
seem to start at index 0, and are then followed by the RX channels. */
if( mode==RMT_MODE_TX ) {
alloc_min = 0;
alloc_max = SOC_RMT_TX_CANDIDATES_PER_GROUP - 1;
......@@ -44,10 +44,6 @@ int platform_rmt_allocate( uint8_t num_mem, rmt_mode_t mode __attribute__((unuse
alloc_min = RMT_CHANNEL_MAX - SOC_RMT_RX_CANDIDATES_PER_GROUP;
alloc_max = RMT_CHANNEL_MAX - 1;
}
#else
/* The other ESP32 devices can do RX and TX on all channels. */
alloc_min = 0;
alloc_max = RMT_CHANNEL_MAX - 1;
#endif
for (channel = alloc_max; channel >= alloc_min; channel--) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment