my sbus

Dependents:   Drone_air

Fork of FutabaSBUS by Uwe Gartmann

Files at this revision

API Documentation at this revision

Comitter:
okini3939
Date:
Thu May 19 08:56:30 2016 +0000
Parent:
2:07dbb77a6f1a
Commit message:
added start();

Changed in this revision

FutabaSBUS.cpp Show annotated file Show diff for this revision Revisions of this file
FutabaSBUS.h Show annotated file Show diff for this revision Revisions of this file
--- a/FutabaSBUS.cpp	Mon Feb 08 08:47:36 2016 +0000
+++ b/FutabaSBUS.cpp	Thu May 19 08:56:30 2016 +0000
@@ -37,6 +37,11 @@
 
 
 FutabaSBUS::FutabaSBUS(PinName tx, PinName rx) : sbus_(tx, rx) {
+    rx_timeout=50;
+    tx_timeout=60;
+}
+
+void FutabaSBUS::start() {
     // Set Baudrate
     sbus_.baud(100000);
     // Set Datalenght & Frame
@@ -46,8 +51,6 @@
     sbus_.attach(this, &FutabaSBUS::SBUS_irq_rx, RawSerial::RxIrq);
     // init ticker 500us
     rxSBUS.attach_us(this, &FutabaSBUS::rx_ticker_500us,500);
-    rx_timeout=50;
-    tx_timeout=60;
 }
 
 int16_t FutabaSBUS::channel(uint8_t ch) {
@@ -88,7 +91,6 @@
 
 void FutabaSBUS::failsafe(uint8_t status) {
     failsafe_status = status;
-    sbus_.baud(100000);
 }
 
 void FutabaSBUS::passthrough(bool mode) {
--- a/FutabaSBUS.h	Mon Feb 08 08:47:36 2016 +0000
+++ b/FutabaSBUS.h	Thu May 19 08:56:30 2016 +0000
@@ -64,6 +64,8 @@
     * &param pin serial tx,rx to connect to
     */
     FutabaSBUS(PinName tx, PinName rx);
+
+    void start ();
     
     /** Read channel(1..16), digital raw data
     *