From 5fc9fc4e888f8a481fc66986a6389d4307ca9668 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 19 Jun 2017 15:06:42 +0200 Subject: [PATCH] add pins to spec --- client/interface.h | 8 ++++++++ client/spec.c | 2 ++ mTaskInterpret.dcl | 8 +++++--- mTaskInterpret.icl | 12 +++++++----- 4 files changed, 22 insertions(+), 8 deletions(-) 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 -- 2.20.1