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.
remoteControl.h
- Committer:
- cdevarakonda
- Date:
- 2022-06-15
- Revision:
- 29:2ed4d9c309fc
- Parent:
- 0:4788e1df7b55
File content as of revision 29:2ed4d9c309fc:
#ifndef REMOTECONTROL_H
#define REMOTECONTROL_H
#include <mbed.h>
class Remote{
public:
// CONSTRUCTOR
Remote(SPI& remoteControl, DigitalOut& remoteControlCS);
bool commsGood; // Successful Comms Between Nucleo and Remote Control
volatile int throttle;
volatile int braking;
volatile bool start;
volatile bool forward;
volatile bool park;
volatile bool reverse;
volatile bool compressor;
volatile bool autoStop;
volatile bool regenBrake;
volatile bool regenThrottle;
volatile bool whistle;
volatile bool innovation;
void initialiseRemoteComms();
int sendData(int precursor, int data);
void sendError(int error);
void commsCheck();
void getSwitchStates();
void setTime(int hr, int min, int sec, int day, int mon, int yr);
private:
SPI& _remoteControl;
DigitalOut& _remoteControlCS;
int spiDelay;
int commsFailures; // Number of consecutive remote comms failures
int errorIndex;
int errorBuffer[27];
void ByteToBits(unsigned char character, bool *boolArray);
Ticker commsCheckTicker; //ticker for recurring comms check
Ticker remoteSwitchStateTicker; //ticker for recurring remote switch state update
};
#endif