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.
Fork of stateScript_v2 by
mbedInterface.h
00001 #ifndef MBEDINTERFACE_H 00002 #define MBEDINTERFACE_H 00003 00004 #include "hardwareInterface.h" 00005 #include "mbed.h" 00006 #include <stdint.h> 00007 #include "SMARTWAV.h" 00008 #include <string.h> 00009 #include <string> 00010 #include <vector> 00011 #include <queue> 00012 #include <sstream> 00013 00014 00015 //#define MBED_RF 00016 00017 00018 #define NUMPORTS 9 //the number of ports available on this hardware 00019 00020 #define NUMEVENTS 50 00021 #define NUMCONDITIONS 150 00022 #define NUMINTCOMPARE 150 00023 #define NUMACTIONS 150 00024 #define NUMPORTMESSAGES 150 00025 #define NUMINTOPERATIONS 150 00026 #define NUMDISPLAYACTIONS 30 00027 #define NUMTRIGGERACTIONS 30 00028 #define NUMFUNCTIONS 50 00029 #define INPUTCHARBUFFERSIZE 3072 00030 00031 00032 00033 /* 00034 class MBEDTimer : public sTimer 00035 { 00036 public: 00037 sTimer(); 00038 virtual void init() = 0; 00039 virtual void timeout_callback() = 0; 00040 00041 }; 00042 00043 class MBEDExternalSync : public sExternalSync 00044 { 00045 public: 00046 MBEDExternalSync(); 00047 void init(); 00048 void interrupt_callback(); 00049 void reset_callback(); 00050 00051 };*/ 00052 00053 00054 00055 class MBEDDigitalOut : public sDigitalOut 00056 { 00057 public: 00058 MBEDDigitalOut(); 00059 00060 void init(int pin); 00061 void write(int value); 00062 int read(); 00063 00064 private: 00065 DigitalOut *outpin; 00066 00067 }; 00068 00069 class MBEDDigitalIn : public sDigitalIn 00070 { 00071 public: 00072 MBEDDigitalIn(); 00073 00074 void init(int pin); 00075 int read(); 00076 void interrupt_up_callback(); 00077 void interrupt_down_callback(); 00078 protected: 00079 00080 00081 00082 private: 00083 DigitalIn *inpin; 00084 InterruptIn *inpin_interrupt; 00085 00086 }; 00087 00088 class MBEDSerialPort : public sSerialPort 00089 { 00090 public: 00091 MBEDSerialPort(); 00092 00093 void init(); 00094 bool readable(); 00095 char readChar(); 00096 void writeChar(char s); 00097 int requestToWriteString(char *s, int numBytes); 00098 Serial *serialToPC; 00099 00100 private: 00101 //Serial communication 00102 00103 00104 }; 00105 00106 class MBEDSound: public sSound 00107 { 00108 public: 00109 MBEDSound(); 00110 void execute(); 00111 00112 private: 00113 00114 }; 00115 00116 class MBEDSystem: public sSystem 00117 { 00118 public: 00119 MBEDSystem(); 00120 void timerinit(); 00121 void setStandAloneClock(); 00122 void setSlaveClock(); 00123 sDigitalOut* getDigitalOutPtr(int portNum); 00124 sDigitalIn* getDigitalInPtr(int portNum); 00125 sSound* createNewSoundAction(); 00126 void pauseInterrupts(); 00127 void resumeInterrupts(); 00128 void incrementClock(); 00129 void externalClockReset(); //needs to reset harware timer before calling immediateClockReset(); 00130 void mainLoopToDo(); 00131 00132 protected: 00133 00134 //Pins for clock syncing 00135 InterruptIn clockResetInt; 00136 InterruptIn clockExternalIncrement; 00137 00138 private: 00139 MBEDDigitalIn dIn[NUMPORTS]; 00140 MBEDDigitalOut dOut[NUMPORTS]; 00141 }; 00142 00143 #endif // MBEDINTERFACE_H
Generated on Tue Jul 12 2022 17:07:31 by
1.7.2
