common_rc: enable on v5x/v6x/v6s, disable rc_input

This commit is contained in:
Alexander Lerach
2025-07-30 15:09:39 +02:00
committed by Silvan Fuhrer
parent c9206d6bd1
commit 2ecc7226e6
10 changed files with 23 additions and 22 deletions
@@ -47,6 +47,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <px4_boardconfig.h>
/************************************************************************************
* Definitions
************************************************************************************/
@@ -258,6 +259,15 @@
# define BOARD_EEPROM_WP_CTRL(on_true)
#endif
/*
* Support both RC_SERIAL_PORT and CONFIG_BOARD_SERIAL_RC
*/
#if defined(CONFIG_BOARD_SERIAL_RC)
# define RC_SERIAL CONFIG_BOARD_SERIAL_RC
#else
# define RC_SERIAL RC_SERIAL_PORT
#endif
/*
* Defined when a supports version and type API.
*/
@@ -450,7 +460,7 @@ __BEGIN_DECLS
* Name: board_rc_singlewire
*
* Description:
* A board may define RC_SERIAL_SINGLEWIRE, so that RC_SERIAL_PORT is configured
* A board may define RC_SERIAL_SINGLEWIRE, so that RC_SERIAL is configured
* as singlewire UART.
*
* Input Parameters:
@@ -463,7 +473,7 @@ __BEGIN_DECLS
************************************************************************************/
#if defined(RC_SERIAL_SINGLEWIRE)
static inline bool board_rc_singlewire(const char *device) { return strcmp(device, RC_SERIAL_PORT) == 0; }
static inline bool board_rc_singlewire(const char *device) { return strcmp(device, RC_SERIAL) == 0; }
#elif defined(RC_SERIAL_SINGLEWIRE_FORCE)
static inline bool board_rc_singlewire(const char *device) { return true; }
#else
@@ -474,7 +484,7 @@ static inline bool board_rc_singlewire(const char *device) { return false; }
* Name: board_rc_swap_rxtx
*
* Description:
* A board may define RC_SERIAL_SWAP_RXTX, so that RC_SERIAL_PORT is configured
* A board may define RC_SERIAL_SWAP_RXTX, so that RC_SERIAL is configured
* as UART with RX/TX swapped.
*
* It can optionaly define RC_SERIAL_SWAP_USING_SINGLEWIRE If the board is wired
@@ -496,7 +506,7 @@ static inline bool board_rc_singlewire(const char *device) { return false; }
************************************************************************************/
#if defined(RC_SERIAL_SWAP_RXTX)
static inline bool board_rc_swap_rxtx(const char *device) { return strcmp(device, RC_SERIAL_PORT) == 0; }
static inline bool board_rc_swap_rxtx(const char *device) { return strcmp(device, RC_SERIAL) == 0; }
#else
static inline bool board_rc_swap_rxtx(const char *device) { return false; }
#endif
@@ -506,7 +516,7 @@ static inline bool board_rc_swap_rxtx(const char *device) { return false; }
*
* Description:
* All boards may optionally define RC_INVERT_INPUT(bool invert) that is
* used to invert the RC_SERIAL_PORT RC port (e.g. to toggle an external XOR via
* used to invert the RC_SERIAL RC port (e.g. to toggle an external XOR via
* GPIO).
*
* Input Parameters:
@@ -521,7 +531,7 @@ static inline bool board_rc_swap_rxtx(const char *device) { return false; }
#ifdef RC_INVERT_INPUT
static inline bool board_rc_invert_input(const char *device, bool invert)
{
if (strcmp(device, RC_SERIAL_PORT) == 0) { RC_INVERT_INPUT(invert); return true; }
if (strcmp(device, RC_SERIAL) == 0) { RC_INVERT_INPUT(invert); return true; }
return false;
}