add pins to spec
authorMart Lubbers <mart@martlubbers.net>
Mon, 19 Jun 2017 13:06:42 +0000 (15:06 +0200)
committerMart Lubbers <mart@martlubbers.net>
Mon, 19 Jun 2017 13:06:42 +0000 (15:06 +0200)
client/interface.h
client/spec.c
mTaskInterpret.dcl
mTaskInterpret.icl

index 738dd85..24e5c37 100644 (file)
@@ -10,6 +10,8 @@ extern "C" {
 #include <stdarg.h>
 
 #ifdef LINUX
+#define NAPINS 128
+#define NDPINS 128
 #define STACKSIZE 1024
 #define MEMSIZE 1024
 #define HAVELED 1
@@ -20,6 +22,8 @@ extern int gargc;
 extern char **gargv;
 
 #elif defined STM
+#define NAPINS 128
+#define NDPINS 128
 #define STACKSIZE 1024
 #define MEMSIZE 1024
 #define HAVELED 1
@@ -27,6 +31,8 @@ extern char **gargv;
 #define HAVEDIO 1
 
 #elif defined ARDUINO_ESP8266_NODEMCU
+#define NAPINS 128
+#define NDPINS 128
 #define STACKSIZE 1024
 #define MEMSIZE 1024
 #define HAVELED 0
@@ -34,6 +40,8 @@ extern char **gargv;
 #define HAVEDIO 0
 
 #elif defined ARDUINO_AVR_UNO
+#define NAPINS 128
+#define NDPINS 128
 #define STACKSIZE 64
 #define MEMSIZE 256
 #define HAVELED 0
index d389d38..a6a26d3 100644 (file)
@@ -7,6 +7,8 @@ void spec_send(void)
        write_byte('c');
        write_byte(0 | (HAVELED << 0) | (HAVEAIO << 1) | (HAVEDIO << 2));
        write16(MEMSIZE);
+       write_byte(NAPINS);
+       write_byte(NDPINS);
        write_byte('\n');
        write_byte('\n');
 }
index fe68463..c4dadfb 100644 (file)
@@ -34,9 +34,11 @@ from Generics.gCons import class gCons, generic conses, generic consName, generi
        | OnInterrupt Int
 
 :: MTaskDeviceSpec =
-               {haveLed :: Bool
-               ,haveAio :: Bool
-               ,haveDio :: Bool
+               {haveLed     :: Bool
+               ,haveAio     :: Bool
+               ,haveDio     :: Bool
+               ,aPins       :: Int
+               ,dPins       :: Int
                ,bytesMemory :: Int
        }
 
index f55c70d..7917c93 100644 (file)
@@ -160,11 +160,13 @@ instance fromByteCode MTaskInterval
                = OnInterrupt $ fromByteCode s bitand 127
 instance fromByteCode MTaskDeviceSpec where
        fromByteCode s = let c = toInt s.[0] in
-               {MTaskDeviceSpec
-               |haveLed=(c bitand 1) > 0
-               ,haveAio=(c bitand 2) > 0
-               ,haveDio=(c bitand 4) > 0
-               ,bytesMemory=from16bit $ s % (1,3)
+               { MTaskDeviceSpec
+               | haveLed     = (c bitand 1) > 0
+               , haveAio     = (c bitand 2) > 0
+               , haveDio     = (c bitand 4) > 0
+               , aPins       = toInt s.[3]
+               , dPins       = toInt s.[4]
+               , bytesMemory = from16bit $ s % (1,3)
                }
 
 derive gPrint Long, UserLED, Button, AnalogPin, DigitalPin, PinMode, Pin, BC, MTaskDeviceSpec