rmtuart: echo suppression

This commit is contained in:
informatic 2024-07-20 11:53:43 +02:00
parent 55566fe871
commit 7fb2f24269
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View file

@ -30,7 +30,9 @@ void rmtuart_transmit_words(rmtuart_ctx_t *ctx)
size_t read_len = xStreamBufferReceive(ctx->tx_buffer, &word, 1, pdMS_TO_TICKS(1000));
if (read_len == 1)
{
ctx->tx_busy = true;
rmtuart_transmit_word(ctx, word);
ctx->tx_busy = false;
ESP_LOGD(TAG, "Transmit done %02x", word);
}
else
@ -175,7 +177,7 @@ void rmtuart_transmit_word(rmtuart_ctx_t *ctx, uint32_t word)
static void IRAM_ATTR gpio_isr_handler(rmtuart_ctx_t *ctx)
{
if (gpio_get_level(ctx->rx_gpio) == 1 && ctx->bit_cnt == 0)
if (!ctx->tx_busy && ctx->bit_cnt == 0 && gpio_get_level(ctx->rx_gpio) == 1)
{
ctx->bit_cnt = 1;
ctx->buf = 0;

View file

@ -39,6 +39,7 @@ typedef struct
int bit_cnt;
uint8_t buf;
esp_timer_handle_t rx_bit_timer;
bool tx_busy;
} rmtuart_ctx_t;
void rmtuart_start(rmtuart_ctx_t *ctx);