![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fork of StateScript
Fork of stateScript_v2 by
Diff: mbedInterface/mbedInterface.h
- Revision:
- 0:8dbd6bd9167f
- Child:
- 1:3a050d26d4f6
- Child:
- 3:d7b0a0890d96
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbedInterface/mbedInterface.h Tue May 19 15:45:42 2015 +0000 @@ -0,0 +1,129 @@ +#ifndef MBEDINTERFACE_H +#define MBEDINTERFACE_H + +#include "hardwareInterface.h" +#include "mbed.h" +#include <stdint.h> +#include "SMARTWAV.h" +#include <string.h> +#include <string> +#include <vector> +#include <queue> +#include <sstream> + + +//#define MBED_RF + + +#define NUMPORTS 9 //the number of ports available on this hardware + + + +/* +class MBEDTimer : public sTimer +{ +public: + sTimer(); + virtual void init() = 0; + virtual void timeout_callback() = 0; + +}; + +class MBEDExternalSync : public sExternalSync +{ +public: + MBEDExternalSync(); + void init(); + void interrupt_callback(); + void reset_callback(); + +};*/ + + + +class MBEDDigitalOut : public sDigitalOut +{ +public: + MBEDDigitalOut(); + + void init(int pin); + void write(int value); + int read(); + +private: + DigitalOut *outpin; + +}; + +class MBEDDigitalIn : public sDigitalIn +{ +public: + MBEDDigitalIn(); + + void init(int pin); + int read(); + void interrupt_up_callback(); + void interrupt_down_callback(); +protected: + + + +private: + DigitalIn *inpin; + InterruptIn *inpin_interrupt; + +}; + +class MBEDSerialPort : public sSerialPort +{ +public: + MBEDSerialPort(); + + void init(); + bool readable(); + char readChar(); + void writeChar(char s); + Serial *serialToPC; + +private: + //Serial communication + + +}; + +class MBEDSound: public sSound +{ +public: + MBEDSound(); + void execute(); + +private: + +}; + +class MBEDSystem: public sSystem +{ +public: + MBEDSystem(); + void timerinit(); + void setStandAloneClock(); + void setSlaveClock(); + sDigitalOut* getDigitalOutPtr(int portNum); + sDigitalIn* getDigitalInPtr(int portNum); + sSound* createNewSoundAction(); + void incrementClock(); + void externalClockReset(); //needs to reset harware timer before calling immediateClockReset(); + void mainLoopToDo(); + +protected: + + //Pins for clock syncing + InterruptIn clockResetInt; + InterruptIn clockExternalIncrement; + +private: + MBEDDigitalIn dIn[NUMPORTS]; + MBEDDigitalOut dOut[NUMPORTS]; +}; + +#endif // MBEDINTERFACE_H