Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: SBUS.h
- Revision:
- 0:e2bc011508c7
- Child:
- 2:493d10424466
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SBUS.h Fri Jun 28 07:34:58 2019 +0000
@@ -0,0 +1,58 @@
+#ifndef INCLUDED_SBUS_H
+#define INCLUDED_SBUS_H
+
+#include "mbed.h"
+
+class SBUS {
+ public:
+ SBUS(PinName tx, PinName rx);
+
+ enum channelTag { right_RL, left_UD, right_UD, left_RL, sw1, sw2, sw3, sw4, sw5, sw6 };
+
+ enum stickName {
+ analog_rx,
+ analog_ry,
+ analog_lx,
+ analog_ly
+ };
+
+ enum switchPosition {
+ High,
+ Neutral,
+ Low
+ };
+
+ enum switchFPosition {
+ FHigh,
+ FLow
+ };
+
+ float getStickValue(int tag);
+
+ int getSwitchValue(int tag);
+
+ int getChannelValue(int tag);
+
+ private:
+ Serial com;
+
+ int stickMaximumValue;
+ int stickNeutralValue;
+ int stickMinimumValue;
+ int stickResolution;
+
+ int channel[16];
+ int receivedData[50];
+ float stickValue[4];
+ int switchFPositionValue[2];
+ int switchPositionValue[3];
+ int switchValue[12];
+
+ void receiveData();
+
+ void decordReceivedData();
+
+ void convertReceivedData();
+};
+
+#endif