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.
SBUS.h
00001 #ifndef INCLUDED_SBUS_H 00002 #define INCLUDED_SBUS_H 00003 00004 #include "mbed.h" 00005 00006 class SBUS { 00007 public: 00008 // @parm tx communication tx pin 00009 // rx communocation rx pin 00010 SBUS(PinName tx, PinName rx); 00011 00012 // channel array elements tag 00013 enum channelTag { right_RL, left_UD, right_UD, left_RL, sw1, sw2, sw3, sw4, sw5, sw6 }; 00014 00015 // stick value array elements tag 00016 enum stickName { 00017 analog_rx, 00018 analog_ry, 00019 analog_lx, 00020 analog_ly 00021 }; 00022 00023 // switch position tag 00024 enum switchPosition { 00025 Low, 00026 Neutral, 00027 High 00028 }; 00029 00030 // switchF position tag 00031 enum switchFPosition { 00032 FHigh, 00033 FLow 00034 }; 00035 00036 // function of getting stick value 00037 // @parm tag stickName 00038 float getStickValue(int tag); 00039 00040 // function of getting switch value 00041 // @parm tag 0-12 00042 int getSwitchValue(int tag); 00043 00044 // function of getting channel value 00045 // @parm tag 0-25 00046 int getChannelValue(int tag); 00047 00048 // function of getting connecting status 00049 bool getConnectStatus(); 00050 00051 private: 00052 Serial com; 00053 00054 int stickMaximumValue; 00055 int stickNeutralValue; 00056 int stickMinimumValue; 00057 int stickResolution; 00058 bool connstatus; 00059 00060 int channel[16]; 00061 int receivedData[50]; 00062 float stickValue[4]; 00063 int switchFPositionValue[2]; 00064 int switchPositionValue[3]; 00065 int switchValue[12]; 00066 00067 void receiveData(); 00068 00069 void decordReceivedData(); 00070 00071 void convertReceivedData(); 00072 00073 void resetall(); 00074 }; 00075 00076 #endif
Generated on Tue Jul 12 2022 12:09:48 by
