From fc7175d488d07837e47981aff32774ba3114008c Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Sat, 8 Jul 2023 10:21:13 -0700 Subject: [PATCH] Pull RMT into an optional module, refactor. --- Makefile | 23 ++++- common/forth_namespace_tests.fs | 2 - esp32/bindings.fs | 4 - esp32/builtins.h | 86 ++++--------------- esp32/optional/README-optional.txt | 4 + esp32/optional/camera/camera.h | 5 +- esp32/optional/oled/oled.h | 8 +- esp32/optional/rmt.h | 69 +++++++++++++++ .../serial-bluetooth/serial-bluetooth.h | 10 +-- esp32/optional/spi-flash/spi-flash.h | 7 +- esp32/optionals.fs | 6 ++ esp32/options.h | 12 +-- esp32/print-builtins.cpp | 2 + esp32/sim_main.cpp | 1 + site/ESP32forth.html | 5 +- 15 files changed, 141 insertions(+), 103 deletions(-) create mode 100644 esp32/optional/rmt.h diff --git a/Makefile b/Makefile index 157796e..d7d9bf6 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION=7.0.7.14 +VERSION=7.0.7.15 STABLE_VERSION=7.0.6.19 OLD_STABLE_VERSION=7.0.5.4 REVISION=$(shell git rev-parse HEAD | head -c 20) @@ -165,6 +165,18 @@ tests: $(TESTS) clean-esp32: rm -rf $(ESP32)/esp32*_build $(ESP32)/esp32*_cache +vet: + $(MAKE) clean + $(MAKE) all + $(MAKE) esp32-build + $(MAKE) esp32s2-build + $(MAKE) esp32c3-build + $(MAKE) clean-esp32 + $(MAKE) add-optional + $(MAKE) esp32-build + $(MAKE) clean + $(MAKE) all + clean: rm -rf $(OUT) @@ -335,6 +347,7 @@ OPTIONAL_MODULES = \ $(ESP32)/ESP32forth/assemblers.h \ $(ESP32)/ESP32forth/camera.h \ $(ESP32)/ESP32forth/oled.h \ + $(ESP32)/ESP32forth/rmt.h \ $(ESP32)/ESP32forth/serial-bluetooth.h \ $(ESP32)/ESP32forth/spi-flash.h @@ -646,6 +659,13 @@ $(ESP32)/ESP32forth/optional/oled.h: \ oled=@$(GEN)/esp32_oled.h \ >$@ +$(ESP32)/ESP32forth/optional/rmt.h: \ + esp32/optional/rmt.h | $(ESP32)/ESP32forth/optional + cat esp32/optional/rmt.h | tools/replace.js \ + VERSION=$(VERSION) \ + REVISION=$(REVISION) \ + >$@ + $(ESP32)/ESP32forth/optional/serial-bluetooth.h: \ esp32/optional/serial-bluetooth/serial-bluetooth.h \ $(GEN)/esp32_serial-bluetooth.h | $(ESP32)/ESP32forth/optional @@ -764,6 +784,7 @@ $(ESP32)/ESP32forth.zip: \ $(ESP32)/ESP32forth/optional/assemblers.h \ $(ESP32)/ESP32forth/optional/camera.h \ $(ESP32)/ESP32forth/optional/oled.h \ + $(ESP32)/ESP32forth/optional/rmt.h \ $(ESP32)/ESP32forth/optional/serial-bluetooth.h \ $(ESP32)/ESP32forth/optional/spi-flash.h cd $(ESP32) && rm -f ESP32forth.zip && zip -r ESP32forth.zip ESP32forth diff --git a/common/forth_namespace_tests.fs b/common/forth_namespace_tests.fs index 8e17dde..537ed4f 100644 --- a/common/forth_namespace_tests.fs +++ b/common/forth_namespace_tests.fs @@ -623,7 +623,6 @@ e: test-esp32-forth-voclist out: streams out: tasks out: rtos - out: rmt out: interrupts out: sockets out: Serial @@ -683,7 +682,6 @@ e: check-esp32-builtins e: check-esp32-bindings out: rtos - out: rmt out: interrupts out: sockets out: Serial diff --git a/esp32/bindings.fs b/esp32/bindings.fs index 0817d5d..01ac1d0 100644 --- a/esp32/bindings.fs +++ b/esp32/bindings.fs @@ -103,10 +103,6 @@ ESP_INTR_FLAG_DEFAULT gpio_install_isr_service drop [THEN] forth definitions -vocabulary rmt rmt definitions -transfer rmt-builtins -forth definitions - vocabulary rtos rtos definitions transfer rtos-builtins forth definitions diff --git a/esp32/builtins.h b/esp32/builtins.h index 894d93d..cd0170f 100644 --- a/esp32/builtins.h +++ b/esp32/builtins.h @@ -36,7 +36,7 @@ # define OPTIONAL_ASSEMBLERS_SUPPORT # endif -// Hook to pull in words from optional Oled support. +// Hook to pull in optional Oled support. # if __has_include("oled.h") # include "oled.h" # else @@ -44,7 +44,7 @@ # define OPTIONAL_OLED_SUPPORT # endif -// Hook to pull in words from optional ESP32-CAM camera support. +// Hook to pull in optional ESP32-CAM camera support. # if __has_include("camera.h") # include "camera.h" # else @@ -52,20 +52,28 @@ # define OPTIONAL_CAMERA_SUPPORT # endif -// Hook to pull in words from optional serial bluetooth support. +// Hook to pull in optional RMT (Remote Control) support. +# if __has_include("rmt.h") +# include "rmt.h" +# else +# define OPTIONAL_RMT_VOCABULARY +# define OPTIONAL_RMT_SUPPORT +# endif + +// Hook to pull in optional serial bluetooth support. # if __has_include("serial-bluetooth.h") # include "serial-bluetooth.h" # else -# define OPTIONAL_SERIAL_BLUETOOTH_SUPPORT # define OPTIONAL_BLUETOOTH_VOCABULARY +# define OPTIONAL_SERIAL_BLUETOOTH_SUPPORT # endif -// Hook to pull in words from optional SPI flash support. +// Hook to pull in optional SPI flash support. # if __has_include("spi-flash.h") # include "spi-flash.h" # else -# define OPTIONAL_SPI_FLASH_SUPPORT # define OPTIONAL_SPI_FLASH_VOCABULARY +# define OPTIONAL_SPI_FLASH_SUPPORT # endif static cell_t ResizeFile(cell_t fd, cell_t size); @@ -94,16 +102,16 @@ static cell_t ResizeFile(cell_t fd, cell_t size); OPTIONAL_SOCKETS_SUPPORT \ OPTIONAL_FREERTOS_SUPPORT \ OPTIONAL_INTERRUPTS_SUPPORT \ - OPTIONAL_RMT_SUPPORT \ CALLING_OPCODE_LIST \ FLOATING_POINT_LIST #define EXTERNAL_OPTIONAL_MODULE_SUPPORT \ OPTIONAL_ASSEMBLERS_SUPPORT \ OPTIONAL_CAMERA_SUPPORT \ - OPTIONAL_SPI_FLASH_SUPPORT \ - OPTIONAL_SERIAL_BLUETOOTH_SUPPORT \ OPTIONAL_OLED_SUPPORT \ + OPTIONAL_RMT_SUPPORT \ + OPTIONAL_SERIAL_BLUETOOTH_SUPPORT \ + OPTIONAL_SPI_FLASH_SUPPORT #define REQUIRED_MEMORY_SUPPORT \ YV(internals, MALLOC, SET malloc(n0)) \ @@ -349,66 +357,6 @@ static void TimerInitNull(cell_t group, cell_t timer); #endif -#ifndef ENABLE_RMT_SUPPORT -# define OPTIONAL_RMT_SUPPORT -#else -# ifndef SIM_PRINT_ONLY -# 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, \ - 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, \ - (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, \ - (rmt_idle_level_t) n0); NIPn(2)) \ - 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, \ - (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, \ - (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)) -#endif - #ifndef ENABLE_SOCKETS_SUPPORT # define OPTIONAL_SOCKETS_SUPPORT #else diff --git a/esp32/optional/README-optional.txt b/esp32/optional/README-optional.txt index c5aa71e..b8fee01 100644 --- a/esp32/optional/README-optional.txt +++ b/esp32/optional/README-optional.txt @@ -12,6 +12,10 @@ These are the current optional modules: * assemblers.h - Assemblers for ESP32 Xtensa and ESP32 RISC-V * camera.h - Support for the ESP32-CAM camera * oled.h - Support for the SSD1306 Oled + * rmt.h - Support for RMT (Remote Control) + * serial-bluetooth.h - Support for Bluetooth serial and + bterm a Bluetooth serial redirector for the terminal + * spi-flash.h - Support for low level SPI Flash partition access Initially ESP32forth focused on a minimal C kernel, with most functionality built in Forth code loaded at boot. Eventually, as support for more capabilities diff --git a/esp32/optional/camera/camera.h b/esp32/optional/camera/camera.h index 5b6581a..cf5cabf 100644 --- a/esp32/optional/camera/camera.h +++ b/esp32/optional/camera/camera.h @@ -17,9 +17,8 @@ * Revision: {{REVISION}} */ -#ifndef SIM_PRINT_ONLY -# include "esp_camera.h" -#endif +#include "esp_camera.h" + #define OPTIONAL_CAMERA_VOCABULARY V(camera) #define OPTIONAL_CAMERA_SUPPORT \ XV(internals, "camera-source", CAMERA_SOURCE, \ diff --git a/esp32/optional/oled/oled.h b/esp32/optional/oled/oled.h index ad9d7b3..d917e7a 100644 --- a/esp32/optional/oled/oled.h +++ b/esp32/optional/oled/oled.h @@ -22,11 +22,11 @@ // Adafruit GFX Library // Adafruit BusIO -#ifndef SIM_PRINT_ONLY -# include -# include +#include +#include + static Adafruit_SSD1306 *oled_display = 0; -#endif + #define OPTIONAL_OLED_VOCABULARY V(oled) #define OPTIONAL_OLED_SUPPORT \ XV(internals, "oled-source", OLED_SOURCE, \ diff --git a/esp32/optional/rmt.h b/esp32/optional/rmt.h new file mode 100644 index 0000000..f3eb05f --- /dev/null +++ b/esp32/optional/rmt.h @@ -0,0 +1,69 @@ +// Copyright 2023 Bradley D. Nelson +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "driver/rmt.h" + +#define OPTIONAL_RMT_VOCABULARY V(rmt) +#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, \ + 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, \ + (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, \ + (rmt_idle_level_t) n0); NIPn(2)) \ + 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, \ + (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, \ + (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)) diff --git a/esp32/optional/serial-bluetooth/serial-bluetooth.h b/esp32/optional/serial-bluetooth/serial-bluetooth.h index 5d2baa4..15687bb 100644 --- a/esp32/optional/serial-bluetooth/serial-bluetooth.h +++ b/esp32/optional/serial-bluetooth/serial-bluetooth.h @@ -17,11 +17,11 @@ * Revision: {{REVISION}} */ -#ifndef SIM_PRINT_ONLY -# include "esp_bt_device.h" -# include "BluetoothSerial.h" -# define bt0 ((BluetoothSerial *) a0) -#endif +#include "esp_bt_device.h" +#include "BluetoothSerial.h" + +#define bt0 ((BluetoothSerial *) a0) + #define OPTIONAL_BLUETOOTH_VOCABULARY V(bluetooth) #define OPTIONAL_SERIAL_BLUETOOTH_SUPPORT \ XV(internals, "serial-bluetooth-source", SERIAL_BLUETOOTH_SOURCE, \ diff --git a/esp32/optional/spi-flash/spi-flash.h b/esp32/optional/spi-flash/spi-flash.h index cd2bd48..2a49e17 100644 --- a/esp32/optional/spi-flash/spi-flash.h +++ b/esp32/optional/spi-flash/spi-flash.h @@ -17,10 +17,9 @@ * Revision: {{REVISION}} */ -#ifndef SIM_PRINT_ONLY -# include "esp_spi_flash.h" -# include "esp_partition.h" -#endif +#include "esp_spi_flash.h" +#include "esp_partition.h" + #define OPTIONAL_SPI_FLASH_VOCABULARY V(spi_flash) #define OPTIONAL_SPI_FLASH_SUPPORT \ XV(internals, "spi-flash-source", SPI_FLASH_SOURCE, \ diff --git a/esp32/optionals.fs b/esp32/optionals.fs index 2ffb45b..c383c22 100644 --- a/esp32/optionals.fs +++ b/esp32/optionals.fs @@ -30,6 +30,12 @@ internals DEFINED? oled-source [IF] oled-source evaluate [THEN] forth +DEFINED? rmt-builtins [IF] + vocabulary rmt rmt definitions + transfer rmt-builtins + forth definitions +[THEN] + internals DEFINED? serial-bluetooth-source [IF] serial-bluetooth-source evaluate [THEN] forth diff --git a/esp32/options.h b/esp32/options.h index cf76b74..a85da02 100644 --- a/esp32/options.h +++ b/esp32/options.h @@ -43,15 +43,6 @@ # define ENABLE_DAC_SUPPORT #endif -// RMT support designed around v2.0.1 toolchain. -// While ESP32 also has RMT, for now only include for -// ESP32-S2 and ESP32-C3. -#if defined(CONFIG_IDF_TARGET_ESP32S2) || \ - defined(CONFIG_IDF_TARGET_ESP32C3) || \ - defined(SIM_PRINT_ONLY) -# define ENABLE_RMT_SUPPORT -#endif - // ESP32-C3 doesn't support fault handling yet. #if !defined(CONFIG_IDF_TARGET_ESP32C3) #endif @@ -100,9 +91,10 @@ V(forth) V(internals) \ V(rtos) V(SPIFFS) V(serial) V(SD) V(SD_MMC) V(ESP) \ V(ledc) V(Wire) V(WiFi) V(sockets) \ - V(rmt) V(interrupts) V(timers) \ + V(interrupts) V(timers) \ OPTIONAL_CAMERA_VOCABULARY \ OPTIONAL_BLUETOOTH_VOCABULARY \ OPTIONAL_OLED_VOCABULARY \ + OPTIONAL_RMT_VOCABULARY \ OPTIONAL_SPI_FLASH_VOCABULARY \ USER_VOCABULARIES diff --git a/esp32/print-builtins.cpp b/esp32/print-builtins.cpp index a73b875..b32b5a2 100644 --- a/esp32/print-builtins.cpp +++ b/esp32/print-builtins.cpp @@ -27,12 +27,14 @@ #define OPTIONAL_ASSEMBLERS_SUPPORT #define OPTIONAL_OLED_SUPPORT #define OPTIONAL_CAMERA_SUPPORT +#define OPTIONAL_RMT_SUPPORT #define OPTIONAL_SERIAL_BLUETOOTH_SUPPORT #define OPTIONAL_SPI_FLASH_SUPPORT #define OPTIONAL_OLED_VOCABULARY #define OPTIONAL_CAMERA_VOCABULARY #define OPTIONAL_BLUETOOTH_VOCABULARY +#define OPTIONAL_RMT_VOCABULARY #define OPTIONAL_SPI_FLASH_VOCABULARY #include "builtins.h" diff --git a/esp32/sim_main.cpp b/esp32/sim_main.cpp index dc486d6..a6d3516 100644 --- a/esp32/sim_main.cpp +++ b/esp32/sim_main.cpp @@ -25,6 +25,7 @@ #define OPTIONAL_OLED_VOCABULARY #define OPTIONAL_CAMERA_VOCABULARY #define OPTIONAL_BLUETOOTH_VOCABULARY +#define OPTIONAL_RMT_VOCABULARY #define OPTIONAL_SPI_FLASH_VOCABULARY static cell_t *simulated(cell_t *sp, const char *op); diff --git a/site/ESP32forth.html b/site/ESP32forth.html index b7db727..61de242 100644 --- a/site/ESP32forth.html +++ b/site/ESP32forth.html @@ -830,7 +830,10 @@ timer_isr_register ( group timer xt arg ret -- 0/err ) REMOVED
RMT
These words are inside the RMT vocabulary. - +

+ NOTE: Starting in v7.0.7.15 the optional module rmt.h must be + placed next to ESP32forth.ino to include this capability. +

 rmt_set_clk_div ( channel div8 -- err )
 rmt_get_clk_div ( channel @div8 -- err )