From 479dfb177db907fce4b1d05f6d8a52b25eae08be Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Sun, 6 Feb 2022 16:25:49 -0800 Subject: [PATCH] Made vocabulary forks separate and movable. --- ueforth/common/core.h | 26 +- ueforth/common/fini.fs | 5 +- ueforth/common/forth_namespace_tests.fs | 6 +- ueforth/common/interp.h | 6 +- ueforth/common/opcodes.h | 17 +- ueforth/esp32/bindings.fs | 162 ++------- ueforth/esp32/bterm.fs | 1 - ueforth/esp32/builtins.h | 444 ++++++++++++------------ ueforth/esp32/camera.fs | 17 +- ueforth/esp32/camera_server.fs | 4 - ueforth/esp32/options.h | 10 +- ueforth/esp32/print-builtins.cpp | 4 +- ueforth/esp32/timers.fs | 7 +- ueforth/posix/httpd.fs | 1 - ueforth/posix/main.c | 2 + ueforth/posix/telnetd.fs | 1 - ueforth/windows/interp.h | 4 +- ueforth/windows/main.c | 2 + 18 files changed, 302 insertions(+), 417 deletions(-) diff --git a/ueforth/common/core.h b/ueforth/common/core.h index 9212452..4c30d86 100644 --- a/ueforth/common/core.h +++ b/ueforth/common/core.h @@ -31,6 +31,18 @@ #include #endif +enum { +#define V(name) VOC_ ## name, + VOCABULARY_LIST +#undef V +}; + +enum { +#define V(name) VOC_ ## name ## _immediate = VOC_ ## name + (IMMEDIATE << 8), + VOCABULARY_LIST +#undef V +}; + static struct { cell_t *heap, **current, ***context; cell_t *latestxt, notfound; @@ -116,13 +128,16 @@ static cell_t find(const char *name, cell_t len) { cell_t xt = (cell_t) **voc; while (xt) { if ((*TOFLAGS(xt) & BUILTIN_FORK)) { + cell_t vocab = TOLINK(xt)[3]; for (int i = 0; g_sys.builtins[i].name; ++i) { - if (len == g_sys.builtins[i].name_length && + if (g_sys.builtins[i].vocabulary == vocab && + len == g_sys.builtins[i].name_length && same(name, g_sys.builtins[i].name, len)) { return (cell_t) &g_sys.builtins[i].code; } } - } else if (!(*TOFLAGS(xt) & SMUDGE) && len == *TONAMELEN(xt) && + } + if (!(*TOFLAGS(xt) & SMUDGE) && len == *TONAMELEN(xt) && same(name, TONAME(xt), len)) { return xt; } @@ -243,7 +258,12 @@ static void forth_init(int argc, char *argv[], void *heap, for (int i = 0; i < VOCABULARY_DEPTH; ++i) { *g_sys.heap++ = 0; } forth_run(0); - create("end", 3, BUILTIN_FORK, 0); +#define V(name) \ + create(#name "-builtins", sizeof(#name "-builtins") - 1, \ + BUILTIN_FORK, 0); \ + *g_sys.heap++ = VOC_ ## name; + VOCABULARY_LIST +#undef V g_sys.latestxt = 0; // So last builtin doesn't get wrong size. g_sys.DOLIT_XT = FIND("DOLIT"); g_sys.DOFLIT_XT = FIND("DOFLIT"); diff --git a/ueforth/common/fini.fs b/ueforth/common/fini.fs index 9f29386..e0852a3 100644 --- a/ueforth/common/fini.fs +++ b/ueforth/common/fini.fs @@ -12,7 +12,10 @@ \ See the License for the specific language governing permissions and \ limitations under the License. -internals +internals definitions +( TODO: Figure out why this has to happen so late. ) +transfer internals-builtins +forth definitions internals ( Bring a forth to the top of the vocabulary. ) transfer forth ( Move heap to save point, with a gap. ) diff --git a/ueforth/common/forth_namespace_tests.fs b/ueforth/common/forth_namespace_tests.fs index 5b9143b..680d1c7 100644 --- a/ueforth/common/forth_namespace_tests.fs +++ b/ueforth/common/forth_namespace_tests.fs @@ -448,7 +448,7 @@ e: test-windows-forth-namespace check-phase1 \ out: LOADLIBRARYA \ out: GETPROCADDRESS - out: end + out: forth-builtins ;e [ELSE] DEFINED? posix [IF] @@ -489,7 +489,7 @@ e: test-posix-forth-namespace out: posix check-phase1 \ out: DLSYM - out: end + out: forth-builtins ;e [ELSE] @@ -584,7 +584,7 @@ e: test-esp32-forth-namespace check-allocation check-phase1 \ check-esp32-basics2 - out: end + out: forth-builtins ;e [THEN] [THEN] diff --git a/ueforth/common/interp.h b/ueforth/common/interp.h index ba83c76..cdd1b4a 100644 --- a/ueforth/common/interp.h +++ b/ueforth/common/interp.h @@ -17,12 +17,12 @@ #define ADDR_DOCOLON && OP_DOCOLON #define ADDR_DOCREATE && OP_DOCREATE #define ADDR_DODOES && OP_DODOES - + static cell_t *forth_run(cell_t *init_rp) { static const BUILTIN_WORD builtins[] = { #define XV(flags, name, op, code) \ - name, ((flags >> 8) & 0xff) | BUILTIN_MARK, \ - sizeof(name) - 1, (flags & 0xff), && OP_ ## op, + name, ((VOC_ ## flags >> 8) & 0xff) | BUILTIN_MARK, \ + sizeof(name) - 1, (VOC_ ## flags & 0xff), && OP_ ## op, PLATFORM_OPCODE_LIST EXTRA_OPCODE_LIST OPCODE_LIST diff --git a/ueforth/common/opcodes.h b/ueforth/common/opcodes.h index 00c236c..4f37503 100644 --- a/ueforth/common/opcodes.h +++ b/ueforth/common/opcodes.h @@ -21,9 +21,8 @@ typedef intptr_t cell_t; typedef uintptr_t ucell_t; #define YV(flags, op, code) XV(flags, #op, ID_ ## op, code) -#define X(name, op, code) XV(FORTH, name, op, code) -#define Y(op, code) XV(FORTH, #op, ID_ ## op, code) -#define FL(vocab, flags) ((vocab) | ((flags) << 8)) +#define X(name, op, code) XV(forth, name, op, code) +#define Y(op, code) XV(forth, #op, ID_ ## op, code) #define NIP (--sp) #define NIPn(n) (sp -= (n)) @@ -62,10 +61,10 @@ typedef int64_t dcell_t; *sp = (cell_t) (d - ((dcell_t) a) * tos); tos = a #endif -enum { FORTH = 0, INTERNALS }; typedef struct { const char *name; - uint8_t flags, name_length, vocabulary; + uint8_t flags, name_length; + uint16_t vocabulary; const void *code; } BUILTIN_WORD; @@ -109,7 +108,7 @@ typedef struct { Y(CELL, DUP; tos = sizeof(cell_t)) \ Y(FIND, tos = find((const char *) *sp, tos); --sp) \ Y(PARSE, DUP; tos = parse(tos, sp)) \ - XV(INTERNALS, "S>NUMBER?", \ + XV(internals, "S>NUMBER?", \ CONVERT, tos = convert((const char *) *sp, tos, g_sys.base, sp); \ if (!tos) --sp) \ Y(CREATE, DUP; DUP; tos = parse(32, sp); \ @@ -117,13 +116,13 @@ typedef struct { COMMA(0); DROPn(2)) \ X("DOES>", DOES, DOES(ip); ip = (cell_t *) *rp; --rp) \ Y(IMMEDIATE, DOIMMEDIATE()) \ - XV(INTERNALS, "'SYS", SYS, DUP; tos = (cell_t) &g_sys) \ + XV(internals, "'SYS", SYS, DUP; tos = (cell_t) &g_sys) \ Y(YIELD, PARK; return rp) \ X(":", COLON, DUP; DUP; tos = parse(32, sp); \ create((const char *) *sp, tos, SMUDGE, ADDR_DOCOLON); \ g_sys.state = -1; --sp; DROP) \ - YV(INTERNALS, EVALUATE1, DUP; float *tfp = fp; \ + YV(internals, EVALUATE1, DUP; float *tfp = fp; \ sp = evaluate1(sp, &tfp); \ fp = tfp; w = *sp--; DROP; if (w) JMPW) \ Y(EXIT, ip = (cell_t *) *rp--) \ - XV(FL(FORTH, IMMEDIATE), ";", SEMICOLON, COMMA(g_sys.DOEXIT_XT); UNSMUDGE(); g_sys.state = 0) + XV(forth_immediate, ";", SEMICOLON, COMMA(g_sys.DOEXIT_XT); UNSMUDGE(); g_sys.state = 0) diff --git a/ueforth/esp32/bindings.fs b/ueforth/esp32/bindings.fs index 3d73e02..bc65ce1 100644 --- a/ueforth/esp32/bindings.fs +++ b/ueforth/esp32/bindings.fs @@ -15,74 +15,29 @@ ( Migrate various words to separate vocabularies, and constants ) vocabulary Wire Wire definitions -transfer{ - Wire.begin Wire.setClock Wire.getClock - Wire.setTimeout Wire.getTimeout - Wire.beginTransmission Wire.endTransmission - Wire.requestFrom Wire.write - Wire.available Wire.read - Wire.peek Wire.flush -}transfer +transfer wire-builtins forth definitions vocabulary WiFi WiFi definitions - -transfer{ - WiFi.config - WiFi.begin WiFi.disconnect - WiFi.status - WiFi.macAddress WiFi.localIP - WiFi.mode - WiFi.setTxPower WiFi.getTxPower -}transfer - +transfer WiFi-builtins ( WiFi Modes ) 0 constant WIFI_MODE_NULL 1 constant WIFI_MODE_STA 2 constant WIFI_MODE_AP 3 constant WIFI_MODE_APSTA - forth definitions -DEFINED? SD.begin [IF] vocabulary SD SD definitions -transfer{ - SD.begin SD.end - SD.beginFull SD.beginDefaults - SD.totalBytes SD.usedBytes - SD.cardType -}transfer +transfer SD-builtins forth definitions -[THEN] -DEFINED? SD_MMC.begin [IF] vocabulary SD_MMC SD_MMC definitions -transfer{ - SD_MMC.begin SD_MMC.end - SD_MMC.beginFull SD_MMC.beginDefaults - SD_MMC.totalBytes SD_MMC.usedBytes - SD_MMC.cardType -}transfer +transfer SD_MMC-builtins forth definitions -[THEN] -DEFINED? spi_flash_init [IF] vocabulary spi_flash spi_flash definitions -transfer{ - spi_flash_init spi_flash_get_chip_size - spi_flash_erase_sector spi_flash_erase_range - spi_flash_write spi_flash_write_encrypted - spi_flash_read spi_flash_read_encrypted - spi_flash_mmap spi_flash_mmap_pages spi_flash_munmap - spi_flash_mmap_dump spi_flash_mmap_get_free_pages - spi_flash_cache2phys spi_flash_phys2cache spi_flash_cache_enabled - esp_partition_find esp_partition_find_first esp_partition_get - esp_partition_next esp_partition_iterator_release - esp_partition_verify esp_partition_read esp_partition_write - esp_partition_erase_range esp_partition_mmap - esp_partition_get_sha256 esp_partition_check_identity - esp_partition_t_size -}transfer +transfer spi_flash-builtins +DEFINED? spi_flash_init [IF] 0 constant SPI_PARTITION_TYPE_APP 1 constant SPI_PARTITION_TYPE_DATA $ff constant SPI_PARTITION_SUBTYPE_ANY @@ -103,73 +58,39 @@ $ff constant SPI_PARTITION_SUBTYPE_ANY begin dup esp_partition_get p. esp_partition_next dup 0= until drop ; : list-partitions SPI_PARTITION_TYPE_APP list-partition-type SPI_PARTITION_TYPE_DATA list-partition-type ; -forth definitions [THEN] +forth definitions vocabulary SPIFFS SPIFFS definitions -transfer{ - SPIFFS.begin SPIFFS.end - SPIFFS.format - SPIFFS.totalBytes SPIFFS.usedBytes -}transfer +transfer SPIFFS-builtins forth definitions -DEFINED? ledcSetup [IF] vocabulary ledc ledc definitions -transfer{ - ledcSetup ledcAttachPin ledcDetachPin - ledcRead ledcReadFreq - ledcWrite ledcWriteTone ledcWriteNote -}transfer +transfer ledc-builtins forth definitions -[THEN] vocabulary Serial Serial definitions -transfer{ - Serial.begin Serial.end - Serial.available Serial.readBytes - Serial.write Serial.flush -}transfer +transfer Serial-builtins forth definitions vocabulary sockets sockets definitions -transfer{ - socket bind listen connect sockaccept select poll errno setsockopt -}transfer +transfer sockets-builtins 1 constant SOCK_STREAM 2 constant AF_INET 16 constant sizeof(sockaddr_in) 1 constant SOL_SOCKET 2 constant SO_REUSEADDR - : bs, ( n -- ) dup 256 / c, c, ; : s, ( n -- ) dup c, 256 / c, ; : l, ( n -- ) dup s, 65536 / s, ; : sockaddr create 16 c, AF_INET c, 0 bs, 0 l, 0 l, 0 l, ; : ->port@ ( a -- n ) 2 + >r r@ c@ 256 * r> 1+ c@ + ; : ->port! ( n a -- ) 2 + >r dup 256 / r@ c! r> 1+ c! ; - forth definitions -DEFINED? gpio_config [IF] vocabulary interrupts interrupts definitions -transfer{ - gpio_config - gpio_reset_pin gpio_set_intr_type - gpio_intr_enable gpio_intr_disable - gpio_set_level gpio_get_level - gpio_set_direction - gpio_set_pull_mode - gpio_wakeup_enable gpio_wakeup_disable - gpio_pullup_en gpio_pullup_dis - gpio_pulldown_en gpio_pulldown_dis - gpio_hold_en gpio_hold_dis - gpio_deep_sleep_hold_en gpio_deep_sleep_hold_dis - gpio_install_isr_service gpio_uninstall_isr_service - gpio_isr_handler_add gpio_isr_handler_remove - gpio_set_drive_capability gpio_get_drive_capability - esp_intr_alloc esp_intr_free -}transfer +transfer interrupts-builtins +DEFINED? gpio_config [IF] 0 constant ESP_INTR_FLAG_DEFAULT : ESP_INTR_FLAG_LEVELn ( n=1-6 -- n ) 1 swap lshift ; 1 7 lshift constant ESP_INTR_FLAG_NMI @@ -188,62 +109,24 @@ transfer{ ESP_INTR_FLAG_DEFAULT gpio_install_isr_service drop : pinchange ( xt pin ) dup #GPIO_INTR_ANYEDGE gpio_set_intr_type throw swap 0 gpio_isr_handler_add throw ; -forth definitions [THEN] +forth definitions -DEFINED? rmt_set_clk_div [IF] vocabulary rmt rmt definitions -transfer{ - rmt_set_clk_div rmt_get_clk_div rmt_set_rx_idle_thresh rmt_get_rx_idle_thresh - rmt_set_mem_block_num rmt_get_mem_block_num rmt_set_tx_carrier - rmt_set_mem_pd rmt_get_mem_pd rmt_tx_start rmt_tx_stop rmt_rx_start rmt_rx_stop - rmt_tx_memory_reset rmt_rx_memory_reset rmt_set_memory_owner rmt_get_memory_owner - rmt_set_tx_loop_mode rmt_get_tx_loop_mode rmt_set_rx_filter - rmt_set_source_clk rmt_get_source_clk rmt_set_idle_level rmt_get_idle_level - rmt_get_status rmt_set_rx_intr_en rmt_set_err_intr_en rmt_set_tx_intr_en - rmt_set_tx_thr_intr_en - rmt_set_gpio rmt_config rmt_isr_register rmt_isr_deregister - rmt_fill_tx_items rmt_driver_install rmt_driver_uinstall - rmt_get_channel_status rmt_get_counter_clock rmt_write_items - rmt_wait_tx_done rmt_get_ringbuf_handle rmt_translator_init - rmt_translator_set_context rmt_translator_get_context rmt_write_sample -}transfer +transfer rmt-builtins forth definitions -[THEN] -DEFINED? xPortGetCoreID [IF] vocabulary rtos rtos definitions -transfer{ - xPortGetCoreID xTaskCreatePinnedToCore vTaskDelete -}transfer +transfer rtos-builtins forth definitions -[THEN] -DEFINED? SerialBT.new [IF] vocabulary bluetooth bluetooth definitions -transfer{ - SerialBT.new SerialBT.delete SerialBT.begin SerialBT.end - SerialBT.available SerialBT.readBytes SerialBT.write - SerialBT.flush SerialBT.hasClient - SerialBT.enableSSP SerialBT.setPin SerialBT.unpairDevice - SerialBT.connect SerialBT.connectAddr SerialBT.disconnect SerialBT.connected - SerialBT.isReady esp_bt_dev_get_address -}transfer +transfer bluetooth-builtins forth definitions -[THEN] -DEFINED? OledNew [IF] vocabulary oled oled definitions -transfer{ - OledNew OledDelete OledBegin OledAddr - OledHOME OledCLS - OledTextc OledPrintln OledNumln OledNum - OledDisplay OledPrint - OledInvert OledTextsize OledSetCursor - OledPixel OledDrawL OledCirc OledCircF - OledRect OledRectF OledRectR OledRectrf -}transfer - +transfer oled-builtins +DEFINED? OledNew [IF] 128 constant WIDTH 64 constant HEIGHT -1 constant OledReset @@ -262,15 +145,10 @@ transfer{ 0 0 OledSetCursor ( Start at top-left corner ) z" *Esp32forth*" OledPrintln OledDisplay ; -forth definitions [THEN] +forth definitions internals definitions -transfer{ - malloc sysfree realloc - heap_caps_malloc heap_caps_free heap_caps_realloc -}transfer - ( Heap Capabilities ) binary 0001 constant MALLOC_CAP_EXEC diff --git a/ueforth/esp32/bterm.fs b/ueforth/esp32/bterm.fs index a8d7dea..721e5f4 100644 --- a/ueforth/esp32/bterm.fs +++ b/ueforth/esp32/bterm.fs @@ -13,7 +13,6 @@ \ limitations under the License. ( Lazy loaded Bluetooth Serial Terminal ) - : bterm r| vocabulary bterm bterm definitions also bluetooth also internals diff --git a/ueforth/esp32/builtins.h b/ueforth/esp32/builtins.h index 64eea84..7d0dffd 100644 --- a/ueforth/esp32/builtins.h +++ b/ueforth/esp32/builtins.h @@ -58,26 +58,26 @@ static cell_t ResizeFile(cell_t fd, cell_t size); FLOATING_POINT_LIST #define REQUIRED_MEMORY_SUPPORT \ - YV(INTERNALS, MALLOC, SET malloc(n0)) \ - YV(INTERNALS, SYSFREE, free(a0); DROP) \ - YV(INTERNALS, REALLOC, SET realloc(a1, n0); NIP) \ - YV(INTERNALS, heap_caps_malloc, SET heap_caps_malloc(n1, n0); NIP) \ - YV(INTERNALS, heap_caps_free, heap_caps_free(a0); DROP) \ - YV(INTERNALS, heap_caps_realloc, \ + YV(internals, MALLOC, SET malloc(n0)) \ + YV(internals, SYSFREE, free(a0); DROP) \ + YV(internals, REALLOC, SET realloc(a1, n0); NIP) \ + YV(internals, heap_caps_malloc, SET heap_caps_malloc(n1, n0); NIP) \ + YV(internals, heap_caps_free, heap_caps_free(a0); DROP) \ + YV(internals, heap_caps_realloc, \ tos = (cell_t) heap_caps_realloc(a2, n1, n0); NIPn(2)) #define REQUIRED_SYSTEM_SUPPORT \ X("MS-TICKS", MS_TICKS, PUSH millis()) \ - XV(INTERNALS, "RAW-YIELD", RAW_YIELD, yield()) \ + XV(internals, "RAW-YIELD", RAW_YIELD, yield()) \ Y(TERMINATE, exit(n0)) #define REQUIRED_SERIAL_SUPPORT \ - XV(VOC_SERIAL, "Serial.begin", SERIAL_BEGIN, Serial.begin(tos); DROP) \ - XV(VOC_SERIAL, "Serial.end", SERIAL_END, Serial.end()) \ - XV(VOC_SERIAL, "Serial.available", SERIAL_AVAILABLE, PUSH Serial.available()) \ - XV(VOC_SERIAL, "Serial.readBytes", SERIAL_READ_BYTES, n0 = Serial.readBytes(b1, n0); NIP) \ - XV(VOC_SERIAL, "Serial.write", SERIAL_WRITE, n0 = Serial.write(b1, n0); NIP) \ - XV(VOC_SERIAL, "Serial.flush", SERIAL_FLUSH, Serial.flush()) + XV(serial, "Serial.begin", SERIAL_BEGIN, Serial.begin(tos); DROP) \ + 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.flush", SERIAL_FLUSH, Serial.flush()) #define REQUIRED_ARDUINO_GPIO_SUPPORT \ Y(pinMode, pinMode(n1, n0); DROPn(2)) \ @@ -121,16 +121,16 @@ static cell_t ResizeFile(cell_t fd, cell_t size); # define OPTIONAL_LEDC_SUPPORT #else # define OPTIONAL_LEDC_SUPPORT \ - Y(ledcSetup, \ + YV(ledc, ledcSetup, \ n0 = (cell_t) (1000000 * ledcSetup(n2, n1 / 1000.0, n0)); NIPn(2)) \ - Y(ledcAttachPin, ledcAttachPin(n1, n0); DROPn(2)) \ - Y(ledcDetachPin, ledcDetachPin(n0); DROP) \ - Y(ledcRead, n0 = ledcRead(n0)) \ - Y(ledcReadFreq, n0 = (cell_t) (1000000 * ledcReadFreq(n0))) \ - Y(ledcWrite, ledcWrite(n1, n0); DROPn(2)) \ - Y(ledcWriteTone, \ + YV(ledc, ledcAttachPin, ledcAttachPin(n1, n0); DROPn(2)) \ + YV(ledc, ledcDetachPin, ledcDetachPin(n0); DROP) \ + YV(ledc, ledcRead, n0 = ledcRead(n0)) \ + YV(ledc, ledcReadFreq, n0 = (cell_t) (1000000 * ledcReadFreq(n0))) \ + YV(ledc, ledcWrite, ledcWrite(n1, n0); DROPn(2)) \ + YV(ledc, ledcWriteTone, \ n0 = (cell_t) (1000000 * ledcWriteTone(n1, n0 / 1000.0)); NIP) \ - Y(ledcWriteNote, \ + YV(ledc, ledcWriteNote, \ tos = (cell_t) (1000000 * ledcWriteNote(n2, (note_t) n1, n0)); NIPn(2)) #endif @@ -149,56 +149,56 @@ static cell_t ResizeFile(cell_t fd, cell_t size); # include "esp_partition.h" # endif # define OPTIONAL_SPI_FLASH_SUPPORT \ - YV(SPI_FLASH, spi_flash_init, spi_flash_init()) \ - YV(SPI_FLASH, spi_flash_get_chip_size, PUSH spi_flash_get_chip_size()) \ - YV(SPI_FLASH, spi_flash_erase_sector, n0 = spi_flash_erase_sector(n0)) \ - YV(SPI_FLASH, spi_flash_erase_range, n0 = spi_flash_erase_range(n1, n0); DROP) \ - YV(SPI_FLASH, spi_flash_write, n0 = spi_flash_write(n2, a1, n0); NIPn(2)) \ - YV(SPI_FLASH, spi_flash_write_encrypted, n0 = spi_flash_write_encrypted(n2, a1, n0); NIPn(2)) \ - YV(SPI_FLASH, spi_flash_read, n0 = spi_flash_read(n2, a1, n0); NIPn(2)) \ - YV(SPI_FLASH, spi_flash_read_encrypted, n0 = spi_flash_read_encrypted(n2, a1, n0); NIPn(2)) \ - YV(SPI_FLASH, spi_flash_mmap, \ + YV(spi_flash, spi_flash_init, spi_flash_init()) \ + YV(spi_flash, spi_flash_get_chip_size, PUSH spi_flash_get_chip_size()) \ + YV(spi_flash, spi_flash_erase_sector, n0 = spi_flash_erase_sector(n0)) \ + YV(spi_flash, spi_flash_erase_range, n0 = spi_flash_erase_range(n1, n0); DROP) \ + YV(spi_flash, spi_flash_write, n0 = spi_flash_write(n2, a1, n0); NIPn(2)) \ + YV(spi_flash, spi_flash_write_encrypted, n0 = spi_flash_write_encrypted(n2, a1, n0); NIPn(2)) \ + YV(spi_flash, spi_flash_read, n0 = spi_flash_read(n2, a1, n0); NIPn(2)) \ + YV(spi_flash, spi_flash_read_encrypted, n0 = spi_flash_read_encrypted(n2, a1, n0); NIPn(2)) \ + YV(spi_flash, spi_flash_mmap, \ n0 = spi_flash_mmap(n4, n3, (spi_flash_mmap_memory_t) n2, \ (const void **) a1, (spi_flash_mmap_handle_t *) a0); NIPn(4)) \ - YV(SPI_FLASH, spi_flash_mmap_pages, \ + YV(spi_flash, spi_flash_mmap_pages, \ n0 = spi_flash_mmap_pages((const int *) a4, n3, (spi_flash_mmap_memory_t) n2, \ (const void **) a1, (spi_flash_mmap_handle_t *) a0); NIPn(4)) \ - YV(SPI_FLASH, spi_flash_munmap, spi_flash_munmap((spi_flash_mmap_handle_t) a0); DROP) \ - YV(SPI_FLASH, spi_flash_mmap_dump, spi_flash_mmap_dump()) \ - YV(SPI_FLASH, spi_flash_mmap_get_free_pages, \ + YV(spi_flash, spi_flash_munmap, spi_flash_munmap((spi_flash_mmap_handle_t) a0); DROP) \ + YV(spi_flash, spi_flash_mmap_dump, spi_flash_mmap_dump()) \ + YV(spi_flash, spi_flash_mmap_get_free_pages, \ n0 = spi_flash_mmap_get_free_pages((spi_flash_mmap_memory_t) n0)) \ - YV(SPI_FLASH, spi_flash_cache2phys, n0 = spi_flash_cache2phys(a0)) \ - YV(SPI_FLASH, spi_flash_phys2cache, \ + YV(spi_flash, spi_flash_cache2phys, n0 = spi_flash_cache2phys(a0)) \ + YV(spi_flash, spi_flash_phys2cache, \ n0 = (cell_t) spi_flash_phys2cache(n1, (spi_flash_mmap_memory_t) n0); NIP) \ - YV(SPI_FLASH, spi_flash_cache_enabled, PUSH spi_flash_cache_enabled()) \ - YV(SPI_FLASH, esp_partition_find, \ + YV(spi_flash, spi_flash_cache_enabled, PUSH spi_flash_cache_enabled()) \ + YV(spi_flash, esp_partition_find, \ n0 = (cell_t) esp_partition_find((esp_partition_type_t) n2, \ (esp_partition_subtype_t) n1, c0); NIPn(2)) \ - YV(SPI_FLASH, esp_partition_find_first, \ + YV(spi_flash, esp_partition_find_first, \ n0 = (cell_t) esp_partition_find_first((esp_partition_type_t) n2, \ (esp_partition_subtype_t) n1, c0); NIPn(2)) \ - YV(SPI_FLASH, esp_partition_t_size, PUSH sizeof(esp_partition_t)) \ - YV(SPI_FLASH, esp_partition_get, \ + YV(spi_flash, esp_partition_t_size, PUSH sizeof(esp_partition_t)) \ + YV(spi_flash, esp_partition_get, \ n0 = (cell_t) esp_partition_get((esp_partition_iterator_t) a0)) \ - YV(SPI_FLASH, esp_partition_next, \ + YV(spi_flash, esp_partition_next, \ n0 = (cell_t) esp_partition_next((esp_partition_iterator_t) a0)) \ - YV(SPI_FLASH, esp_partition_iterator_release, \ + YV(spi_flash, esp_partition_iterator_release, \ esp_partition_iterator_release((esp_partition_iterator_t) a0); DROP) \ - YV(SPI_FLASH, esp_partition_verify, n0 = (cell_t) esp_partition_verify((esp_partition_t *) a0)) \ - YV(SPI_FLASH, esp_partition_read, \ + YV(spi_flash, esp_partition_verify, n0 = (cell_t) esp_partition_verify((esp_partition_t *) a0)) \ + YV(spi_flash, esp_partition_read, \ n0 = esp_partition_read((const esp_partition_t *) a3, n2, a1, n0); NIPn(3)) \ - YV(SPI_FLASH, esp_partition_write, \ + YV(spi_flash, esp_partition_write, \ n0 = esp_partition_write((const esp_partition_t *) a3, n2, a1, n0); NIPn(3)) \ - YV(SPI_FLASH, esp_partition_erase_range, \ + YV(spi_flash, esp_partition_erase_range, \ n0 = esp_partition_erase_range((const esp_partition_t *) a2, n1, n0); NIPn(2)) \ - YV(SPI_FLASH, esp_partition_mmap, \ + YV(spi_flash, esp_partition_mmap, \ n0 = esp_partition_mmap((const esp_partition_t *) a5, n4, n3, \ (spi_flash_mmap_memory_t) n2, \ (const void **) a1, \ (spi_flash_mmap_handle_t *) a0); NIPn(5)) \ - YV(SPI_FLASH, esp_partition_get_sha256, \ + YV(spi_flash, esp_partition_get_sha256, \ n0 = esp_partition_get_sha256((const esp_partition_t *) a1, b0); NIP) \ - YV(SPI_FLASH, esp_partition_check_identity, \ + YV(spi_flash, esp_partition_check_identity, \ n0 = esp_partition_check_identity((const esp_partition_t *) a1, \ (const esp_partition_t *) a0); NIP) #endif @@ -212,12 +212,12 @@ static cell_t ResizeFile(cell_t fd, cell_t size); # include "SPIFFS.h" # endif # define OPTIONAL_SPIFFS_SUPPORT \ - XV(VOC_SPIFFS, "SPIFFS.begin", SPIFFS_BEGIN, \ + XV(SPIFFS, "SPIFFS.begin", SPIFFS_BEGIN, \ tos = SPIFFS.begin(n2, c1, n0); NIPn(2)) \ - XV(VOC_SPIFFS, "SPIFFS.end", SPIFFS_END, SPIFFS.end()) \ - XV(VOC_SPIFFS, "SPIFFS.format", SPIFFS_FORMAT, PUSH SPIFFS.format()) \ - XV(VOC_SPIFFS, "SPIFFS.totalBytes", SPIFFS_TOTAL_BYTES, PUSH SPIFFS.totalBytes()) \ - XV(VOC_SPIFFS, "SPIFFS.usedBytes", SPIFFS_USED_BYTES, PUSH SPIFFS.usedBytes()) + 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()) #endif #ifndef ENABLE_FREERTOS_SUPPORT @@ -228,10 +228,10 @@ static cell_t ResizeFile(cell_t fd, cell_t size); # include "freertos/task.h" # endif # define OPTIONAL_FREERTOS_SUPPORT \ - YV(RTOS, vTaskDelete, vTaskDelete((TaskHandle_t) n0); DROP) \ - YV(RTOS, xTaskCreatePinnedToCore, n0 = xTaskCreatePinnedToCore((TaskFunction_t) a6, \ + YV(rtos, vTaskDelete, vTaskDelete((TaskHandle_t) n0); DROP) \ + YV(rtos, xTaskCreatePinnedToCore, n0 = xTaskCreatePinnedToCore((TaskFunction_t) a6, \ c5, n4, a3, (UBaseType_t) n2, (TaskHandle_t *) a1, (BaseType_t) n0); NIPn(6)) \ - YV(RTOS, xPortGetCoreID, PUSH xPortGetCoreID()) + YV(rtos, xPortGetCoreID, PUSH xPortGetCoreID()) #endif #ifndef ENABLE_INTERRUPTS_SUPPORT @@ -246,34 +246,34 @@ static cell_t GpioIsrHandlerAdd(cell_t pin, cell_t xt, cell_t arg); static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg, cell_t flags, void *ret); # endif # define OPTIONAL_INTERRUPTS_SUPPORT \ - YV(INTERRUPTS, gpio_config, n0 = gpio_config((const gpio_config_t *) a0)) \ - YV(INTERRUPTS, gpio_reset_pin, n0 = gpio_reset_pin((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_set_intr_type, n0 = gpio_set_intr_type((gpio_num_t) n1, (gpio_int_type_t) n0); NIP) \ - YV(INTERRUPTS, gpio_intr_enable, n0 = gpio_intr_enable((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_intr_disable, n0 = gpio_intr_disable((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_set_level, n0 = gpio_set_level((gpio_num_t) n1, n0); NIP) \ - YV(INTERRUPTS, gpio_get_level, n0 = gpio_get_level((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_set_direction, n0 = gpio_set_direction((gpio_num_t) n1, (gpio_mode_t) n0); NIP) \ - YV(INTERRUPTS, gpio_set_pull_mode, n0 = gpio_set_pull_mode((gpio_num_t) n1, (gpio_pull_mode_t) n0); NIP) \ - YV(INTERRUPTS, gpio_wakeup_enable, n0 = gpio_wakeup_enable((gpio_num_t) n1, (gpio_int_type_t) n0); NIP) \ - YV(INTERRUPTS, gpio_wakeup_disable, n0 = gpio_wakeup_disable((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_pullup_en, n0 = gpio_pullup_en((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_pullup_dis, n0 = gpio_pullup_dis((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_pulldown_en, n0 = gpio_pulldown_en((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_pulldown_dis, n0 = gpio_pulldown_dis((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_hold_en, n0 = gpio_hold_en((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_hold_dis, n0 = gpio_hold_dis((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_deep_sleep_hold_en, gpio_deep_sleep_hold_en()) \ - YV(INTERRUPTS, gpio_deep_sleep_hold_dis, gpio_deep_sleep_hold_dis()) \ - YV(INTERRUPTS, gpio_install_isr_service, n0 = gpio_install_isr_service(n0)) \ - YV(INTERRUPTS, gpio_uninstall_isr_service, gpio_uninstall_isr_service()) \ - YV(INTERRUPTS, gpio_isr_handler_add, n0 = GpioIsrHandlerAdd(n2, n1, n0); NIPn(2)) \ - YV(INTERRUPTS, gpio_isr_handler_remove, n0 = gpio_isr_handler_remove((gpio_num_t) n0)) \ - YV(INTERRUPTS, gpio_set_drive_capability, n0 = gpio_set_drive_capability((gpio_num_t) n1, (gpio_drive_cap_t) n0); NIP) \ - YV(INTERRUPTS, gpio_get_drive_capability, n0 = gpio_get_drive_capability((gpio_num_t) n1, (gpio_drive_cap_t *) a0); NIP) \ - YV(INTERRUPTS, esp_intr_alloc, n0 = EspIntrAlloc(n4, n3, n2, n1, a0); NIPn(4)) \ - YV(INTERRUPTS, esp_intr_free, n0 = esp_intr_free((intr_handle_t) n0)) \ - YV(INTERRUPTS, timer_isr_register, n0 = TimerIsrRegister(n5, n4, n3, n2, n1, a0); NIPn(5)) + YV(interrupts, gpio_config, n0 = gpio_config((const gpio_config_t *) a0)) \ + YV(interrupts, gpio_reset_pin, n0 = gpio_reset_pin((gpio_num_t) n0)) \ + YV(interrupts, gpio_set_intr_type, n0 = gpio_set_intr_type((gpio_num_t) n1, (gpio_int_type_t) n0); NIP) \ + YV(interrupts, gpio_intr_enable, n0 = gpio_intr_enable((gpio_num_t) n0)) \ + YV(interrupts, gpio_intr_disable, n0 = gpio_intr_disable((gpio_num_t) n0)) \ + YV(interrupts, gpio_set_level, n0 = gpio_set_level((gpio_num_t) n1, n0); NIP) \ + YV(interrupts, gpio_get_level, n0 = gpio_get_level((gpio_num_t) n0)) \ + YV(interrupts, gpio_set_direction, n0 = gpio_set_direction((gpio_num_t) n1, (gpio_mode_t) n0); NIP) \ + YV(interrupts, gpio_set_pull_mode, n0 = gpio_set_pull_mode((gpio_num_t) n1, (gpio_pull_mode_t) n0); NIP) \ + YV(interrupts, gpio_wakeup_enable, n0 = gpio_wakeup_enable((gpio_num_t) n1, (gpio_int_type_t) n0); NIP) \ + YV(interrupts, gpio_wakeup_disable, n0 = gpio_wakeup_disable((gpio_num_t) n0)) \ + YV(interrupts, gpio_pullup_en, n0 = gpio_pullup_en((gpio_num_t) n0)) \ + YV(interrupts, gpio_pullup_dis, n0 = gpio_pullup_dis((gpio_num_t) n0)) \ + YV(interrupts, gpio_pulldown_en, n0 = gpio_pulldown_en((gpio_num_t) n0)) \ + YV(interrupts, gpio_pulldown_dis, n0 = gpio_pulldown_dis((gpio_num_t) n0)) \ + YV(interrupts, gpio_hold_en, n0 = gpio_hold_en((gpio_num_t) n0)) \ + YV(interrupts, gpio_hold_dis, n0 = gpio_hold_dis((gpio_num_t) n0)) \ + YV(interrupts, gpio_deep_sleep_hold_en, gpio_deep_sleep_hold_en()) \ + YV(interrupts, gpio_deep_sleep_hold_dis, gpio_deep_sleep_hold_dis()) \ + YV(interrupts, gpio_install_isr_service, n0 = gpio_install_isr_service(n0)) \ + YV(interrupts, gpio_uninstall_isr_service, gpio_uninstall_isr_service()) \ + YV(interrupts, gpio_isr_handler_add, n0 = GpioIsrHandlerAdd(n2, n1, n0); NIPn(2)) \ + YV(interrupts, gpio_isr_handler_remove, n0 = gpio_isr_handler_remove((gpio_num_t) n0)) \ + YV(interrupts, gpio_set_drive_capability, n0 = gpio_set_drive_capability((gpio_num_t) n1, (gpio_drive_cap_t) n0); NIP) \ + YV(interrupts, gpio_get_drive_capability, n0 = gpio_get_drive_capability((gpio_num_t) n1, (gpio_drive_cap_t *) a0); NIP) \ + YV(interrupts, esp_intr_alloc, n0 = EspIntrAlloc(n4, n3, n2, n1, a0); NIPn(4)) \ + YV(interrupts, esp_intr_free, n0 = esp_intr_free((intr_handle_t) n0)) \ + YV(timers, timer_isr_register, n0 = TimerIsrRegister(n5, n4, n3, n2, n1, a0); NIPn(5)) #endif #ifndef ENABLE_RMT_SUPPORT @@ -283,57 +283,57 @@ static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg # include "driver/rmt.h" # endif # define OPTIONAL_RMT_SUPPORT \ - YV(RMT, rmt_set_clk_div, n0 = rmt_set_clk_div((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_get_clk_div, n0 = rmt_get_clk_div((rmt_channel_t) n1, b0); NIP) \ - YV(RMT, rmt_set_rx_idle_thresh, n0 = rmt_set_rx_idle_thresh((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_get_rx_idle_thresh, \ + YV(rmt, rmt_set_clk_div, n0 = rmt_set_clk_div((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_get_clk_div, n0 = rmt_get_clk_div((rmt_channel_t) n1, b0); NIP) \ + YV(rmt, rmt_set_rx_idle_thresh, n0 = rmt_set_rx_idle_thresh((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_get_rx_idle_thresh, \ n0 = rmt_get_rx_idle_thresh((rmt_channel_t) n1, (uint16_t *) a0); NIP) \ - YV(RMT, rmt_set_mem_block_num, n0 = rmt_set_mem_block_num((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_get_mem_block_num, n0 = rmt_get_mem_block_num((rmt_channel_t) n1, b0); NIP) \ - YV(RMT, rmt_set_tx_carrier, n0 = rmt_set_tx_carrier((rmt_channel_t) n4, n3, n2, n1, \ + YV(rmt, rmt_set_mem_block_num, n0 = rmt_set_mem_block_num((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_get_mem_block_num, n0 = rmt_get_mem_block_num((rmt_channel_t) n1, b0); NIP) \ + YV(rmt, rmt_set_tx_carrier, n0 = rmt_set_tx_carrier((rmt_channel_t) n4, n3, n2, n1, \ (rmt_carrier_level_t) n0); NIPn(4)) \ - YV(RMT, rmt_set_mem_pd, n0 = rmt_set_mem_pd((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_get_mem_pd, n0 = rmt_get_mem_pd((rmt_channel_t) n1, (bool *) a0); NIP) \ - YV(RMT, rmt_tx_start, n0 = rmt_tx_start((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_tx_stop, n0 = rmt_tx_stop((rmt_channel_t) n0)) \ - YV(RMT, rmt_rx_start, n0 = rmt_rx_start((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_rx_stop, n0 = rmt_rx_stop((rmt_channel_t) n0)) \ - YV(RMT, rmt_tx_memory_reset, n0 = rmt_tx_memory_reset((rmt_channel_t) n0)) \ - YV(RMT, rmt_rx_memory_reset, n0 = rmt_rx_memory_reset((rmt_channel_t) n0)) \ - YV(RMT, rmt_set_memory_owner, n0 = rmt_set_memory_owner((rmt_channel_t) n1, (rmt_mem_owner_t) n0); NIP) \ - YV(RMT, rmt_get_memory_owner, n0 = rmt_get_memory_owner((rmt_channel_t) n1, (rmt_mem_owner_t *) a0); NIP) \ - YV(RMT, rmt_set_tx_loop_mode, n0 = rmt_set_tx_loop_mode((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_get_tx_loop_mode, n0 = rmt_get_tx_loop_mode((rmt_channel_t) n1, (bool *) a0); NIP) \ - YV(RMT, rmt_set_rx_filter, n0 = rmt_set_rx_filter((rmt_channel_t) n2, n1, n0); NIPn(2)) \ - YV(RMT, rmt_set_source_clk, n0 = rmt_set_source_clk((rmt_channel_t) n1, (rmt_source_clk_t) n0); NIP) \ - YV(RMT, rmt_get_source_clk, n0 = rmt_get_source_clk((rmt_channel_t) n1, (rmt_source_clk_t * ) a0); NIP) \ - YV(RMT, rmt_set_idle_level, n0 = rmt_set_idle_level((rmt_channel_t) n2, n1, \ + YV(rmt, rmt_set_mem_pd, n0 = rmt_set_mem_pd((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_get_mem_pd, n0 = rmt_get_mem_pd((rmt_channel_t) n1, (bool *) a0); NIP) \ + YV(rmt, rmt_tx_start, n0 = rmt_tx_start((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_tx_stop, n0 = rmt_tx_stop((rmt_channel_t) n0)) \ + YV(rmt, rmt_rx_start, n0 = rmt_rx_start((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_rx_stop, n0 = rmt_rx_stop((rmt_channel_t) n0)) \ + YV(rmt, rmt_tx_memory_reset, n0 = rmt_tx_memory_reset((rmt_channel_t) n0)) \ + YV(rmt, rmt_rx_memory_reset, n0 = rmt_rx_memory_reset((rmt_channel_t) n0)) \ + YV(rmt, rmt_set_memory_owner, n0 = rmt_set_memory_owner((rmt_channel_t) n1, (rmt_mem_owner_t) n0); NIP) \ + YV(rmt, rmt_get_memory_owner, n0 = rmt_get_memory_owner((rmt_channel_t) n1, (rmt_mem_owner_t *) a0); NIP) \ + YV(rmt, rmt_set_tx_loop_mode, n0 = rmt_set_tx_loop_mode((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_get_tx_loop_mode, n0 = rmt_get_tx_loop_mode((rmt_channel_t) n1, (bool *) a0); NIP) \ + YV(rmt, rmt_set_rx_filter, n0 = rmt_set_rx_filter((rmt_channel_t) n2, n1, n0); NIPn(2)) \ + YV(rmt, rmt_set_source_clk, n0 = rmt_set_source_clk((rmt_channel_t) n1, (rmt_source_clk_t) n0); NIP) \ + YV(rmt, rmt_get_source_clk, n0 = rmt_get_source_clk((rmt_channel_t) n1, (rmt_source_clk_t * ) a0); NIP) \ + YV(rmt, rmt_set_idle_level, n0 = rmt_set_idle_level((rmt_channel_t) n2, n1, \ (rmt_idle_level_t) n0); NIPn(2)) \ - YV(RMT, rmt_get_idle_level, n0 = rmt_get_idle_level((rmt_channel_t) n2, \ + YV(rmt, rmt_get_idle_level, n0 = rmt_get_idle_level((rmt_channel_t) n2, \ (bool *) a1, (rmt_idle_level_t *) a0); NIPn(2)) \ - YV(RMT, rmt_get_status, n0 = rmt_get_status((rmt_channel_t) n1, (uint32_t *) a0); NIP) \ - YV(RMT, rmt_set_rx_intr_en, n0 = rmt_set_rx_intr_en((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_set_err_intr_en, n0 = rmt_set_err_intr_en((rmt_channel_t) n1, (rmt_mode_t) n0); NIP) \ - YV(RMT, rmt_set_tx_intr_en, n0 = rmt_set_tx_intr_en((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_set_tx_thr_intr_en, n0 = rmt_set_tx_thr_intr_en((rmt_channel_t) n2, n1, n0); NIPn(2)) \ - YV(RMT, rmt_set_gpio, n0 = rmt_set_gpio((rmt_channel_t) n3, (rmt_mode_t) n2, (gpio_num_t) n1, n0); NIPn(3)) \ - YV(RMT, rmt_config, n0 = rmt_config((const rmt_config_t *) a0)) \ - YV(RMT, rmt_isr_register, n0 = rmt_isr_register((void (*)(void*)) a3, a2, n1, \ + YV(rmt, rmt_get_status, n0 = rmt_get_status((rmt_channel_t) n1, (uint32_t *) a0); NIP) \ + YV(rmt, rmt_set_rx_intr_en, n0 = rmt_set_rx_intr_en((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_set_err_intr_en, n0 = rmt_set_err_intr_en((rmt_channel_t) n1, (rmt_mode_t) n0); NIP) \ + YV(rmt, rmt_set_tx_intr_en, n0 = rmt_set_tx_intr_en((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_set_tx_thr_intr_en, n0 = rmt_set_tx_thr_intr_en((rmt_channel_t) n2, n1, n0); NIPn(2)) \ + YV(rmt, rmt_set_gpio, n0 = rmt_set_gpio((rmt_channel_t) n3, (rmt_mode_t) n2, (gpio_num_t) n1, n0); NIPn(3)) \ + YV(rmt, rmt_config, n0 = rmt_config((const rmt_config_t *) a0)) \ + YV(rmt, rmt_isr_register, n0 = rmt_isr_register((void (*)(void*)) a3, a2, n1, \ (rmt_isr_handle_t *) a0); NIPn(3)) \ - YV(RMT, rmt_isr_deregister, n0 = rmt_isr_deregister((rmt_isr_handle_t) n0)) \ - YV(RMT, rmt_fill_tx_items, n0 = rmt_fill_tx_items((rmt_channel_t) n3, \ + YV(rmt, rmt_isr_deregister, n0 = rmt_isr_deregister((rmt_isr_handle_t) n0)) \ + YV(rmt, rmt_fill_tx_items, n0 = rmt_fill_tx_items((rmt_channel_t) n3, \ (rmt_item32_t *) a2, n1, n0); NIPn(3)) \ - YV(RMT, rmt_driver_install, n0 = rmt_driver_install((rmt_channel_t) n2, n1, n0); NIPn(2)) \ - YV(RMT, rmt_driver_uinstall, n0 = rmt_driver_uninstall((rmt_channel_t) n0)) \ - YV(RMT, rmt_get_channel_status, n0 = rmt_get_channel_status((rmt_channel_status_result_t *) a0)) \ - YV(RMT, rmt_get_counter_clock, n0 = rmt_get_counter_clock((rmt_channel_t) n1, (uint32_t *) a0); NIP) \ - YV(RMT, rmt_write_items, n0 = rmt_write_items((rmt_channel_t) n3, (rmt_item32_t *) a2, n1, n0); NIPn(3)) \ - YV(RMT, rmt_wait_tx_done, n0 = rmt_wait_tx_done((rmt_channel_t) n1, n0); NIP) \ - YV(RMT, rmt_get_ringbuf_handle, n0 = rmt_get_ringbuf_handle((rmt_channel_t) n1, (RingbufHandle_t *) a0); NIP) \ - YV(RMT, rmt_translator_init, n0 = rmt_translator_init((rmt_channel_t) n1, (sample_to_rmt_t) n0); NIP) \ - YV(RMT, rmt_translator_set_context, n0 = rmt_translator_set_context((rmt_channel_t) n1, a0); NIP) \ - YV(RMT, rmt_translator_get_context, n0 = rmt_translator_get_context((const size_t *) a1, (void **) a0); NIP) \ - YV(RMT, rmt_write_sample, n0 = rmt_write_sample((rmt_channel_t) n3, b2, n1, n0); NIPn(3)) + YV(rmt, rmt_driver_install, n0 = rmt_driver_install((rmt_channel_t) n2, n1, n0); NIPn(2)) \ + YV(rmt, rmt_driver_uinstall, n0 = rmt_driver_uninstall((rmt_channel_t) n0)) \ + YV(rmt, rmt_get_channel_status, n0 = rmt_get_channel_status((rmt_channel_status_result_t *) a0)) \ + YV(rmt, rmt_get_counter_clock, n0 = rmt_get_counter_clock((rmt_channel_t) n1, (uint32_t *) a0); NIP) \ + YV(rmt, rmt_write_items, n0 = rmt_write_items((rmt_channel_t) n3, (rmt_item32_t *) a2, n1, n0); NIPn(3)) \ + YV(rmt, rmt_wait_tx_done, n0 = rmt_wait_tx_done((rmt_channel_t) n1, n0); NIP) \ + YV(rmt, rmt_get_ringbuf_handle, n0 = rmt_get_ringbuf_handle((rmt_channel_t) n1, (RingbufHandle_t *) a0); NIP) \ + YV(rmt, rmt_translator_init, n0 = rmt_translator_init((rmt_channel_t) n1, (sample_to_rmt_t) n0); NIP) \ + YV(rmt, rmt_translator_set_context, n0 = rmt_translator_set_context((rmt_channel_t) n1, a0); NIP) \ + YV(rmt, rmt_translator_get_context, n0 = rmt_translator_get_context((const size_t *) a1, (void **) a0); NIP) \ + YV(rmt, rmt_write_sample, n0 = rmt_write_sample((rmt_channel_t) n3, b2, n1, n0); NIPn(3)) #endif #ifndef ENABLE_CAMERA_SUPPORT @@ -343,11 +343,11 @@ static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg # include "esp_camera.h" # endif # define OPTIONAL_CAMERA_SUPPORT \ - YV(CAMERA, esp_camera_init, n0 = esp_camera_init((camera_config_t *) a0)) \ - YV(CAMERA, esp_camera_deinit, PUSH esp_camera_deinit()) \ - YV(CAMERA, esp_camera_fb_get, PUSH esp_camera_fb_get()) \ - YV(CAMERA, esp_camera_fb_return, esp_camera_fb_return((camera_fb_t *) a0); DROP) \ - YV(CAMERA, esp_camera_sensor_get, PUSH esp_camera_sensor_get()) + YV(camera, esp_camera_init, n0 = esp_camera_init((camera_config_t *) a0)) \ + YV(camera, esp_camera_deinit, PUSH esp_camera_deinit()) \ + YV(camera, esp_camera_fb_get, PUSH esp_camera_fb_get()) \ + YV(camera, esp_camera_fb_return, esp_camera_fb_return((camera_fb_t *) a0); DROP) \ + YV(camera, esp_camera_sensor_get, PUSH esp_camera_sensor_get()) #endif #ifndef ENABLE_SOCKETS_SUPPORT @@ -363,15 +363,15 @@ static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg # include # endif # define OPTIONAL_SOCKETS_SUPPORT \ - YV(SOCKETS, socket, n0 = socket(n2, n1, n0); NIPn(2)) \ - YV(SOCKETS, setsockopt, n0 = setsockopt(n4, n3, n2, a1, n0); NIPn(4)) \ - YV(SOCKETS, bind, n0 = bind(n2, (struct sockaddr *) a1, n0); NIPn(2)) \ - YV(SOCKETS, listen, n0 = listen(n1, n0); NIP) \ - YV(SOCKETS, connect, n0 = connect(n2, (struct sockaddr *) a1, n0); NIPn(2)) \ - YV(SOCKETS, sockaccept, n0 = accept(n2, (struct sockaddr *) a1, (socklen_t *) a0); NIPn(2)) \ - YV(SOCKETS, select, n0 = select(n4, (fd_set *) a3, (fd_set *) a2, (fd_set *) a1, (struct timeval *) a0); NIPn(4)) \ - YV(SOCKETS, poll, n0 = poll((struct pollfd *) a2, (nfds_t) n1, n0); NIPn(2)) \ - YV(SOCKETS, errno, PUSH errno) + YV(sockets, socket, n0 = socket(n2, n1, n0); NIPn(2)) \ + YV(sockets, setsockopt, n0 = setsockopt(n4, n3, n2, a1, n0); NIPn(4)) \ + YV(sockets, bind, n0 = bind(n2, (struct sockaddr *) a1, n0); NIPn(2)) \ + YV(sockets, listen, n0 = listen(n1, n0); NIP) \ + YV(sockets, connect, n0 = connect(n2, (struct sockaddr *) a1, n0); NIPn(2)) \ + YV(sockets, sockaccept, n0 = accept(n2, (struct sockaddr *) a1, (socklen_t *) a0); NIPn(2)) \ + YV(sockets, select, n0 = select(n4, (fd_set *) a3, (fd_set *) a2, (fd_set *) a1, (struct timeval *) a0); NIPn(4)) \ + YV(sockets, poll, n0 = poll((struct pollfd *) a2, (nfds_t) n1, n0); NIPn(2)) \ + YV(sockets, errno, PUSH errno) #endif #ifndef ENABLE_SD_SUPPORT @@ -381,15 +381,15 @@ static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg # include "SD.h" # endif # define OPTIONAL_SD_SUPPORT \ - XV(VOC_SD, "SD.begin", SD_BEGIN, PUSH SD.begin()) \ - XV(VOC_SD, "SD.beginFull", SD_BEGIN_FULL, \ + XV(SD, "SD.begin", SD_BEGIN, PUSH SD.begin()) \ + XV(SD, "SD.beginFull", SD_BEGIN_FULL, \ tos = SD.begin(n5, *(SPIClass*)a4, n3, c2, n1, n0); NIPn(5)) \ - XV(VOC_SD, "SD.beginDefaults", SD_BEGIN_DEFAULTS, \ + XV(SD, "SD.beginDefaults", SD_BEGIN_DEFAULTS, \ PUSH SS; PUSH &SPI; PUSH 4000000; PUSH "/sd"; PUSH 5; PUSH false) \ - XV(VOC_SD, "SD.end", SD_END, SD.end()) \ - XV(VOC_SD, "SD.cardType", SD_CARD_TYPE, PUSH SD.cardType()) \ - XV(VOC_SD, "SD.totalBytes", SD_TOTAL_BYTES, PUSH SD.totalBytes()) \ - XV(VOC_SD, "SD.usedBytes", SD_USED_BYTES, PUSH SD.usedBytes()) + XV(SD, "SD.end", SD_END, SD.end()) \ + XV(SD, "SD.cardType", SD_CARD_TYPE, PUSH SD.cardType()) \ + XV(SD, "SD.totalBytes", SD_TOTAL_BYTES, PUSH SD.totalBytes()) \ + XV(SD, "SD.usedBytes", SD_USED_BYTES, PUSH SD.usedBytes()) #endif #ifndef ENABLE_SD_MMC_SUPPORT @@ -399,14 +399,14 @@ static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg # include "SD_MMC.h" # endif # define OPTIONAL_SD_MMC_SUPPORT \ - XV(VOC_SD_MMC, "SD_MMC.begin", SD_MMC_BEGIN, PUSH SD_MMC.begin()) \ - XV(VOC_SD_MMC, "SD_MMC.beginFull", SD_MMC_BEGIN_FULL, tos = SD_MMC.begin(c2, n1, n0); NIPn(2)) \ - XV(VOC_SD_MMC, "SD_MMC.beginDefaults", SD_MMC_BEGIN_DEFAULTS, \ + XV(SD_MMC, "SD_MMC.begin", SD_MMC_BEGIN, PUSH SD_MMC.begin()) \ + XV(SD_MMC, "SD_MMC.beginFull", SD_MMC_BEGIN_FULL, tos = SD_MMC.begin(c2, n1, n0); NIPn(2)) \ + XV(SD_MMC, "SD_MMC.beginDefaults", SD_MMC_BEGIN_DEFAULTS, \ PUSH "/sdcard"; PUSH false; PUSH false) \ - XV(VOC_SD_MMC, "SD_MMC.end", SD_MMC_END, SD_MMC.end()) \ - XV(VOC_SD_MMC, "SD_MMC.cardType", SD_MMC_CARD_TYPE, PUSH SD_MMC.cardType()) \ - XV(VOC_SD_MMC, "SD_MMC.totalBytes", SD_MMC_TOTAL_BYTES, PUSH SD_MMC.totalBytes()) \ - XV(VOC_SD_MMC, "SD_MMC.usedBytes", SD_MMC_USED_BYTES, PUSH SD_MMC.usedBytes()) + XV(SD_MMC, "SD_MMC.end", SD_MMC_END, SD_MMC.end()) \ + XV(SD_MMC, "SD_MMC.cardType", SD_MMC_CARD_TYPE, PUSH SD_MMC.cardType()) \ + XV(SD_MMC, "SD_MMC.totalBytes", SD_MMC_TOTAL_BYTES, PUSH SD_MMC.totalBytes()) \ + XV(SD_MMC, "SD_MMC.usedBytes", SD_MMC_USED_BYTES, PUSH SD_MMC.usedBytes()) #endif #ifndef ENABLE_I2C_SUPPORT @@ -416,19 +416,19 @@ static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg # include # endif # define OPTIONAL_I2C_SUPPORT \ - XV(WIRE, "Wire.begin", WIRE_BEGIN, n0 = Wire.begin(n1, n0); NIP) \ - XV(WIRE, "Wire.setClock", WIRE_SET_CLOCK, Wire.setClock(n0); DROP) \ - XV(WIRE, "Wire.getClock", WIRE_GET_CLOCK, PUSH Wire.getClock()) \ - XV(WIRE, "Wire.setTimeout", WIRE_SET_TIMEOUT, Wire.setTimeout(n0); DROP) \ - XV(WIRE, "Wire.getTimeout", WIRE_GET_TIMEOUT, PUSH Wire.getTimeout()) \ - XV(WIRE, "Wire.beginTransmission", WIRE_BEGIN_TRANSMISSION, Wire.beginTransmission(n0); DROP) \ - XV(WIRE, "Wire.endTransmission", WIRE_END_TRANSMISSION, SET Wire.endTransmission(n0)) \ - XV(WIRE, "Wire.requestFrom", WIRE_REQUEST_FROM, n0 = Wire.requestFrom(n2, n1, n0); NIPn(2)) \ - XV(WIRE, "Wire.write", WIRE_WRITE, n0 = Wire.write(b1, n0); NIP) \ - XV(WIRE, "Wire.available", WIRE_AVAILABLE, PUSH Wire.available()) \ - XV(WIRE, "Wire.read", WIRE_READ, PUSH Wire.read()) \ - XV(WIRE, "Wire.peek", WIRE_PEEK, PUSH Wire.peek()) \ - XV(WIRE, "Wire.flush", WIRE_FLUSH, Wire.flush()) + XV(Wire, "Wire.begin", WIRE_BEGIN, n0 = Wire.begin(n1, n0); NIP) \ + XV(Wire, "Wire.setClock", WIRE_SET_CLOCK, Wire.setClock(n0); DROP) \ + XV(Wire, "Wire.getClock", WIRE_GET_CLOCK, PUSH Wire.getClock()) \ + XV(Wire, "Wire.setTimeout", WIRE_SET_TIMEOUT, Wire.setTimeout(n0); DROP) \ + XV(Wire, "Wire.getTimeout", WIRE_GET_TIMEOUT, PUSH Wire.getTimeout()) \ + XV(Wire, "Wire.beginTransmission", WIRE_BEGIN_TRANSMISSION, Wire.beginTransmission(n0); DROP) \ + XV(Wire, "Wire.endTransmission", WIRE_END_TRANSMISSION, SET Wire.endTransmission(n0)) \ + XV(Wire, "Wire.requestFrom", WIRE_REQUEST_FROM, n0 = Wire.requestFrom(n2, n1, n0); NIPn(2)) \ + XV(Wire, "Wire.write", WIRE_WRITE, n0 = Wire.write(b1, n0); NIP) \ + XV(Wire, "Wire.available", WIRE_AVAILABLE, PUSH Wire.available()) \ + XV(Wire, "Wire.read", WIRE_READ, PUSH Wire.read()) \ + XV(Wire, "Wire.peek", WIRE_PEEK, PUSH Wire.peek()) \ + XV(Wire, "Wire.flush", WIRE_FLUSH, Wire.flush()) #endif #ifndef ENABLE_SERIAL_BLUETOOTH_SUPPORT @@ -440,26 +440,26 @@ static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg # define bt0 ((BluetoothSerial *) a0) # endif # define OPTIONAL_SERIAL_BLUETOOTH_SUPPORT \ - XV(BLUETOOTH, "SerialBT.new", SERIALBT_NEW, PUSH new BluetoothSerial()) \ - XV(BLUETOOTH, "SerialBT.delete", SERIALBT_DELETE, delete bt0; DROP) \ - XV(BLUETOOTH, "SerialBT.begin", SERIALBT_BEGIN, n0 = bt0->begin(c2, n1); NIPn(2)) \ - XV(BLUETOOTH, "SerialBT.end", SERIALBT_END, bt0->end(); DROP) \ - XV(BLUETOOTH, "SerialBT.available", SERIALBT_AVAILABLE, n0 = bt0->available()) \ - XV(BLUETOOTH, "SerialBT.readBytes", SERIALBT_READ_BYTES, n0 = bt0->readBytes(b2, n1); NIPn(2)) \ - XV(BLUETOOTH, "SerialBT.write", SERIALBT_WRITE, n0 = bt0->write(b2, n1); NIPn(2)) \ - XV(BLUETOOTH, "SerialBT.flush", SERIALBT_FLUSH, bt0->flush(); DROP) \ - XV(BLUETOOTH, "SerialBT.hasClient", SERIALBT_HAS_CLIENT, n0 = bt0->hasClient()) \ - XV(BLUETOOTH, "SerialBT.enableSSP", SERIALBT_ENABLE_SSP, bt0->enableSSP(); DROP) \ - XV(BLUETOOTH, "SerialBT.setPin", SERIALBT_SET_PIN, n0 = bt0->setPin(c1); NIP) \ - XV(BLUETOOTH, "SerialBT.unpairDevice", SERIALBT_UNPAIR_DEVICE, \ + XV(bluetooth, "SerialBT.new", SERIALBT_NEW, PUSH new BluetoothSerial()) \ + XV(bluetooth, "SerialBT.delete", SERIALBT_DELETE, delete bt0; DROP) \ + XV(bluetooth, "SerialBT.begin", SERIALBT_BEGIN, n0 = bt0->begin(c2, n1); NIPn(2)) \ + XV(bluetooth, "SerialBT.end", SERIALBT_END, bt0->end(); DROP) \ + XV(bluetooth, "SerialBT.available", SERIALBT_AVAILABLE, n0 = bt0->available()) \ + XV(bluetooth, "SerialBT.readBytes", SERIALBT_READ_BYTES, n0 = bt0->readBytes(b2, n1); NIPn(2)) \ + XV(bluetooth, "SerialBT.write", SERIALBT_WRITE, n0 = bt0->write(b2, n1); NIPn(2)) \ + XV(bluetooth, "SerialBT.flush", SERIALBT_FLUSH, bt0->flush(); DROP) \ + XV(bluetooth, "SerialBT.hasClient", SERIALBT_HAS_CLIENT, n0 = bt0->hasClient()) \ + XV(bluetooth, "SerialBT.enableSSP", SERIALBT_ENABLE_SSP, bt0->enableSSP(); DROP) \ + XV(bluetooth, "SerialBT.setPin", SERIALBT_SET_PIN, n0 = bt0->setPin(c1); NIP) \ + XV(bluetooth, "SerialBT.unpairDevice", SERIALBT_UNPAIR_DEVICE, \ n0 = bt0->unpairDevice(b1); NIP) \ - XV(BLUETOOTH, "SerialBT.connect", SERIALBT_CONNECT, n0 = bt0->connect(c1); NIP) \ - XV(BLUETOOTH, "SerialBT.connectAddr", SERIALBT_CONNECT_ADDR, n0 = bt0->connect(b1); NIP) \ - XV(BLUETOOTH, "SerialBT.disconnect", SERIALBT_DISCONNECT, n0 = bt0->disconnect()) \ - XV(BLUETOOTH, "SerialBT.connected", SERIALBT_CONNECTED, n0 = bt0->connected(n1); NIP) \ - XV(BLUETOOTH, "SerialBT.isReady", SERIALBT_IS_READY, n0 = bt0->isReady(n2, n1); NIPn(2)) \ + XV(bluetooth, "SerialBT.connect", SERIALBT_CONNECT, n0 = bt0->connect(c1); NIP) \ + XV(bluetooth, "SerialBT.connectAddr", SERIALBT_CONNECT_ADDR, n0 = bt0->connect(b1); NIP) \ + XV(bluetooth, "SerialBT.disconnect", SERIALBT_DISCONNECT, n0 = bt0->disconnect()) \ + XV(bluetooth, "SerialBT.connected", SERIALBT_CONNECTED, n0 = bt0->connected(n1); NIP) \ + XV(bluetooth, "SerialBT.isReady", SERIALBT_IS_READY, n0 = bt0->isReady(n2, n1); NIPn(2)) \ /* Bluetooth */ \ - YV(BLUETOOTH, esp_bt_dev_get_address, PUSH esp_bt_dev_get_address()) + YV(bluetooth, esp_bt_dev_get_address, PUSH esp_bt_dev_get_address()) #endif #ifndef ENABLE_WIFI_SUPPORT @@ -485,16 +485,16 @@ static cell_t FromIP(IPAddress ip) { # define OPTIONAL_WIFI_SUPPORT \ /* WiFi */ \ - XV(WIFI, "WiFi.config", WIFI_CONFIG, \ + XV(WiFi, "WiFi.config", WIFI_CONFIG, \ WiFi.config(ToIP(n3), ToIP(n2), ToIP(n1), ToIP(n0)); DROPn(4)) \ - XV(WIFI, "WiFi.begin", WIFI_BEGIN, WiFi.begin(c1, c0); DROPn(2)) \ - XV(WIFI, "WiFi.disconnect", WIFI_DISCONNECT, WiFi.disconnect()) \ - XV(WIFI, "WiFi.status", WIFI_STATUS, PUSH WiFi.status()) \ - XV(WIFI, "WiFi.macAddress", WIFI_MAC_ADDRESS, WiFi.macAddress(b0); DROP) \ - XV(WIFI, "WiFi.localIP", WIFI_LOCAL_IPS, PUSH FromIP(WiFi.localIP())) \ - XV(WIFI, "WiFi.mode", WIFI_MODE, WiFi.mode((wifi_mode_t) n0); DROP) \ - XV(WIFI, "WiFi.setTxPower", WIFI_SET_TX_POWER, WiFi.setTxPower((wifi_power_t) n0); DROP) \ - XV(WIFI, "WiFi.getTxPower", WIFI_GET_TX_POWER, PUSH WiFi.getTxPower()) + XV(WiFi, "WiFi.begin", WIFI_BEGIN, WiFi.begin(c1, c0); DROPn(2)) \ + XV(WiFi, "WiFi.disconnect", WIFI_DISCONNECT, WiFi.disconnect()) \ + XV(WiFi, "WiFi.status", WIFI_STATUS, PUSH WiFi.status()) \ + XV(WiFi, "WiFi.macAddress", WIFI_MAC_ADDRESS, WiFi.macAddress(b0); DROP) \ + XV(WiFi, "WiFi.localIP", WIFI_LOCAL_IPS, PUSH FromIP(WiFi.localIP())) \ + XV(WiFi, "WiFi.mode", WIFI_MODE, WiFi.mode((wifi_mode_t) n0); DROP) \ + XV(WiFi, "WiFi.setTxPower", WIFI_SET_TX_POWER, WiFi.setTxPower((wifi_power_t) n0); DROP) \ + XV(WiFi, "WiFi.getTxPower", WIFI_GET_TX_POWER, PUSH WiFi.getTxPower()) #endif #ifndef ENABLE_MDNS_SUPPORT @@ -517,27 +517,27 @@ static cell_t FromIP(IPAddress ip) { static Adafruit_SSD1306 *oled_display = 0; # endif # define OPTIONAL_OLED_SUPPORT \ - YV(OLED, OledAddr, PUSH &oled_display) \ - YV(OLED, OledNew, oled_display = new Adafruit_SSD1306(n2, n1, &Wire, n0); DROPn(3)) \ - YV(OLED, OledDelete, delete oled_display) \ - YV(OLED, OledBegin, n0 = oled_display->begin(n1, n0); NIP) \ - YV(OLED, OledHOME, oled_display->setCursor(0,0); DROP) \ - YV(OLED, OledCLS, oled_display->clearDisplay()) \ - YV(OLED, OledTextc, oled_display->setTextColor(n0); DROP) \ - YV(OLED, OledPrintln, oled_display->println(c0); DROP) \ - YV(OLED, OledNumln, oled_display->println(n0); DROP) \ - YV(OLED, OledNum, oled_display->print(n0); DROP) \ - YV(OLED, OledDisplay, oled_display->display()) \ - YV(OLED, OledPrint, oled_display->write(c0); DROP) \ - YV(OLED, OledInvert, oled_display->invertDisplay(n0); DROP) \ - YV(OLED, OledTextsize, oled_display->setTextSize(n0); DROP) \ - YV(OLED, OledSetCursor, oled_display->setCursor(n1,n0); DROPn(2)) \ - YV(OLED, OledPixel, oled_display->drawPixel(n2, n1, n0); DROPn(2)) \ - YV(OLED, OledDrawL, oled_display->drawLine(n4, n3, n2, n1, n0); DROPn(4)) \ - YV(OLED, OledCirc, oled_display->drawCircle(n3,n2, n1, n0); DROPn(3)) \ - YV(OLED, OledCircF, oled_display->fillCircle(n3, n2, n1, n0); DROPn(3)) \ - YV(OLED, OledRect, oled_display->drawRect(n4, n3, n2, n1, n0); DROPn(4)) \ - YV(OLED, OledRectF, oled_display->fillRect(n4, n3, n2, n1, n0); DROPn(3)) \ - YV(OLED, OledRectR, oled_display->drawRoundRect(n5, n4, n3, n2, n1, n0); DROPn(5)) \ - YV(OLED, OledRectRF, oled_display->fillRoundRect(n5, n4, n3, n2, n1, n0 ); DROPn(5)) + YV(oled, OledAddr, PUSH &oled_display) \ + YV(oled, OledNew, oled_display = new Adafruit_SSD1306(n2, n1, &Wire, n0); DROPn(3)) \ + YV(oled, OledDelete, delete oled_display) \ + YV(oled, OledBegin, n0 = oled_display->begin(n1, n0); NIP) \ + YV(oled, OledHOME, oled_display->setCursor(0,0); DROP) \ + YV(oled, OledCLS, oled_display->clearDisplay()) \ + YV(oled, OledTextc, oled_display->setTextColor(n0); DROP) \ + YV(oled, OledPrintln, oled_display->println(c0); DROP) \ + YV(oled, OledNumln, oled_display->println(n0); DROP) \ + YV(oled, OledNum, oled_display->print(n0); DROP) \ + YV(oled, OledDisplay, oled_display->display()) \ + YV(oled, OledPrint, oled_display->write(c0); DROP) \ + YV(oled, OledInvert, oled_display->invertDisplay(n0); DROP) \ + YV(oled, OledTextsize, oled_display->setTextSize(n0); DROP) \ + YV(oled, OledSetCursor, oled_display->setCursor(n1,n0); DROPn(2)) \ + YV(oled, OledPixel, oled_display->drawPixel(n2, n1, n0); DROPn(2)) \ + YV(oled, OledDrawL, oled_display->drawLine(n4, n3, n2, n1, n0); DROPn(4)) \ + YV(oled, OledCirc, oled_display->drawCircle(n3,n2, n1, n0); DROPn(3)) \ + YV(oled, OledCircF, oled_display->fillCircle(n3, n2, n1, n0); DROPn(3)) \ + YV(oled, OledRect, oled_display->drawRect(n4, n3, n2, n1, n0); DROPn(4)) \ + YV(oled, OledRectF, oled_display->fillRect(n4, n3, n2, n1, n0); DROPn(3)) \ + YV(oled, OledRectR, oled_display->drawRoundRect(n5, n4, n3, n2, n1, n0); DROPn(5)) \ + YV(oled, OledRectRF, oled_display->fillRoundRect(n5, n4, n3, n2, n1, n0 ); DROPn(5)) #endif diff --git a/ueforth/esp32/camera.fs b/ueforth/esp32/camera.fs index d7967fd..44ccd53 100644 --- a/ueforth/esp32/camera.fs +++ b/ueforth/esp32/camera.fs @@ -12,27 +12,16 @@ \ See the License for the specific language governing permissions and \ limitations under the License. -( Lazy loaded camera gandling for ESP32-CAM ) -DEFINED? esp_camera_init [IF] - internals definitions -transfer{ - esp_camera_init esp_camera_deinit - esp_camera_fb_get esp_camera_fb_return - esp_camera_sensor_get -}transfer +transfer camera-builtins forth definitions +( Lazy loaded camera handling for ESP32-CAM ) : camera r| vocabulary camera camera definitions also internals - -transfer{ - esp_camera_init esp_camera_deinit - esp_camera_fb_get esp_camera_fb_return - esp_camera_sensor_get -}transfer +transfer camera-builtins 0 constant PIXFORMAT_RGB565 1 constant PIXFORMAT_YUV422 diff --git a/ueforth/esp32/camera_server.fs b/ueforth/esp32/camera_server.fs index 7f3b2a6..90b2435 100644 --- a/ueforth/esp32/camera_server.fs +++ b/ueforth/esp32/camera_server.fs @@ -13,8 +13,6 @@ \ limitations under the License. ( Lazy loaded Camera Server ) -DEFINED? camera [IF] - : camera-server r~ camera @@ -87,5 +85,3 @@ Frame(); only forth definitions camera-server ~ evaluate ; - -[THEN] diff --git a/ueforth/esp32/options.h b/ueforth/esp32/options.h index 50d9e31..e275428 100644 --- a/ueforth/esp32/options.h +++ b/ueforth/esp32/options.h @@ -65,8 +65,8 @@ # endif #endif -enum { - RTOS = 2, REGISTERS, VOC_SPIFFS, VOC_SERIAL, TASKS, VOC_SD, VOC_SD_MMC, LEDC, - WIRE, WIFI, EDITOR, BLUETOOTH, SOCKETS, STREAMS, OLED, - RMT, INTERRUPTS, SPI_FLASH, CAMERA, -}; +#define VOCABULARY_LIST \ + V(forth) V(internals) \ + V(rtos) V(SPIFFS) V(serial) V(SD) V(SD_MMC) \ + V(ledc) V(Wire) V(WiFi) V(bluetooth) V(sockets) V(oled) \ + V(rmt) V(interrupts) V(spi_flash) V(camera) V(timers) diff --git a/ueforth/esp32/print-builtins.cpp b/ueforth/esp32/print-builtins.cpp index b14cde2..9d96fac 100644 --- a/ueforth/esp32/print-builtins.cpp +++ b/ueforth/esp32/print-builtins.cpp @@ -24,8 +24,8 @@ #include "builtins.h" #define YV(flags, op, code) XV(flags, #op, op, code) -#define X(name, op, code) XV(FORTH, name, op, code) -#define Y(op, code) XV(FORTH, #op, op, code) +#define X(name, op, code) XV(forth, name, op, code) +#define Y(op, code) XV(forth, #op, op, code) int main() { printf("#define PLATFORM_SIMULATED_OPCODE_LIST \\\n"); diff --git a/ueforth/esp32/timers.fs b/ueforth/esp32/timers.fs index 7826ec6..610275c 100644 --- a/ueforth/esp32/timers.fs +++ b/ueforth/esp32/timers.fs @@ -12,17 +12,16 @@ \ See the License for the specific language governing permissions and \ limitations under the License. -( Lazy loaded timers ) - internals definitions -transfer timer_isr_register +transfer timers-builtins forth definitions +( Lazy loaded timers ) : timers r| vocabulary timers timers definitions also registers also interrupts also internals -transfer timer_isr_register +transfer timers-builtins $3ff5f000 constant TIMG_BASE ( group n = 0/1, timer x = 0/1, watchdog m = 0-5 ) diff --git a/ueforth/posix/httpd.fs b/ueforth/posix/httpd.fs index 367570c..0d28766 100644 --- a/ueforth/posix/httpd.fs +++ b/ueforth/posix/httpd.fs @@ -13,7 +13,6 @@ \ limitations under the License. ( Lazy loaded HTTP Daemon ) - : httpd r| vocabulary httpd httpd definitions also sockets diff --git a/ueforth/posix/main.c b/ueforth/posix/main.c index bb67d86..c3b12f2 100644 --- a/ueforth/posix/main.c +++ b/ueforth/posix/main.c @@ -29,6 +29,8 @@ CALLING_OPCODE_LIST \ FLOATING_POINT_LIST +#define VOCABULARY_LIST V(forth) V(internals) + #include "common/core.h" #include "common/interp.h" diff --git a/ueforth/posix/telnetd.fs b/ueforth/posix/telnetd.fs index 570df27..8da5eee 100644 --- a/ueforth/posix/telnetd.fs +++ b/ueforth/posix/telnetd.fs @@ -13,7 +13,6 @@ \ limitations under the License. ( Lazy loaded Telnet ) - : telnetd r| vocabulary telnetd telnetd definitions also sockets diff --git a/ueforth/windows/interp.h b/ueforth/windows/interp.h index 9deeb5d..1f617dc 100644 --- a/ueforth/windows/interp.h +++ b/ueforth/windows/interp.h @@ -32,8 +32,8 @@ enum { static cell_t *forth_run(cell_t *init_rp) { static const BUILTIN_WORD builtins[] = { #define XV(flags, name, op, code) \ - name, ((flags >> 8) & 0xff) | BUILTIN_MARK, sizeof(name) - 1, \ - (flags & 0xff), (void *) OP_ ## op, + name, ((VOC_ ## flags >> 8) & 0xff) | BUILTIN_MARK, sizeof(name) - 1, \ + (VOC_ ## flags & 0xff), (void *) OP_ ## op, PLATFORM_OPCODE_LIST EXTRA_OPCODE_LIST OPCODE_LIST diff --git a/ueforth/windows/main.c b/ueforth/windows/main.c index 13d95e2..39b1995 100644 --- a/ueforth/windows/main.c +++ b/ueforth/windows/main.c @@ -44,6 +44,8 @@ CALLING_OPCODE_LIST \ FLOATING_POINT_LIST +#define VOCABULARY_LIST V(forth) V(internals) + #include "common/core.h" #include "windows/interp.h"