mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
rmt: Add void * argument for end-of-transmission callback
Ref https://github.com/espressif/esp-idf/pull/1174
This commit is contained in:
parent
1066c74b74
commit
2227c44254
@ -119,7 +119,15 @@ typedef struct {
|
||||
|
||||
typedef intr_handle_t rmt_isr_handle_t;
|
||||
|
||||
typedef void (*rmt_tx_end_t)(rmt_channel_t channel);
|
||||
typedef void (*rmt_tx_end_fn_t)(rmt_channel_t channel, void *arg);
|
||||
|
||||
/**
|
||||
* @brief Structure encapsulating a RMT TX end callback
|
||||
*/
|
||||
typedef struct {
|
||||
rmt_tx_end_fn_t function; /*!< Function which is called on RMT TX end */
|
||||
void *arg; /*!< Optional argument passed to function */
|
||||
} rmt_tx_end_callback_t;
|
||||
|
||||
/**
|
||||
* @brief Set RMT clock divider, channel clock is divided from source clock.
|
||||
@ -711,11 +719,12 @@ esp_err_t rmt_get_ringbuf_handle(rmt_channel_t channel, RingbufHandle_t* buf_han
|
||||
*
|
||||
* @note Requires rmt_driver_install to install the default ISR handler.
|
||||
*
|
||||
* @param fn Function to be called from the default interrupt handler or NULL.
|
||||
* @param function Function to be called from the default interrupt handler or NULL.
|
||||
* @param arg Argument which will be provided to the callback when it is called.
|
||||
*
|
||||
* @return the previous handler (or NULL if there was none)
|
||||
* @return the previous callback settings (members will be set to NULL if there was none)
|
||||
*/
|
||||
rmt_tx_end_t rmt_register_tx_end_callback(rmt_tx_end_t fn);
|
||||
rmt_tx_end_callback_t rmt_register_tx_end_callback(rmt_tx_end_fn_t function, void *arg);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -76,7 +76,7 @@ typedef struct {
|
||||
rmt_obj_t* p_rmt_obj[RMT_CHANNEL_MAX] = {0};
|
||||
|
||||
// Event called when transmission is ended
|
||||
static rmt_tx_end_t rmt_tx_end_callback = NULL;
|
||||
static rmt_tx_end_callback_t rmt_tx_end_callback;
|
||||
|
||||
static void rmt_set_tx_wrap_en(rmt_channel_t channel, bool en)
|
||||
{
|
||||
@ -551,8 +551,8 @@ static void IRAM_ATTR rmt_driver_isr_default(void* arg)
|
||||
p_rmt->tx_len_rem = 0;
|
||||
p_rmt->tx_offset = 0;
|
||||
p_rmt->tx_sub_len = 0;
|
||||
if(rmt_tx_end_callback != NULL) {
|
||||
rmt_tx_end_callback(channel);
|
||||
if(rmt_tx_end_callback.function != NULL) {
|
||||
rmt_tx_end_callback.function(channel, rmt_tx_end_callback.arg);
|
||||
}
|
||||
break;
|
||||
//RX_END
|
||||
@ -777,9 +777,10 @@ esp_err_t rmt_get_ringbuf_handle(rmt_channel_t channel, RingbufHandle_t* buf_han
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
rmt_tx_end_t rmt_register_tx_end_callback(rmt_tx_end_t handler)
|
||||
rmt_tx_end_callback_t rmt_register_tx_end_callback(rmt_tx_end_fn_t function, void *arg)
|
||||
{
|
||||
rmt_tx_end_t previous = rmt_tx_end_callback;
|
||||
rmt_tx_end_callback = handler;
|
||||
rmt_tx_end_callback_t previous = rmt_tx_end_callback;
|
||||
rmt_tx_end_callback.function = function;
|
||||
rmt_tx_end_callback.arg = arg;
|
||||
return previous;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user