Isolate more stuff.
This commit is contained in:
@ -1,12 +1,14 @@
|
|||||||
( Set up Basic I/O )
|
( Set up Basic I/O )
|
||||||
|
internals definitions
|
||||||
: arduino-bye 0 terminate ;
|
: arduino-bye 0 terminate ;
|
||||||
' arduino-bye is bye
|
' arduino-bye is bye
|
||||||
: arduino-type ( a n -- ) Serial.write drop ;
|
: arduino-type ( a n -- ) Serial.write drop ;
|
||||||
' arduino-type is type
|
' arduino-type is type
|
||||||
: key? ( -- n ) Serial.available ;
|
|
||||||
: arduino-key ( -- n )
|
: arduino-key ( -- n )
|
||||||
begin Serial.available until 0 >r rp@ 1 Serial.readBytes drop r> ;
|
begin Serial.available until 0 >r rp@ 1 Serial.readBytes drop r> ;
|
||||||
' arduino-key is key
|
' arduino-key is key
|
||||||
|
forth definitions
|
||||||
|
: key? ( -- n ) Serial.available ;
|
||||||
|
|
||||||
( Map Arduino / ESP32 things to shorter names. )
|
( Map Arduino / ESP32 things to shorter names. )
|
||||||
: pin ( n pin# -- ) swap digitalWrite ;
|
: pin ( n pin# -- ) swap digitalWrite ;
|
||||||
|
|||||||
@ -158,11 +158,6 @@ create out-string out-size 1+ allot align
|
|||||||
again
|
again
|
||||||
;
|
;
|
||||||
|
|
||||||
tasks
|
|
||||||
: task task ;
|
|
||||||
: start-task start-task ;
|
|
||||||
web-interface
|
|
||||||
|
|
||||||
' do-serve 1000 1000 task webserver-task
|
' do-serve 1000 1000 task webserver-task
|
||||||
|
|
||||||
: serve
|
: serve
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
|
internals definitions
|
||||||
( Change default block source on arduino )
|
( Change default block source on arduino )
|
||||||
: arduino-default-use s" /spiffs/blocks.fb" open-blocks ;
|
: arduino-default-use s" /spiffs/blocks.fb" open-blocks ;
|
||||||
' arduino-default-use is default-use
|
' arduino-default-use is default-use
|
||||||
|
|
||||||
( Check for autoexec.fs and run if present )
|
( Check for autoexec.fs and run if present )
|
||||||
: autoexec ( a n -- ) s" /spiffs/autoexec.fs" ['] included catch 2drop drop ;
|
: autoexec ( a n -- ) s" /spiffs/autoexec.fs" ['] included catch 2drop drop ;
|
||||||
autoexec
|
' autoexec
|
||||||
|
forth definitions
|
||||||
|
execute
|
||||||
|
|||||||
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
vocabulary camera camera definitions
|
vocabulary camera camera definitions
|
||||||
|
|
||||||
|
?transfer esp_camera_init
|
||||||
|
?transfer esp_camera_deinit
|
||||||
|
?transfer esp_camera_fb_get
|
||||||
|
?transfer esp_camera_fb_return
|
||||||
|
?transfer esp_camera_sensor_get
|
||||||
|
|
||||||
0 constant PIXFORMAT_RGB565
|
0 constant PIXFORMAT_RGB565
|
||||||
1 constant PIXFORMAT_YUV422
|
1 constant PIXFORMAT_YUV422
|
||||||
2 constant PIXFORMAT_GRAYSCALE
|
2 constant PIXFORMAT_GRAYSCALE
|
||||||
|
|||||||
@ -68,6 +68,27 @@ transfer{
|
|||||||
}transfer
|
}transfer
|
||||||
forth definitions
|
forth definitions
|
||||||
|
|
||||||
|
vocabulary bluetooth bluetooth definitions
|
||||||
|
?transfer SerialBT.new
|
||||||
|
?transfer SerialBT.delete
|
||||||
|
?transfer SerialBT.begin
|
||||||
|
?transfer SerialBT.end
|
||||||
|
?transfer SerialBT.available
|
||||||
|
?transfer SerialBT.readBytes
|
||||||
|
?transfer SerialBT.write
|
||||||
|
?transfer SerialBT.flush
|
||||||
|
?transfer SerialBT.hasClient
|
||||||
|
?transfer SerialBT.enableSSP
|
||||||
|
?transfer SerialBT.setPin
|
||||||
|
?transfer SerialBT.unpairDevice
|
||||||
|
?transfer SerialBT.connect
|
||||||
|
?transfer SerialBT.connectAddr
|
||||||
|
?transfer SerialBT.disconnect
|
||||||
|
?transfer SerialBT.connected
|
||||||
|
?transfer SerialBT.isReady
|
||||||
|
?transfer esp_bt_dev_get_address
|
||||||
|
forth definitions
|
||||||
|
|
||||||
internals definitions
|
internals definitions
|
||||||
transfer{
|
transfer{
|
||||||
malloc sysfree realloc
|
malloc sysfree realloc
|
||||||
|
|||||||
@ -48,8 +48,8 @@ forth definitions internals
|
|||||||
internals definitions
|
internals definitions
|
||||||
: @line ( n -- ) 64 * scr @ block + ;
|
: @line ( n -- ) 64 * scr @ block + ;
|
||||||
: e' ( n -- ) @line clobber-line drop update ;
|
: e' ( n -- ) @line clobber-line drop update ;
|
||||||
: wipe 15 for r@ e' next l ; : e e' l ;
|
|
||||||
forth definitions internals
|
forth definitions internals
|
||||||
|
: wipe 15 for r@ e' next l ; : e e' l ;
|
||||||
: d ( n -- ) dup 1+ @line swap @line 15 @line over - cmove 15 e ;
|
: d ( n -- ) dup 1+ @line swap @line 15 @line over - cmove 15 e ;
|
||||||
: r ( n "line" -- ) 0 parse 64 min rot dup e @line swap cmove l ;
|
: r ( n "line" -- ) 0 parse 64 min rot dup e @line swap cmove l ;
|
||||||
: a ( n "line" -- ) dup @line over 1+ @line 16 @line over - cmove> r ;
|
: a ( n "line" -- ) dup @line over 1+ @line 16 @line over - cmove> r ;
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
: transfer-xt ( xt -- ) context @ begin 2dup @ <> while @ >link& repeat nip
|
: transfer-xt ( xt -- ) context @ begin 2dup @ <> while @ >link& repeat nip
|
||||||
dup @ swap dup @ >link swap ! current @ @ over >link& ! current @ ! ;
|
dup @ swap dup @ >link swap ! current @ @ over >link& ! current @ ! ;
|
||||||
: transfer ( "name" ) ' transfer-xt ;
|
: transfer ( "name" ) ' transfer-xt ;
|
||||||
|
: ?transfer ( "name" ) bl parse find dup if transfer-xt else drop then ;
|
||||||
: }transfer ;
|
: }transfer ;
|
||||||
: transfer{ begin ' dup ['] }transfer = if drop exit then transfer-xt again ;
|
: transfer{ begin ' dup ['] }transfer = if drop exit then transfer-xt again ;
|
||||||
|
|
||||||
|
|||||||
@ -156,6 +156,7 @@ See <a href="https://github.com/flagxor/eforth/blob/main/ueforth/arduino/arduino
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h5>Allocation</h5>
|
<h5>Allocation</h5>
|
||||||
|
These words are inside the <code>internals</code> vocabulary.
|
||||||
<pre>
|
<pre>
|
||||||
MALLOC ( n -- a | 0 ) System malloc
|
MALLOC ( n -- a | 0 ) System malloc
|
||||||
SYSFREE ( a -- ) System free
|
SYSFREE ( a -- ) System free
|
||||||
@ -163,6 +164,7 @@ REALLOC ( a n -- a | 0 ) System realloc
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h5>Serial</h5>
|
<h5>Serial</h5>
|
||||||
|
These words are inside the <code>Serial</code> vocabulary.
|
||||||
<pre>
|
<pre>
|
||||||
Serial.begin ( baud -- ) Start serial port
|
Serial.begin ( baud -- ) Start serial port
|
||||||
Serial.end ( -- ) End serial port
|
Serial.end ( -- ) End serial port
|
||||||
@ -173,6 +175,7 @@ Serial.flush ( -- ) Flush serial buffer
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h5>Serial Bluetooth</h5>
|
<h5>Serial Bluetooth</h5>
|
||||||
|
These words are inside the <code>bluetooth</code> vocabulary.
|
||||||
<pre>
|
<pre>
|
||||||
SerialBT.new ( -- bt ) Allocate new BT object
|
SerialBT.new ( -- bt ) Allocate new BT object
|
||||||
SerialBT.delete ( bt -- ) Free BT object
|
SerialBT.delete ( bt -- ) Free BT object
|
||||||
@ -194,6 +197,7 @@ SerialBT.isReady ( checkMaster timeout -- f ) Default checkMaster=false, timeo
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h5>Bluetooth</h5>
|
<h5>Bluetooth</h5>
|
||||||
|
These words are inside the <code>bluetooth</code> vocabulary.
|
||||||
<pre>
|
<pre>
|
||||||
esp_bt_dev_get_address ( -- a ) addr of 6 byte mac address
|
esp_bt_dev_get_address ( -- a ) addr of 6 byte mac address
|
||||||
</pre>
|
</pre>
|
||||||
@ -203,6 +207,11 @@ esp_bt_dev_get_address ( -- a ) addr of 6 byte mac address
|
|||||||
pinMode ( pin mode -- ) Set GPIO pin mode
|
pinMode ( pin mode -- ) Set GPIO pin mode
|
||||||
digitalWrite ( pin value -- ) Set GPIO pin state
|
digitalWrite ( pin value -- ) Set GPIO pin state
|
||||||
analogRead ( pin -- n ) Analog read from 0-4095
|
analogRead ( pin -- n ) Analog read from 0-4095
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<h5>ledc</h5>
|
||||||
|
These words are inside the <code>ledc</code> vocabulary.
|
||||||
|
<pre>
|
||||||
ledcSetup ( channel freq resolution -- freq )
|
ledcSetup ( channel freq resolution -- freq )
|
||||||
ledcAttachPin ( pin channel -- )
|
ledcAttachPin ( pin channel -- )
|
||||||
ledcDetachPin ( pin -- )
|
ledcDetachPin ( pin -- )
|
||||||
@ -243,6 +252,7 @@ FILE-SIZE ( fh -- n ior )
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h5>WiFi</h5>
|
<h5>WiFi</h5>
|
||||||
|
These words are inside the <code>WiFi</code> vocabulary.
|
||||||
<pre>
|
<pre>
|
||||||
WiFi.config ( ip dns gateway subnet -- ) Packaged a.b.c.d little-endian
|
WiFi.config ( ip dns gateway subnet -- ) Packaged a.b.c.d little-endian
|
||||||
Wifi.begin ( ssid-z password-z -- )
|
Wifi.begin ( ssid-z password-z -- )
|
||||||
@ -250,7 +260,7 @@ Wifi.disconnect ( -- )
|
|||||||
WiFi.status ( -- n )
|
WiFi.status ( -- n )
|
||||||
WiFi.macAddress ( a -- )
|
WiFi.macAddress ( a -- )
|
||||||
WiFi.localIP ( -- ip )
|
WiFi.localIP ( -- ip )
|
||||||
WiFi.mode ( mode -- )
|
WiFi.mode ( mode -- ) WIFI_MODE_NULL WIFI_MODE_STA WIFI_MODE_AP WIFI_MODE_APSTA
|
||||||
WiFi.setTxPower ( powerx4 -- ) Set power x4
|
WiFi.setTxPower ( powerx4 -- ) Set power x4
|
||||||
WiFi.getTxPower ( -- powerx4 ) Get power x4
|
WiFi.getTxPower ( -- powerx4 ) Get power x4
|
||||||
</pre>
|
</pre>
|
||||||
@ -261,6 +271,7 @@ MDNS.begin ( name-z -- ) Start multicast dns
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h5>SPIFFS</h5>
|
<h5>SPIFFS</h5>
|
||||||
|
These words are inside the <code>SPIFFS</code> vocabulary.
|
||||||
<pre>
|
<pre>
|
||||||
SPIFFS.begin ( format-on-fail path-z max-files -- f )
|
SPIFFS.begin ( format-on-fail path-z max-files -- f )
|
||||||
SPIFFS.end ( -- )
|
SPIFFS.end ( -- )
|
||||||
@ -315,6 +326,7 @@ Wire.flush ( -- )
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h5>Camera</h5>
|
<h5>Camera</h5>
|
||||||
|
These words are inside the <code>camera</code> vocabulary.
|
||||||
<pre>
|
<pre>
|
||||||
esp_camera_init ( config -- f )
|
esp_camera_init ( config -- f )
|
||||||
esp_camera_deinit ( -- f )
|
esp_camera_deinit ( -- f )
|
||||||
@ -324,6 +336,7 @@ esp_camera_sensor_get ( -- sensor )
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h5>SD_MMC</h5>
|
<h5>SD_MMC</h5>
|
||||||
|
These words are inside the <code>SD_MMC</code> vocabulary.
|
||||||
<pre>
|
<pre>
|
||||||
SD_MMC.begin ( mount mode1bit ) default mode1bit=false
|
SD_MMC.begin ( mount mode1bit ) default mode1bit=false
|
||||||
SD_MMC.end ( -- )
|
SD_MMC.end ( -- )
|
||||||
|
|||||||
Reference in New Issue
Block a user