From 9b185b6f0d9d08bd5e3305ee9ebc50e1ff3737a9 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 22 Jun 2017 11:28:38 +0200 Subject: [PATCH] update spec to support normal io pins --- client/client.c | 1 + client/interface.h | 28 ++++++++++------------------ client/spec.c | 6 +++--- install_clean.sh | 2 +- miTask.icl | 3 ++- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/client/client.c b/client/client.c index 28c1609..da74940 100644 --- a/client/client.c +++ b/client/client.c @@ -67,6 +67,7 @@ void read_message(void) debug("Shutdown received"); mem_reset(); reset(); + break; case '\0': debug("Server closed connection"); break; diff --git a/client/interface.h b/client/interface.h index 24e5c37..e6b14db 100644 --- a/client/interface.h +++ b/client/interface.h @@ -10,43 +10,35 @@ extern "C" { #include #ifdef LINUX -#define NAPINS 128 -#define NDPINS 128 +#define APINS 128 +#define DPINS 128 #define STACKSIZE 1024 #define MEMSIZE 1024 #define HAVELED 1 -#define HAVEAIO 1 -#define HAVEDIO 1 extern int gargc; extern char **gargv; #elif defined STM -#define NAPINS 128 -#define NDPINS 128 +#define APINS 128 +#define DPINS 128 #define STACKSIZE 1024 #define MEMSIZE 1024 #define HAVELED 1 -#define HAVEAIO 1 -#define HAVEDIO 1 #elif defined ARDUINO_ESP8266_NODEMCU -#define NAPINS 128 -#define NDPINS 128 +#define APINS 128 +#define DPINS 128 #define STACKSIZE 1024 #define MEMSIZE 1024 #define HAVELED 0 -#define HAVEAIO 0 -#define HAVEDIO 0 #elif defined ARDUINO_AVR_UNO -#define NAPINS 128 -#define NDPINS 128 +#define APINS 128 +#define DPINS 128 #define STACKSIZE 64 #define MEMSIZE 256 #define HAVELED 0 -#define HAVEAIO 0 -#define HAVEDIO 0 #else //Add you device here #endif @@ -61,11 +53,11 @@ uint8_t read_byte(void); void write_byte(uint8_t b); /* Analog and digital pins */ -#if HAVEDIO == 1 +#if DPINS > 0 void write_dpin(uint8_t i, bool b); bool read_dpin(uint8_t i); #endif -#if HAVEAIO == 1 +#if APINS > 0 void write_apin(uint8_t i, uint8_t a); uint8_t read_apin(uint8_t i); #endif diff --git a/client/spec.c b/client/spec.c index 38c58ef..52ed512 100644 --- a/client/spec.c +++ b/client/spec.c @@ -5,11 +5,11 @@ void spec_send(void) { write_byte('c'); - write_byte(0 | (HAVELED << 0) | (HAVEAIO << 1) | (HAVEDIO << 2)); + write_byte(0 | (HAVELED << 0) );//| (HAVEAIO << 1) | (HAVEDIO << 2)); write16(MEMSIZE); write16(STACKSIZE); - write_byte(NAPINS); - write_byte(NDPINS); + write_byte(APINS); + write_byte(DPINS); write_byte('\n'); write_byte('\n'); } diff --git a/install_clean.sh b/install_clean.sh index f7fe903..bcedd34 100755 --- a/install_clean.sh +++ b/install_clean.sh @@ -16,6 +16,6 @@ mkdir -p "$TARGET" echo "Downloading and installing clean nightly" >&2 curl -sSL ftp://ftp.cs.ru.nl/pub/Clean/builds/linux-x64/clean-bundle-complete-linux-x64-latest.tgz \ - | tar --gunzip --strip-components=1 --extract --directory="$TARGET" + | tar --verbose --gunzip --strip-components=1 --extract --directory="$TARGET" echo "export CLEAN_HOME=$TARGET; export PATH=$TARGET/bin:\$PATH;" diff --git a/miTask.icl b/miTask.icl index 8c17f09..85196eb 100644 --- a/miTask.icl +++ b/miTask.icl @@ -31,7 +31,8 @@ Start world = startEngine [ ] world demo :: Task () -demo = viewSharedInformation "Devices" [] deviceStoreNP +demo = set 5 (sharedDynamicStore "Hoi" 5) + >>| viewSharedInformation "Devices" [] deviceStoreNP >>* [OnValue $ ifValue pred (cont o hd)] where pred [] = False -- 2.20.1