boards: simplify RC port configuration by using NuttX ioctl's

A board only needs to define:
 #define RC_SERIAL_PORT                     "/dev/ttyS4"

Then it can optionally define one or more of the following:
 #define RC_SERIAL_SWAP_RXTX
 #define RC_SERIAL_SINGLEWIRE
 #define RC_INVERT_INPUT(_invert_true) px4_arch_gpiowrite(GPIO_SBUS_INV, _invert_true)
This commit is contained in:
Beat Küng
2019-07-16 08:09:22 +02:00
parent 9a1ad97c11
commit b7a0e1ef03
18 changed files with 149 additions and 317 deletions
+4 -2
View File
@@ -63,7 +63,7 @@ class RCInput : public ModuleBase<RCInput>
{
public:
RCInput(bool run_as_task);
RCInput(bool run_as_task, char *device);
virtual ~RCInput();
/** @see ModuleBase */
@@ -132,6 +132,7 @@ private:
orb_advert_t _to_input_rc{nullptr};
int _rcs_fd{-1};
char _device[20] {}; ///< device / serial port path
uint8_t _rcs_buf[SBUS_BUFFER_SIZE] {};
@@ -144,6 +145,7 @@ private:
perf_counter_t _publish_interval_perf;
static void cycle_trampoline(void *arg);
static void cycle_trampoline_init(void *arg);
int start();
void fill_rc_in(uint16_t raw_rc_count_local,
@@ -153,6 +155,6 @@ private:
void set_rc_scan_state(RC_SCAN _rc_scan_state);
void rc_io_invert(bool invert, uint32_t uxart_base);
void rc_io_invert(bool invert);
};