increase RMT buffer and stability on data rx errors

This commit is contained in:
demik 2021-08-05 18:41:04 +02:00
parent c1d827e5d7
commit 5c6a13b1fa

View File

@ -31,6 +31,9 @@
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "driver/rmt.h"
#include "driver/periph_ctrl.h"
#include "soc/periph_defs.h"
#include "soc/rmt_reg.h"
#include "adb.h"
#include "led.h"
@ -46,6 +49,7 @@ extern TaskHandle_t t_click, t_qx, t_qy;
/* static defines */
static void adb_handle_button(bool action);
static void adb_rmt_reset(void);
static bool adb_rx_isone(rmt_item32_t cell);
static bool adb_rx_isstop(rmt_item32_t cell);
static bool adb_rx_iszero(rmt_item32_t cell);
@ -91,7 +95,7 @@ void adb_init(void) {
esp_log_level_set("intr_alloc", ESP_LOG_INFO);
/* init RMT RX driver with default values for ADB */
adb_rmt_rx.mem_block_num = 2;
adb_rmt_rx.mem_block_num = 4;
adb_rmt_rx.rx_config.filter_en = true;
adb_rmt_rx.rx_config.filter_ticks_thresh = 10;
adb_rmt_rx.rx_config.idle_threshold = 100;
@ -296,7 +300,9 @@ static uint16_t IRAM_ATTR adb_rx_mouse() {
case 0:
return 0;
case 4:
/* single glitch, go timeout */
/* single glitch or service request (keyboard), timeout/ignore */
rmt_memory_rw_rst(RMT_RX_CHANNEL);
vRingbufferReturnItem(rb, (void*) items);
return 0;
case 72:
xTaskNotify(t_yellow, LED_ONCE, eSetValueWithOverwrite);