mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-10 06:21:35 +08:00
rc_input: correctly init SBUS inversion for other RC protocols
This commit is contained in:
@@ -411,79 +411,6 @@ typedef uint8_t px4_guid_t[PX4_GUID_BYTE_LENGTH];
|
||||
************************************************************************************/
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_rc_singlewire
|
||||
*
|
||||
* Description:
|
||||
* A board may define RC_SERIAL_SINGLEWIRE, so that RC_SERIAL_PORT is configured
|
||||
* as singlewire UART.
|
||||
*
|
||||
* Input Parameters:
|
||||
* device: serial device, e.g. "/dev/ttyS0"
|
||||
*
|
||||
* Returned Value:
|
||||
* true singlewire should be enabled.
|
||||
* false if not.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(RC_SERIAL_SINGLEWIRE)
|
||||
static inline bool board_rc_singlewire(const char *device) { return strcmp(device, RC_SERIAL_PORT) == 0; }
|
||||
#else
|
||||
static inline bool board_rc_singlewire(const char *device) { return false; }
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_rc_swap_rxtx
|
||||
*
|
||||
* Description:
|
||||
* A board may define RC_SERIAL_SWAP_RXTX, so that RC_SERIAL_PORT is configured
|
||||
* as UART with RX/TX swapped.
|
||||
*
|
||||
* Input Parameters:
|
||||
* device: serial device, e.g. "/dev/ttyS0"
|
||||
*
|
||||
* Returned Value:
|
||||
* true RX/RX should be swapped.
|
||||
* false if not.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(RC_SERIAL_SWAP_RXTX)
|
||||
static inline bool board_rc_swap_rxtx(const char *device) { return strcmp(device, RC_SERIAL_PORT) == 0; }
|
||||
#else
|
||||
static inline bool board_rc_swap_rxtx(const char *device) { return false; }
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_rc_invert_input
|
||||
*
|
||||
* 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
|
||||
* GPIO).
|
||||
*
|
||||
* Input Parameters:
|
||||
* invert_on - A positive logic value, that when true (on) will set the HW in
|
||||
* inverted NRZ mode where a MARK will be 0 and SPACE will be a 1.
|
||||
*
|
||||
* Returned Value:
|
||||
* true the UART inversion got set.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#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; }
|
||||
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
static inline bool board_rc_invert_input(const char *device, bool invert) { return false; }
|
||||
#endif
|
||||
|
||||
/* Provide an interface for reading the connected state of VBUS */
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user