Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ CHIP_COMPONENTS = \
esp_driver_usb_serial_jtag \
esp_hal_dma \
esp_hal_i2s \
esp_hal_lcd \
esp_hal_pcnt \
esp_hal_pmu \
esp_hal_rmt \
Expand Down
64 changes: 64 additions & 0 deletions ports/espressif/boards/espressif_esp32s31_korvo_1/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,69 @@
// SPDX-License-Identifier: MIT

#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h"
#include "shared-bindings/framebufferio/FramebufferDisplay.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-module/displayio/__init__.h"

// The 4.3 inch 800x480 RGB panel on the LCD connector (ESP32-S3-LCD-EV-Board SUB3,
// ST7262E43). It needs no init commands, only the RGB timing below.

// LCD data lines DB0-DB15, least significant bit first within each color.
static const mcu_pin_obj_t *blue_pins[] = {
&pin_GPIO8, &pin_GPIO9, &pin_GPIO10, &pin_GPIO11, &pin_GPIO12
};
static const mcu_pin_obj_t *green_pins[] = {
&pin_GPIO13, &pin_GPIO14, &pin_GPIO15, &pin_GPIO16, &pin_GPIO17, &pin_GPIO18
};
static const mcu_pin_obj_t *red_pins[] = {
&pin_GPIO19, &pin_GPIO33, &pin_GPIO34, &pin_GPIO35, &pin_GPIO36
};

// Display enable on the LCD connector.
#define LCD_DISP_PIN (38)

void board_init(void) {
config_pin_as_output_with_level(LCD_DISP_PIN, true);

dotclockframebuffer_framebuffer_obj_t *framebuffer = &allocate_display_bus_or_raise()->dotclock;
framebuffer->base.type = &dotclockframebuffer_framebuffer_type;

common_hal_dotclockframebuffer_framebuffer_construct(
framebuffer,
/* de */ &pin_GPIO43,
/* vsync */ &pin_GPIO45,
/* hsync */ &pin_GPIO44,
/* dclk */ &pin_GPIO40,
/* data */ red_pins, MP_ARRAY_SIZE(red_pins), green_pins, MP_ARRAY_SIZE(green_pins), blue_pins, MP_ARRAY_SIZE(blue_pins),
/* frequency */ 18000000,
/* width x height */ 800, 480,
/* horizontal: pulse, back & front porch, idle */ 40, 40, 48, false,
/* vertical: pulse, back & front porch, idle */ 23, 32, 13, false,
/* de_idle_high */ false,
/* pclk_active_high */ false,
/* pclk_idle_high */ false,
/* overscan_left */ 0
);

framebufferio_framebufferdisplay_obj_t *display = &allocate_display_or_raise()->framebuffer_display;
display->base.type = &framebufferio_framebufferdisplay_type;
common_hal_framebufferio_framebufferdisplay_construct(
display,
framebuffer,
0,
true
);
}

bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
// Keep the display enabled across resets.
if (pin_number == LCD_DISP_PIN) {
config_pin_as_output_with_level(pin_number, true);
return true;
}
return false;
}

// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ CIRCUITPY_ESP_PSRAM_FREQ = 200m
# The chip's only USB port goes to a USB-A host jack.
CIRCUITPY_USB_DEVICE = 0
CIRCUITPY_USB_HOST = 1

# 4.3 inch 800x480 RGB panel on the LCD connector
CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1
4 changes: 4 additions & 0 deletions ports/espressif/boards/espressif_esp32s31_korvo_1/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// SPDX-License-Identifier: MIT

#include "shared-bindings/board/__init__.h"
#include "shared-module/displayio/__init__.h"

static const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
Expand All @@ -23,5 +24,8 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
// USB-A host jack.
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DATA_PLUS), MP_ROM_PTR(&pin_USB_HS_DP) },
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DATA_MINUS), MP_ROM_PTR(&pin_USB_HS_DM) },

// 800x480 RGB panel on the LCD connector.
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
Loading