my sbus
Fork of FutabaSBUS by
Diff: FutabaSBUS.cpp
- Revision:
- 2:07dbb77a6f1a
- Parent:
- 1:e3c92fba87f2
- Child:
- 3:50e10bf74374
--- a/FutabaSBUS.cpp Thu Feb 09 21:50:00 2012 +0000 +++ b/FutabaSBUS.cpp Mon Feb 08 08:47:36 2016 +0000 @@ -21,7 +21,7 @@ */ #include "FutabaSBUS.h" -#include "MODSERIAL.h" +//#include "MODSERIAL.h" #include "mbed.h" //debug only @@ -42,7 +42,8 @@ // Set Datalenght & Frame sbus_.format(8, Serial::Even, 2); // Attach interrupt routines - sbus_.attach(this, &FutabaSBUS::SBUS_irq_rx, MODSERIAL::RxIrq); +// sbus_.attach(this, &FutabaSBUS::SBUS_irq_rx, MODSERIAL::RxIrq); + sbus_.attach(this, &FutabaSBUS::SBUS_irq_rx, RawSerial::RxIrq); // init ticker 500us rxSBUS.attach_us(this, &FutabaSBUS::rx_ticker_500us,500); rx_timeout=50; @@ -85,6 +86,11 @@ uint8_t FutabaSBUS::failsafe(void) {return failsafe_status;} +void FutabaSBUS::failsafe(uint8_t status) { + failsafe_status = status; + sbus_.baud(100000); +} + void FutabaSBUS::passthrough(bool mode) { // Set passtrough mode, if true, received channel data is send to servos sbus_passthrough = mode; @@ -98,7 +104,8 @@ /****************************************************************/ /****************************************************************/ -void FutabaSBUS::SBUS_irq_rx(MODSERIAL_IRQ_INFO *q) { +//void FutabaSBUS::SBUS_irq_rx(MODSERIAL_IRQ_INFO *q) { +void FutabaSBUS::SBUS_irq_rx(void) { rx_timeout=2; tx_timeout=4; } @@ -237,7 +244,7 @@ } void FutabaSBUS::rx_ticker_500us(void) { - // RX +/* // RX switch (rx_timeout) { case 0: break; @@ -246,6 +253,7 @@ default: rx_timeout--; } +*/ // TX switch (tx_timeout) { case 0: