From 0d1740ad27ebb8589accd09262f1bc7f5e256edd Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 11:39:39 -0400 Subject: [PATCH 01/19] Create Lilygo-T-oi-Plus-ESP32C3 --- ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 | 1 + 1 file changed, 1 insertion(+) create mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 @@ -0,0 +1 @@ + From f86ebe71b6a60bbabeea15faa70e4b55a80b3278 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 11:40:16 -0400 Subject: [PATCH 02/19] Delete Lilygo-T-oi-Plus-ESP32C3 --- ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 deleted file mode 100644 index 8b13789179..0000000000 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 +++ /dev/null @@ -1 +0,0 @@ - From 35d78c135a094f12280ce7809c17ed6274cc6fd3 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 11:41:29 -0400 Subject: [PATCH 03/19] Create sdkconfig --- ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig | 1 + 1 file changed, 1 insertion(+) create mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig @@ -0,0 +1 @@ + From b9ea7458ab5a3034988b26efe3fcd78dce04c481 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 11:41:53 -0400 Subject: [PATCH 04/19] Add files via upload --- .../boards/Lilygo-T-oi-Plus-ESP32C3/board.c | 34 ++++++++++++++++++ .../Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h | 13 +++++++ .../Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk | 10 ++++++ .../boards/Lilygo-T-oi-Plus-ESP32C3/pins.c | 36 +++++++++++++++++++ .../boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig | 6 +++- 5 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c create mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h create mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk create mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c new file mode 100644 index 0000000000..13cdffc11c --- /dev/null +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c @@ -0,0 +1,34 @@ +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/board.h" + +#include "components/driver/include/driver/gpio.h" + +void board_init(void) { + +} + +bool board_requests_safe_mode(void) { + return false; +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Pull LED down on reset rather than the default up + if (pin_number == MICROPY_HW_LED_STATUS->number) { + gpio_config_t cfg = { + .pin_bit_mask = BIT64(pin_number), + .mode = GPIO_MODE_DISABLE, + .pull_up_en = false, + .pull_down_en = true, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&cfg); + return true; + } + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h new file mode 100644 index 0000000000..71987994e7 --- /dev/null +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h @@ -0,0 +1,13 @@ +// Define board +#define MICROPY_HW_BOARD_NAME "LILYGO TTGO T-OI PLUS" +#define MICROPY_HW_MCU_NAME "ESP32-C3" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO3) + +// I2C +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO18, .sda = &pin_GPIO19}} + +// UART +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk new file mode 100644 index 0000000000..21cd460152 --- /dev/null +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk @@ -0,0 +1,10 @@ +CIRCUITPY_CREATOR_ID = 0xC3C30000 +CIRCUITPY_CREATION_ID = 0x00C30001 + +IDF_TARGET = esp32c3 + +INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB \ No newline at end of file diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c new file mode 100644 index 0000000000..668c76b186 --- /dev/null +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c @@ -0,0 +1,36 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig index 8b13789179..7c85db8776 100644 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig @@ -1 +1,5 @@ - +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="LILYGO TTGO T-OI PLUS" +# end of LWIP From b6e6ee7505ba3ad87d7f87dc216ab85a561fe446 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 11:57:44 -0400 Subject: [PATCH 05/19] Update ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk Co-authored-by: Neradoc --- .../espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk index 21cd460152..d40c9b6722 100644 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk @@ -7,4 +7,4 @@ INTERNAL_FLASH_FILESYSTEM = 1 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB \ No newline at end of file +CIRCUITPY_ESP_FLASH_SIZE = 4MB From 6908f5a97efca64285c77b6a5e77e579d3e452e3 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 11:57:52 -0400 Subject: [PATCH 06/19] Update ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c Co-authored-by: Neradoc --- ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c index 13cdffc11c..a5f8a704b0 100644 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c @@ -4,7 +4,6 @@ #include "components/driver/include/driver/gpio.h" void board_init(void) { - } bool board_requests_safe_mode(void) { From 6fe728a9d26b82d224d1f39fb0a127e16a4ad0b8 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 11:57:59 -0400 Subject: [PATCH 07/19] Update ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c Co-authored-by: Neradoc --- ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c index 668c76b186..12f146ba39 100644 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c @@ -22,7 +22,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, - + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, From 0b586e9c9497c48b98782a653ec8d6a2fe89461b Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 12:43:52 -0400 Subject: [PATCH 08/19] Update board.c --- .../boards/Lilygo-T-oi-Plus-ESP32C3/board.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c index a5f8a704b0..aa0cf7657a 100644 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c +++ b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c @@ -10,22 +10,6 @@ bool board_requests_safe_mode(void) { return false; } -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Pull LED down on reset rather than the default up - if (pin_number == MICROPY_HW_LED_STATUS->number) { - gpio_config_t cfg = { - .pin_bit_mask = BIT64(pin_number), - .mode = GPIO_MODE_DISABLE, - .pull_up_en = false, - .pull_down_en = true, - .intr_type = GPIO_INTR_DISABLE, - }; - gpio_config(&cfg); - return true; - } - return false; -} - void reset_board(void) { } From 6903faee5f3f1b4be5a367cd83495b4eac44b34c Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 12:48:55 -0400 Subject: [PATCH 09/19] Add files via upload --- tools/build_board_info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 97192adee7..34f751d6c2 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -75,6 +75,7 @@ extension_by_board = { "espressif_esp32c3_devkitm_1_n4": BIN, "lilygo_ttgo_t-01c3": BIN, "microdev_micro_c3": BIN, + "lilygo_ttgo_t-oi_plus":BIN, # broadcom "raspberrypi_zero": KERNEL_IMG, "raspberrypi_zero_w": KERNEL_IMG, From 5a014e62a3f6af777204e163f4f484c239952e4c Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 12:51:46 -0400 Subject: [PATCH 10/19] Update build_board_info.py --- tools/build_board_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 34f751d6c2..ac9006ca32 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -75,7 +75,7 @@ extension_by_board = { "espressif_esp32c3_devkitm_1_n4": BIN, "lilygo_ttgo_t-01c3": BIN, "microdev_micro_c3": BIN, - "lilygo_ttgo_t-oi_plus":BIN, + "lilygo_ttgo_t-oi_plus": BIN, # broadcom "raspberrypi_zero": KERNEL_IMG, "raspberrypi_zero_w": KERNEL_IMG, From a4f505dcab08b4756c6f45ec737b2d65473531e2 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 13:17:17 -0400 Subject: [PATCH 11/19] Delete ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3 directory --- .../boards/Lilygo-T-oi-Plus-ESP32C3/board.c | 17 --------- .../Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h | 13 ------- .../Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk | 10 ------ .../boards/Lilygo-T-oi-Plus-ESP32C3/pins.c | 36 ------------------- .../boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig | 5 --- 5 files changed, 81 deletions(-) delete mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c delete mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h delete mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk delete mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c delete mode 100644 ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c deleted file mode 100644 index aa0cf7657a..0000000000 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/board.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/board.h" - -#include "components/driver/include/driver/gpio.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h deleted file mode 100644 index 71987994e7..0000000000 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.h +++ /dev/null @@ -1,13 +0,0 @@ -// Define board -#define MICROPY_HW_BOARD_NAME "LILYGO TTGO T-OI PLUS" -#define MICROPY_HW_MCU_NAME "ESP32-C3" - -#define MICROPY_HW_LED_STATUS (&pin_GPIO3) - -// I2C -#define CIRCUITPY_BOARD_I2C (1) -#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO18, .sda = &pin_GPIO19}} - -// UART -#define CIRCUITPY_BOARD_UART (1) -#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk deleted file mode 100644 index d40c9b6722..0000000000 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/mpconfigboard.mk +++ /dev/null @@ -1,10 +0,0 @@ -CIRCUITPY_CREATOR_ID = 0xC3C30000 -CIRCUITPY_CREATION_ID = 0x00C30001 - -IDF_TARGET = esp32c3 - -INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c deleted file mode 100644 index 12f146ba39..0000000000 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/pins.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - - { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, - - { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, - - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, - - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, - - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, - - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig b/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig deleted file mode 100644 index 7c85db8776..0000000000 --- a/ports/espressif/boards/Lilygo-T-oi-Plus-ESP32C3/sdkconfig +++ /dev/null @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="LILYGO TTGO T-OI PLUS" -# end of LWIP From f69a293795402e68967df404c03c26a81914c6d8 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 13:18:17 -0400 Subject: [PATCH 12/19] Create sdkconfig --- ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig | 1 + 1 file changed, 1 insertion(+) create mode 100644 ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig @@ -0,0 +1 @@ + From 6bdd128fb33a928c096fe75adb68b815e8fffe42 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 13:18:39 -0400 Subject: [PATCH 13/19] Add files via upload --- .../boards/lilygo_ttgo_t-oi-plus/board.c | 34 ++++++++++++++++++ .../lilygo_ttgo_t-oi-plus/mpconfigboard.h | 13 +++++++ .../lilygo_ttgo_t-oi-plus/mpconfigboard.mk | 10 ++++++ .../boards/lilygo_ttgo_t-oi-plus/pins.c | 36 +++++++++++++++++++ .../boards/lilygo_ttgo_t-oi-plus/sdkconfig | 6 +++- 5 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c create mode 100644 ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.h create mode 100644 ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk create mode 100644 ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c new file mode 100644 index 0000000000..13cdffc11c --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c @@ -0,0 +1,34 @@ +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/board.h" + +#include "components/driver/include/driver/gpio.h" + +void board_init(void) { + +} + +bool board_requests_safe_mode(void) { + return false; +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Pull LED down on reset rather than the default up + if (pin_number == MICROPY_HW_LED_STATUS->number) { + gpio_config_t cfg = { + .pin_bit_mask = BIT64(pin_number), + .mode = GPIO_MODE_DISABLE, + .pull_up_en = false, + .pull_down_en = true, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&cfg); + return true; + } + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.h new file mode 100644 index 0000000000..71987994e7 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.h @@ -0,0 +1,13 @@ +// Define board +#define MICROPY_HW_BOARD_NAME "LILYGO TTGO T-OI PLUS" +#define MICROPY_HW_MCU_NAME "ESP32-C3" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO3) + +// I2C +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO18, .sda = &pin_GPIO19}} + +// UART +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk new file mode 100644 index 0000000000..21cd460152 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk @@ -0,0 +1,10 @@ +CIRCUITPY_CREATOR_ID = 0xC3C30000 +CIRCUITPY_CREATION_ID = 0x00C30001 + +IDF_TARGET = esp32c3 + +INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB \ No newline at end of file diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c new file mode 100644 index 0000000000..668c76b186 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c @@ -0,0 +1,36 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig index 8b13789179..7c85db8776 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig @@ -1 +1,5 @@ - +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="LILYGO TTGO T-OI PLUS" +# end of LWIP From c5db1280ee5f7e29e2203cb0d8e5584f4bfc9a9f Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 13:21:58 -0400 Subject: [PATCH 14/19] Update mpconfigboard.mk --- ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk index 21cd460152..d40c9b6722 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk @@ -7,4 +7,4 @@ INTERNAL_FLASH_FILESYSTEM = 1 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB \ No newline at end of file +CIRCUITPY_ESP_FLASH_SIZE = 4MB From 83cd533785f29b02442e518409a1a344ffa64a4e Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 17:26:39 -0400 Subject: [PATCH 15/19] Update build_board_info.py --- tools/build_board_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index ac9006ca32..237a310756 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -75,7 +75,7 @@ extension_by_board = { "espressif_esp32c3_devkitm_1_n4": BIN, "lilygo_ttgo_t-01c3": BIN, "microdev_micro_c3": BIN, - "lilygo_ttgo_t-oi_plus": BIN, + "lilygo_ttgo_t-oi-plus": BIN, # broadcom "raspberrypi_zero": KERNEL_IMG, "raspberrypi_zero_w": KERNEL_IMG, From b1935975a2881183c3b3563f8fca193948bcac96 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 17:27:48 -0400 Subject: [PATCH 16/19] Update board.c --- ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c index 13cdffc11c..f48c91c686 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c @@ -3,8 +3,7 @@ #include "components/driver/include/driver/gpio.h" -void board_init(void) { - +void board_init(void) { } bool board_requests_safe_mode(void) { From 0d92b0a155c09c90661e787c3e7192d71b6b008f Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 17:46:49 -0400 Subject: [PATCH 17/19] Update board.c --- .../boards/lilygo_ttgo_t-oi-plus/board.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c index f48c91c686..aa0cf7657a 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c @@ -3,29 +3,13 @@ #include "components/driver/include/driver/gpio.h" -void board_init(void) { +void board_init(void) { } bool board_requests_safe_mode(void) { return false; } -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Pull LED down on reset rather than the default up - if (pin_number == MICROPY_HW_LED_STATUS->number) { - gpio_config_t cfg = { - .pin_bit_mask = BIT64(pin_number), - .mode = GPIO_MODE_DISABLE, - .pull_up_en = false, - .pull_down_en = true, - .intr_type = GPIO_INTR_DISABLE, - }; - gpio_config(&cfg); - return true; - } - return false; -} - void reset_board(void) { } From ef4d298ca8b633e32666c90fd0c66532ef184e90 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Thu, 12 May 2022 17:49:48 -0400 Subject: [PATCH 18/19] Update pins.c --- ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c index 668c76b186..963115bf1c 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c @@ -2,33 +2,26 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, From 1f0bdad0832c51c6fbce4a1ede058a61b82658e5 Mon Sep 17 00:00:00 2001 From: SimonVail <35699287+SimonVail@users.noreply.github.com> Date: Fri, 13 May 2022 15:02:26 -0400 Subject: [PATCH 19/19] Update ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk Co-authored-by: Scott Shawcroft --- ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk index d40c9b6722..2f66e69415 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk @@ -1,5 +1,5 @@ CIRCUITPY_CREATOR_ID = 0xC3C30000 -CIRCUITPY_CREATION_ID = 0x00C30001 +CIRCUITPY_CREATION_ID = 0x00C30002 IDF_TARGET = esp32c3