From: Mart Lubbers Date: Mon, 19 Jun 2017 13:06:42 +0000 (+0200) Subject: add pins to spec X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=5fc9fc4e888f8a481fc66986a6389d4307ca9668;hp=8221c3559e4d4a1be6fac0f9f81af2cc1beed9e9;p=mTask.git add pins to spec --- diff --git a/client/interface.h b/client/interface.h index 738dd85..24e5c37 100644 --- a/client/interface.h +++ b/client/interface.h @@ -10,6 +10,8 @@ extern "C" { #include #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 diff --git a/client/spec.c b/client/spec.c index d389d38..a6a26d3 100644 --- a/client/spec.c +++ b/client/spec.c @@ -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'); } diff --git a/mTaskInterpret.dcl b/mTaskInterpret.dcl index fe68463..c4dadfb 100644 --- a/mTaskInterpret.dcl +++ b/mTaskInterpret.dcl @@ -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 } diff --git a/mTaskInterpret.icl b/mTaskInterpret.icl index f55c70d..7917c93 100644 --- a/mTaskInterpret.icl +++ b/mTaskInterpret.icl @@ -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