mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
espressif/rmt: replace rmtchar with arch-specific lirc adapter
Replace the ESP-specific rmtchar upper-half with arch-local esp_lirc adapters for Xtensa and RISC-V. This moves the RMT upper-half out of drivers/rmt, registers LIRC devices from the ESP board bring-up paths, and removes the old common rmtchar driver and headers. Also update the ESP Kconfig and build wiring to build esp_lirc when ESP_RMT and DRIVERS_RC are enabled. Fixes discovered during hardware validation: - register TX as /dev/lirc1 so RX and TX do not collide - parse the RX worker thread argument from the correct argv slot - keep RX devices from advertising TX capability Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
This commit is contained in:
committed by
Alan C. Assis
parent
96005c6a7d
commit
7b590f9c43
@@ -33,7 +33,7 @@
|
||||
#include "xtensa.h"
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/rmt/rmtchar.h>
|
||||
#include "espressif/esp_lirc.h"
|
||||
#ifdef CONFIG_WS2812_NON_SPI_DRIVER
|
||||
#include <nuttx/leds/ws2812.h>
|
||||
|
||||
@@ -89,13 +89,19 @@
|
||||
int board_rmt_rxinitialize(int pin)
|
||||
{
|
||||
int ret;
|
||||
struct rmt_dev_s *rmt;
|
||||
|
||||
struct rmt_dev_s *rmt = esp_rmt_rx_init(pin);
|
||||
rmt = esp_rmt_rx_init(pin);
|
||||
if (rmt == NULL)
|
||||
{
|
||||
rmterr("ERROR: esp_rmt_rx_init failed\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = rmtchar_register(rmt);
|
||||
ret = esp_lirc_rx_initialize(0, rmt);
|
||||
if (ret < 0)
|
||||
{
|
||||
rmterr("ERROR: rmtchar_register failed: %d\n", ret);
|
||||
rmterr("ERROR: esp_lirc_rx_initialize failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -125,17 +131,16 @@ int board_rmt_txinitialize(int pin)
|
||||
#endif
|
||||
|
||||
rmt = esp_rmt_tx_init(pin);
|
||||
|
||||
if (rmt == NULL)
|
||||
{
|
||||
rmterr("ERROR: esp_rmt_tx_init failed\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = rmtchar_register(rmt);
|
||||
ret = esp_lirc_tx_initialize(1, rmt);
|
||||
if (ret < 0)
|
||||
{
|
||||
rmterr("ERROR: rmtchar_register failed: %d\n", ret);
|
||||
rmterr("ERROR: esp_lirc_tx_initialize failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,9 @@ CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DRIVERS_RC=y
|
||||
CONFIG_ESP32_UART0=y
|
||||
CONFIG_ESP_RMT=y
|
||||
CONFIG_EXAMPLES_RMTCHAR=y
|
||||
CONFIG_EXAMPLES_RMTCHAR_RX=y
|
||||
CONFIG_EXAMPLES_RMTCHAR_TX=y
|
||||
CONFIG_EXAMPLES_WS2812=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
@@ -44,9 +42,6 @@ CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RMT=y
|
||||
CONFIG_RMTCHAR=y
|
||||
CONFIG_RMT_DEFAULT_RX_BUFFER_SIZE=256
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_DAY=6
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "xtensa.h"
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/rmt/rmtchar.h>
|
||||
#include "espressif/esp_lirc.h"
|
||||
#ifdef CONFIG_WS2812_NON_SPI_DRIVER
|
||||
#include <nuttx/leds/ws2812.h>
|
||||
|
||||
@@ -98,10 +98,10 @@ int board_rmt_rxinitialize(int pin)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = rmtchar_register(rmt);
|
||||
ret = esp_lirc_rx_initialize(0, rmt);
|
||||
if (ret < 0)
|
||||
{
|
||||
rmterr("ERROR: rmtchar_register failed: %d\n", ret);
|
||||
rmterr("ERROR: esp_lirc_rx_initialize failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -137,10 +137,10 @@ int board_rmt_txinitialize(int pin)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = rmtchar_register(rmt);
|
||||
ret = esp_lirc_tx_initialize(1, rmt);
|
||||
if (ret < 0)
|
||||
{
|
||||
rmterr("ERROR: rmtchar_register failed: %d\n", ret);
|
||||
rmterr("ERROR: esp_lirc_tx_initialize failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,9 @@ CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DRIVERS_RC=y
|
||||
CONFIG_ESP32S2_UART0=y
|
||||
CONFIG_ESP_RMT=y
|
||||
CONFIG_EXAMPLES_RMTCHAR=y
|
||||
CONFIG_EXAMPLES_RMTCHAR_RX=y
|
||||
CONFIG_EXAMPLES_RMTCHAR_TX=y
|
||||
CONFIG_EXAMPLES_WS2812=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
@@ -45,9 +43,6 @@ CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RMT=y
|
||||
CONFIG_RMTCHAR=y
|
||||
CONFIG_RMT_DEFAULT_RX_BUFFER_SIZE=256
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_DAY=6
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "xtensa.h"
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/rmt/rmtchar.h>
|
||||
#include "espressif/esp_lirc.h"
|
||||
#ifdef CONFIG_WS2812_NON_SPI_DRIVER
|
||||
#include <nuttx/leds/ws2812.h>
|
||||
|
||||
@@ -89,13 +89,19 @@
|
||||
int board_rmt_rxinitialize(int pin)
|
||||
{
|
||||
int ret;
|
||||
struct rmt_dev_s *rmt;
|
||||
|
||||
struct rmt_dev_s *rmt = esp_rmt_rx_init(pin);
|
||||
rmt = esp_rmt_rx_init(pin);
|
||||
if (rmt == NULL)
|
||||
{
|
||||
rmterr("ERROR: esp_rmt_rx_init failed\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = rmtchar_register(rmt);
|
||||
ret = esp_lirc_rx_initialize(0, rmt);
|
||||
if (ret < 0)
|
||||
{
|
||||
rmterr("ERROR: rmtchar_register failed: %d\n", ret);
|
||||
rmterr("ERROR: esp_lirc_rx_initialize failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -131,10 +137,10 @@ int board_rmt_txinitialize(int pin)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = rmtchar_register(rmt);
|
||||
ret = esp_lirc_tx_initialize(1, rmt);
|
||||
if (ret < 0)
|
||||
{
|
||||
rmterr("ERROR: rmtchar_register failed: %d\n", ret);
|
||||
rmterr("ERROR: esp_lirc_tx_initialize failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,9 @@ CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DRIVERS_RC=y
|
||||
CONFIG_ESP32S3_UART0=y
|
||||
CONFIG_ESP_RMT=y
|
||||
CONFIG_EXAMPLES_RMTCHAR=y
|
||||
CONFIG_EXAMPLES_RMTCHAR_RX=y
|
||||
CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH="/dev/rmt4"
|
||||
CONFIG_EXAMPLES_RMTCHAR_TX=y
|
||||
CONFIG_EXAMPLES_WS2812=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
@@ -47,9 +44,6 @@ CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RMT=y
|
||||
CONFIG_RMTCHAR=y
|
||||
CONFIG_RMT_DEFAULT_RX_BUFFER_SIZE=256
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_DAY=6
|
||||
|
||||
Reference in New Issue
Block a user