fork of StateScript

Dependencies:   mbed SOMO_II

Fork of stateScript_v2 by Mattias Karlsson

Revision:
7:5fe7329751d4
Parent:
4:abee20c0bf2a
Child:
10:f65649c13b5b
--- a/mbedInterface/mbedInterface.h	Fri Jun 10 21:22:34 2016 +0000
+++ b/mbedInterface/mbedInterface.h	Tue Feb 07 18:45:25 2017 +0000
@@ -15,9 +15,11 @@
 //#define MBED_RF
 
 
-#define NUMPORTS 10 //the number of ports available on this hardware
-#define NUMINPORTS 9
-#define NUMOUTPORTS 10
+//#define NUMPORTS 10 //the number of ports available on this hardware
+#define NUMDIGINPORTS 8
+#define NUMDIGOUTPORTS 8
+#define NUMANINPORTS 1
+#define NUMANOUTPORTS 1
 
 #define NUMEVENTS 50
 #define NUMCONDITIONS 150
@@ -52,7 +54,40 @@
 
 };*/
 
+class MBEDAnalogOut : public sAnalogOut
+{
+public:
+    MBEDAnalogOut();
 
+    void init(int pin);
+    void write(int value);
+    int read();
+
+private:
+    //define the hardware output pin
+    uint8_t pinNumber;
+    AnalogOut *outpin;
+    bool pinExists;
+
+};
+
+class MBEDAnalogIn : public sAnalogIn
+{
+public:
+    MBEDAnalogIn();
+
+    void init(int pin);
+    int read();
+
+protected:
+
+private:
+    uint8_t pinNumber;
+    AnalogIn *inpin;
+    bool pinExists;
+
+
+};
 
 class MBEDDigitalOut : public sDigitalOut
 {
@@ -126,6 +161,8 @@
     void setSlaveClock();
     sDigitalOut* getDigitalOutPtr(int portNum);
     sDigitalIn* getDigitalInPtr(int portNum);
+    sAnalogOut* getAnalogOutPtr(int portNum);
+    sAnalogIn* getAnalogInPtr(int portNum);
     sSound* createNewSoundAction();
     void pauseInterrupts();
     void resumeInterrupts();
@@ -140,8 +177,10 @@
     InterruptIn clockExternalIncrement;
 
 private:
-    MBEDDigitalIn dIn[NUMPORTS];
-    MBEDDigitalOut dOut[NUMPORTS];
+    MBEDDigitalIn dIn[NUMDIGINPORTS];
+    MBEDDigitalOut dOut[NUMDIGOUTPORTS];
+    MBEDAnalogIn aIn[NUMANINPORTS];
+    MBEDAnalogOut aOut[NUMANOUTPORTS];
 };
 
 #endif // MBEDINTERFACE_H