Compare commits
6 Commits
main
...
c825146c28
| Author | SHA1 | Date | |
|---|---|---|---|
| c825146c28 | |||
| 6ddf643787 | |||
| 399234677d | |||
| d1bcb86c68 | |||
| a88bbfda12 | |||
| e7c041eeb2 |
@ -680,6 +680,9 @@ e: check-esp32-builtins
|
||||
check-files-dir-reverse
|
||||
out: dacWrite
|
||||
out: MDNS.begin
|
||||
out: MDNS.addService
|
||||
out: MDNS.setInstanceName
|
||||
out: MDNS.addServiceTxt
|
||||
;e
|
||||
|
||||
e: check-esp32-bindings
|
||||
|
||||
@ -175,10 +175,12 @@ static cell_t ResizeFile(cell_t fd, cell_t size);
|
||||
|
||||
#define REQUIRED_SERIAL_SUPPORT \
|
||||
XV(serial, "Serial.begin", SERIAL_BEGIN, Serial.begin(tos); DROP) \
|
||||
XV(serial, "Serial.begin3", SERIAL_BEGIN3, Serial.begin(n2, SERIAL_8N1, n1, n0); DROPn(3)) \
|
||||
XV(serial, "Serial.end", SERIAL_END, Serial.end()) \
|
||||
XV(serial, "Serial.available", SERIAL_AVAILABLE, PUSH Serial.available()) \
|
||||
XV(serial, "Serial.readBytes", SERIAL_READ_BYTES, n0 = Serial.readBytes(b1, n0); NIP) \
|
||||
XV(serial, "Serial.write", SERIAL_WRITE, n0 = Serial.write(b1, n0); NIP) \
|
||||
XV(serial, "Serial.writeChar", SERIAL_WRITECHAR, n0 = Serial.write(n0)) \
|
||||
XV(serial, "Serial.flush", SERIAL_FLUSH, Serial.flush()) \
|
||||
XV(serial, "Serial.setDebugOutput", SERIAL_DEBUG_OUTPUT, Serial.setDebugOutput(n0); DROP)
|
||||
|
||||
@ -187,10 +189,12 @@ static cell_t ResizeFile(cell_t fd, cell_t size);
|
||||
#else
|
||||
# define OPTIONAL_SERIAL2_SUPPORT \
|
||||
XV(serial, "Serial2.begin", SERIAL2_BEGIN, Serial2.begin(tos); DROP) \
|
||||
XV(serial, "Serial2.begin3", SERIAL2_BEGIN3, Serial2.begin(n2, SERIAL_8N1, n1, n0); DROPn(3)) \
|
||||
XV(serial, "Serial2.end", SERIAL2_END, Serial2.end()) \
|
||||
XV(serial, "Serial2.available", SERIAL2_AVAILABLE, PUSH Serial2.available()) \
|
||||
XV(serial, "Serial2.readBytes", SERIAL2_READ_BYTES, n0 = Serial2.readBytes(b1, n0); NIP) \
|
||||
XV(serial, "Serial2.write", SERIAL2_WRITE, n0 = Serial2.write(b1, n0); NIP) \
|
||||
XV(serial, "Serial2.writeChar", SERIAL2_WRITECHAR, n0 = Serial2.write(n0)) \
|
||||
XV(serial, "Serial2.flush", SERIAL2_FLUSH, Serial2.flush()) \
|
||||
XV(serial, "Serial2.setDebugOutput", SERIAL2_DEBUG_OUTPUT, Serial2.setDebugOutput(n0); DROP)
|
||||
#endif
|
||||
@ -294,7 +298,8 @@ static cell_t ResizeFile(cell_t fd, cell_t size);
|
||||
XV(SPIFFS, "SPIFFS.end", SPIFFS_END, SPIFFS.end()) \
|
||||
XV(SPIFFS, "SPIFFS.format", SPIFFS_FORMAT, PUSH SPIFFS.format()) \
|
||||
XV(SPIFFS, "SPIFFS.totalBytes", SPIFFS_TOTAL_BYTES, PUSH SPIFFS.totalBytes()) \
|
||||
XV(SPIFFS, "SPIFFS.usedBytes", SPIFFS_USED_BYTES, PUSH SPIFFS.usedBytes())
|
||||
XV(SPIFFS, "SPIFFS.usedBytes", SPIFFS_USED_BYTES, PUSH SPIFFS.usedBytes()) \
|
||||
XV(SPIFFS, "SPIFFS.exists", SPIFFS_EXISTS, n0 = SPIFFS.exists(c0) ? -1 : 0)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_FREERTOS_SUPPORT
|
||||
@ -451,5 +456,9 @@ static cell_t FromIP(IPAddress ip) {
|
||||
# endif
|
||||
# define OPTIONAL_MDNS_SUPPORT \
|
||||
/* mDNS */ \
|
||||
X("MDNS.begin", MDNS_BEGIN, n0 = MDNS.begin(c0))
|
||||
X("MDNS.begin", MDNS_BEGIN, n0 = MDNS.begin(c0) ? -1 : 0) \
|
||||
X("MDNS.addService", MDNS_ADD_SERVICE, n0 = MDNS.addService(c2, c1, n0) ? -1 : 0; NIPn(2)) \
|
||||
X("MDNS.setInstanceName", MDNS_SET_INSTANCE_NAME, MDNS.setInstanceName(c0); DROP) \
|
||||
X("MDNS.addServiceTxt", MDNS_ADD_SERVICE_TXT, MDNS.addServiceTxt(c3, c2, c1, c0); DROPn(4))
|
||||
/* alx */
|
||||
#endif
|
||||
|
||||
@ -40,12 +40,28 @@ also ledc also serial also SPIFFS
|
||||
( Map Arduino / ESP32 things to shorter names. )
|
||||
: pin ( n pin# -- ) swap digitalWrite ;
|
||||
: adc ( n -- n ) analogRead ;
|
||||
\ : duty ( n n -- ) 255 min 8191 255 */ ledcWrite ;
|
||||
\ : freq ( n n -- ) 1000 * 13 ledcAttach drop ;
|
||||
\ : tone ( n n -- ) 1000 * ledcWriteTone drop ;
|
||||
|
||||
( Basic Ardiuno Constants )
|
||||
0 constant LOW
|
||||
1 constant HIGH
|
||||
|
||||
1 constant INPUT
|
||||
2 constant OUTPUT
|
||||
\ // Changed OUTPUT from 0x02 to behave the same as Arduino pinMode(pin,OUTPUT)
|
||||
\ // where you can read the state of pin even when it is set as OUTPUT
|
||||
\ 3 constant OUTPUT
|
||||
\ 4 constant PULLUP
|
||||
\ 5 constant INPUT_PULLUP
|
||||
\ 8 constant PULLDOWN
|
||||
\ 9 constant INPUT_PULLDOWN
|
||||
\ 16 constant OPEN_DRAIN
|
||||
\ 18 constant OUTPUT_OPEN_DRAIN
|
||||
\ 192 constant ANALOG
|
||||
|
||||
|
||||
2 constant LED
|
||||
|
||||
( Startup Setup )
|
||||
|
||||
@ -352,10 +352,12 @@ REALLOC ( a n -- a | 0 ) System realloc
|
||||
These words are inside the <code>Serial</code> vocabulary.
|
||||
<pre>
|
||||
Serial.begin ( baud -- ) Start serial port
|
||||
Serial.begin3 ( baud rxPin txPin -- ) Start serial port
|
||||
Serial.end ( -- ) End serial port
|
||||
Serial.available ( -- f ) Is serial data available
|
||||
Serial.readBytes ( a n -- n ) Read serial bytes, return number gotten
|
||||
Serial.write ( a n -- n ) Write serial bytes
|
||||
Serial.writeChar ( c -- n ) Write serial character
|
||||
Serial.flush ( -- ) Flush serial buffer
|
||||
</pre>
|
||||
|
||||
@ -486,7 +488,10 @@ WiFi.softAPgetStationNum ( -- num )
|
||||
|
||||
<h5>mDNS</h5>
|
||||
<pre>
|
||||
MDNS.begin ( name-z -- ) Start multicast dns
|
||||
MDNS.begin ( hostname-z -- f ) Start multicast dns
|
||||
MDNS.setInstanceName ( name-z -- ) Set the instance (friendly) name
|
||||
MDNS.addService ( service-z protocol-z port-n -- f ) Advertise a service (such as "http") using a protocol ("tcp" or "udp") and a port number.
|
||||
MDNS.addServiceTxt ( service-z protocol-z key-z value-z -- ) Add a service key/value pair
|
||||
</pre>
|
||||
|
||||
<h5>SPIFFS</h5>
|
||||
@ -497,6 +502,7 @@ SPIFFS.end ( -- )
|
||||
SPIFFS.format ( -- f )
|
||||
SPIFFS.totalBytes ( -- n )
|
||||
SPIFFS.usedBytes ( -- n )
|
||||
SPIFFS.exists ( z -- f ) Test if file exists for path (omitting "/spiffs") like z" /blocks.fb"
|
||||
</pre>
|
||||
|
||||
<h5>WebServer (DEPRECATED)</h5>
|
||||
@ -1228,4 +1234,3 @@ New variables can be declared in each word and are scoped to that word.
|
||||
Y(MY_WORD, cell_t foo = n0; DROP; char *x = c0; DROP; \
|
||||
PUSH my_func(foo, x)) \
|
||||
</pre>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user