diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-08-02 22:11:57 +0200 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-08-02 22:11:57 +0200 |
commit | f7582b4d00f8fce4c9c93d47e2c178a36759f7ad (patch) | |
tree | bcd1f8508d84991d6ce2b2ca55c17f8afc744503 /src/modules/px4iofirmware/sbus.c | |
parent | 4bf83271181d2d2ddb54ad031c16135f5ccf2e7d (diff) | |
parent | d3d5aa9bdc16b22f6e349190f18f411bd192bc2a (diff) | |
download | px4-firmware-f7582b4d00f8fce4c9c93d47e2c178a36759f7ad.tar.gz px4-firmware-f7582b4d00f8fce4c9c93d47e2c178a36759f7ad.tar.bz2 px4-firmware-f7582b4d00f8fce4c9c93d47e2c178a36759f7ad.zip |
Merge branch 'master' into smooth_pos_hold
Diffstat (limited to 'src/modules/px4iofirmware/sbus.c')
-rw-r--r-- | src/modules/px4iofirmware/sbus.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/modules/px4iofirmware/sbus.c b/src/modules/px4iofirmware/sbus.c index f6ec542eb..0f0414148 100644 --- a/src/modules/px4iofirmware/sbus.c +++ b/src/modules/px4iofirmware/sbus.c @@ -93,7 +93,7 @@ int sbus_init(const char *device) { if (sbus_fd < 0) - sbus_fd = open(device, O_RDONLY | O_NONBLOCK); + sbus_fd = open(device, O_RDWR | O_NONBLOCK); if (sbus_fd >= 0) { struct termios t; @@ -113,10 +113,23 @@ sbus_init(const char *device) } else { debug("S.Bus: open failed"); } - return sbus_fd; } +void +sbus1_output(uint16_t *values, uint16_t num_values) +{ + char a = 'A'; + write(sbus_fd, &a, 1); +} + +void +sbus2_output(uint16_t *values, uint16_t num_values) +{ + char b = 'B'; + write(sbus_fd, &b, 1); +} + bool sbus_input(uint16_t *values, uint16_t *num_values, bool *sbus_failsafe, bool *sbus_frame_drop, uint16_t max_channels) { |