diff --git a/ueforth/arduino/arduino.template.ino b/ueforth/arduino/arduino.template.ino index aec63bb..dc100cc 100644 --- a/ueforth/arduino/arduino.template.ino +++ b/ueforth/arduino/arduino.template.ino @@ -8,6 +8,7 @@ #include #include "SPIFFS.h" #include "SD_MMC.h" +#include "BluetoothSerial.h" #include #include @@ -40,6 +41,30 @@ X("Serial.available", SERIAL_AVAILABLE, DUP; tos = Serial.available()) \ X("Serial.readBytes", SERIAL_READ_BYTES, tos = Serial.readBytes((uint8_t *) *sp, tos); --sp) \ X("Serial.write", SERIAL_WRITE, tos = Serial.write((const uint8_t *) *sp, tos); --sp) \ + X("Serial.flush", SERIAL_FLUSH, Serial.flush()) \ + /* SerialBT */ \ + X("SerialBT.new", SERIALBT_NEW, DUP; tos = (cell_t) new BluetoothSerial()) \ + X("SerialBT.delete", SERIALBT_DELETE, delete (BluetoothSerial *) tos; DROP) \ + X("SerialBT.begin", SERIALBT_BEGIN, \ + tos = ((BluetoothSerial *) tos)->begin((const char *) sp[-1], *sp); sp -= 2) \ + X("SerialBT.end", SERIALBT_END, ((BluetoothSerial *) tos)->end(); DROP) \ + X("SerialBT.available", SERIALBT_AVAILABLE, tos = ((BluetoothSerial *) tos)->available()) \ + X("SerialBT.readBytes", SERIALBT_READ_BYTES, \ + tos = ((BluetoothSerial *) tos)->readBytes((uint8_t *) sp[-1], *sp); sp -= 2) \ + X("SerialBT.write", SERIALBT_WRITE, \ + tos = ((BluetoothSerial *) tos)->write((const uint8_t *) sp[-1], *sp); sp -= 2) \ + X("SerialBT.flush", SERIALBT_FLUSH, ((BluetoothSerial *) tos)->flush(); DROP) \ + X("SerialBT.hasClient", SERIALBT_HAS_CLIENT, tos = ((BluetoothSerial *) tos)->hasClient()) \ + X("SerialBT.enableSSP", SERIALBT_ENABLE_SSP, ((BluetoothSerial *) tos)->enableSSP(); DROP) \ + X("SerialBT.setPin", SERIALBT_SET_PIN, tos = ((BluetoothSerial *) tos)->setPin((const char *) *sp); --sp) \ + X("SerialBT.unpairDevice", SERIALBT_UNPAIR_DEVICE, \ + tos = ((BluetoothSerial *) tos)->unpairDevice((uint8_t *) *sp); --sp) \ + X("SerialBT.connect", SERIALBT_CONNECT, tos = ((BluetoothSerial *) tos)->connect((const char *) *sp); --sp) \ + X("SerialBT.connectAddr", SERIALBT_CONNECT_ADDR, \ + tos = ((BluetoothSerial *) tos)->connect((uint8_t *) *sp); --sp) \ + X("SerialBT.disconnect", SERIALBT_DISCONNECT, tos = ((BluetoothSerial *) tos)->disconnect()) \ + X("SerialBT.connected", SERIALBT_CONNECTED, tos = ((BluetoothSerial *) tos)->connected(*sp); --sp) \ + X("SerialBT.isReady", SERIALBT_IS_READY, tos = ((BluetoothSerial *) tos)->isReady(sp[-1], *sp); sp -= 2) \ /* Pins and PWM */ \ X("pinMode", PIN_MODE, pinMode(*sp, tos); --sp; DROP) \ X("digitalWrite", DIGITAL_WRITE, digitalWrite(*sp, tos); --sp; DROP) \ @@ -173,6 +198,7 @@ esp_camera_fb_return((camera_fb_t *) tos); DROP) \ X("esp_camera_sensor_get", ESP_CAMERA_SENSOR_GET, \ DUP; tos = (cell_t) esp_camera_sensor_get()) \ + /* SD_MMC */ \ X("SD_MMC.begin", SD_MMC_BEGIN, \ tos = SD_MMC.begin((const char *) *sp, tos); --sp) \ X("SD_MMC.end", SD_MMC_END, SD_MMC.end()) \ diff --git a/ueforth/site/index.html b/ueforth/site/index.html index c00c032..867f78f 100644 --- a/ueforth/site/index.html +++ b/ueforth/site/index.html @@ -170,6 +170,28 @@ 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 -- ) Write serial bytes +Serial.flush ( -- ) Flush serial buffer + + +
Serial Bluetooth
+
+SerialBT.new ( -- bt )   Allocate new BT object
+SerialBT.delete ( bt -- )   Free BT object
+SerialBT.begin ( localname ismaster bt -- f )
+SerialBT.end ( bt -- )
+SerialBT.available ( bt -- f )
+SerialBT.readBytes ( a n bt -- n )
+SerialBT.write ( a n bt -- )
+SerialBT.flush ( bt -- )
+SerialBT.hasClient ( bt -- f )
+SerialBT.enableSSP ( bt -- )
+SerialBT.setPin ( z bt -- f )
+SerialBT.unpairDevice ( addr bt -- f )
+SerialBT.connect ( remotename bt -- f )
+SerialBT.connectAddr ( addr bt -- f )
+SerialBT.disconnect ( bt -- f )
+SerialBT.connected ( timeout bt -- f )
+SerialBT.isReady ( checkMaster timeout -- f )   Default checkMaster=false, timeout=0
 
GPIO
@@ -280,6 +302,24 @@ Wire.busy ( -- f ) Wire.flush ( -- ) +
Camera
+
+esp_camera_init ( config -- f )
+esp_camera_deinit ( -- f )
+esp_camera_fb_get ( -- fb )
+esp_camera_fb_return ( fb -- )
+esp_camera_sensor_get ( -- sensor )
+
+ +
SD_MMC
+
+SD_MMC.begin ( mount mode1bit )   default mode1bit=false
+SD_MMC.end ( -- )
+SD_MMC.cardType ( -- n )
+SD_MMC.totalBytes ( -- n )
+SD_MMC.usedBytes ( -- n )
+
+

Arduino ESP32 WebUI