final1
SBUS.h
- Committer:
- sshogo
- Date:
- 2019-06-28
- Revision:
- 0:e2bc011508c7
- Child:
- 2:493d10424466
File content as of revision 0:e2bc011508c7:
#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