From a454560d8ff38ac162e7999ae1575d4bbd89a536 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Fri, 8 Jan 2021 22:53:28 -0800 Subject: [PATCH] Adding in pin handling. --- ueforth/Makefile | 2 +- ueforth/arduino/arduino.fs | 9 +++++++++ ueforth/arduino/arduino.template.ino | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ueforth/Makefile b/ueforth/Makefile index 4dfb461..3cfcae6 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -4,7 +4,7 @@ RES = $(OUT)/resources WEB = $(OUT)/web POSIX = $(OUT)/posix WINDOWS = $(OUT)/windows -ARDUINO = $(OUT)/arduino/ueforth +ARDUINO = $(OUT)/arduino DEPLOY = $(OUT)/deploy CFLAGS = -Wall -Werror \ diff --git a/ueforth/arduino/arduino.fs b/ueforth/arduino/arduino.fs index 63ac531..7141ac5 100644 --- a/ueforth/arduino/arduino.fs +++ b/ueforth/arduino/arduino.fs @@ -15,6 +15,13 @@ : freq ( n n -- ) 1000 * 13 ledcSetup drop ; : tone ( n n -- ) 1000 * ledcWriteTone drop ; +( Basic Ardiuno Constants ) +0 constant LOW +1 constant HIGH +1 constant INPUT +2 constant OUTPUT +2 constant LED + ( WiFi Modes ) 0 constant WIFI_MODE_NULL 1 constant WIFI_MODE_STA @@ -26,3 +33,5 @@ 115200 Serial.begin 100 ms -1 z" /spiffs" 10 SPIFFS.begin drop +led OUTPUT pinMode +high led pin diff --git a/ueforth/arduino/arduino.template.ino b/ueforth/arduino/arduino.template.ino index 763e012..06332ad 100644 --- a/ueforth/arduino/arduino.template.ino +++ b/ueforth/arduino/arduino.template.ino @@ -136,6 +136,10 @@ tos = (cell_t) ((WebServer *) tos)->method()) \ X("WebServer.handleClient", WEBSERVER_HANDLE_CLIENT, \ ((WebServer *) tos)->handleClient(); DROP) \ + X("OUTPUT", OUTPUT, DUP; tos = OUTPUT) \ + X("INPUT", INPUT, DUP; tos = INPUT) \ + X("LOW", LOW, DUP; tos = LOW) \ + X("HIGH", HIGH, DUP; tos = HIGH) \ // TODO: Why doesn't ftruncate exist? // X("RESIZE-FILE", RESIZE_FILE, cell_t fd = tos; DROP; \