diff --git a/misc/blink.sc b/misc/blink.sc new file mode 100644 index 00000000..120b6271 --- /dev/null +++ b/misc/blink.sc @@ -0,0 +1,37 @@ +external void show(); +external void pinMode(uint8_t pin, uint8_t mode); +external void digitalWrite(uint8_t pin, uint8_t val); +external void delay(uint32_t ms); +//external void pinsM->allocatePin(unsigned8 pinNr, const char * owner, const char * details); //classes supported? + +//how to deal with external defines? +define OUTPUT 0x03 +define LOW 0x0 +define HIGH 0x1 + +uint8_t blinkPin; //tbd: assigment here + +void setup() +{ + blinkPin = 5; //tbd make blinkPin an ui control + + //pinsM->allocatePin(2, "Blink", "On board led"); //class methods and strings supported? + pinMode(blinkPin, OUTPUT); //tbd: part of allocatePin? +} + +void loop() { + digitalWrite(blinkPin, HIGH); // turn the LED on (HIGH is the voltage level) + delay(1000); // wait for a second + digitalWrite(blinkPin, LOW); // turn the LED off by making the voltage LOW + delay(1000); // wait for a second +} + +void main() +{ + setup(); + while (0==0) + { + loop(); + show(); + } +} \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index c50f8474..50cc15e1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -57,14 +57,14 @@ lib_deps = build_flags = -D STARBASE_USERMOD_LIVE lib_deps = - https://github.com/hpwit/ASMParser.git + https://github.com/hpwit/ASMParser.git#memory ; about 1% / 19KB flash [STARBASE] build_flags = -D APP=StarBase -D PIOENV=$PIOENV - -D VERSION=24062015 ; Date and time (GMT!), update at every commit!! + -D VERSION=24070509 ; Date and time (GMT!), update at every commit!! -D LFS_THREADSAFE ; enables use of semaphores in LittleFS driver -D STARBASE_DEVMODE ${ESPAsyncWebServer.build_flags} ;alternatively PsychicHttp diff --git a/src/User/UserModLive.h b/src/User/UserModLive.h index ac883da4..6a68fd6e 100644 --- a/src/User/UserModLive.h +++ b/src/User/UserModLive.h @@ -45,6 +45,7 @@ static void show() // RETURN_VALUE(VALUE_FROM_INT(0), rindex); } + class UserModLive:public SysModule { public: @@ -120,6 +121,10 @@ class UserModLive:public SysModule { addExternal("show", externalType::function, (void *)&show); addExternal("showM", externalType::function, (void *)&UserModLive::showM); // warning: converting from 'void (UserModLive::*)()' to 'void*' [-Wpmf-conversions] + addExternal("pinMode", externalType::function, (void *)&pinMode); + addExternal("digitalWrite", externalType::function, (void *)&digitalWrite); + addExternal("delay", externalType::function, (void *)&delay); + } //testing class functions instead of static