Add Adafruit TFT Experiment (rev A)
There will be a revision but get the basics in for now. This successfully displays on a TL040HDS20-B1502A screen with: ``` import board from framebufferio import FramebufferDisplay from dotclockframebuffer import DotClockFramebuffer from displayio import release_displays tft_pins = board.TFT tft_timings = { "frequency": 6_500_000, "width": 720, "height": 720, "hsync_pulse_width": 20, "hsync_front_porch": 40, "hsync_back_porch": 40, "vsync_pulse_width": 10, "vsync_front_porch": 40, "vsync_back_porch": 40, "hsync_idle_low": False, "vsync_idle_low": False, "de_idle_high": False, "pclk_active_high": False, "pclk_idle_high": False, } release_displays() fb = DotClockFramebuffer(**tft_pins, **tft_timings) disp = FramebufferDisplay(fb) ```
This commit is contained in:
parent
7dbf9a9b56
commit
1ef4e3c738
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "supervisor/board.h"
|
||||||
|
#include "mpconfigboard.h"
|
||||||
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
|
||||||
|
void board_init(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Micropython setup
|
||||||
|
|
||||||
|
#define MICROPY_HW_BOARD_NAME "Adafruit-ESP32-S3-RGB-TFT-Experiment"
|
||||||
|
#define MICROPY_HW_MCU_NAME "ESP32S3"
|
||||||
|
|
||||||
|
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3)
|
||||||
|
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO6)
|
||||||
|
|
||||||
|
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO7)
|
||||||
|
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO6)
|
||||||
|
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO16)
|
||||||
|
|
||||||
|
// UART pins attached to the USB-serial converter chip
|
||||||
|
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43)
|
||||||
|
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44)
|
||||||
|
|
||||||
|
#define MICROPY_HW_NEOPIXEL (&pin_GPIO4)
|
||||||
|
|
||||||
|
#define DOUBLE_TAP_PIN (&pin_GPIO5)
|
||||||
|
|
||||||
|
// a 1024x768 16BPP framebuffer + some breathing room
|
||||||
|
#define DEFAULT_RESERVED_PSRAM (1024 * 1024 * 2)
|
@ -0,0 +1,12 @@
|
|||||||
|
USB_VID = 0x239A
|
||||||
|
USB_PID = 0x8148
|
||||||
|
USB_PRODUCT = "Adafruit-ESP32-S3-RGB-TFT-Experiment"
|
||||||
|
USB_MANUFACTURER = "Adafruit"
|
||||||
|
|
||||||
|
IDF_TARGET = esp32s3
|
||||||
|
|
||||||
|
CIRCUITPY_ESP_FLASH_MODE = dio
|
||||||
|
CIRCUITPY_ESP_FLASH_FREQ = 80m
|
||||||
|
CIRCUITPY_ESP_FLASH_SIZE = 16MB
|
||||||
|
|
||||||
|
CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1
|
@ -0,0 +1,80 @@
|
|||||||
|
#include "py/objtuple.h"
|
||||||
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
|
STATIC const mp_rom_obj_tuple_t tft_r_pins = {
|
||||||
|
{&mp_type_tuple},
|
||||||
|
5,
|
||||||
|
{
|
||||||
|
MP_ROM_PTR(&pin_GPIO13),
|
||||||
|
MP_ROM_PTR(&pin_GPIO12),
|
||||||
|
MP_ROM_PTR(&pin_GPIO11),
|
||||||
|
MP_ROM_PTR(&pin_GPIO10),
|
||||||
|
MP_ROM_PTR(&pin_GPIO46),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
STATIC const mp_rom_obj_tuple_t tft_g_pins = {
|
||||||
|
{&mp_type_tuple},
|
||||||
|
6,
|
||||||
|
{
|
||||||
|
MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b
|
||||||
|
MP_ROM_PTR(&pin_GPIO45),
|
||||||
|
MP_ROM_PTR(&pin_GPIO48),
|
||||||
|
MP_ROM_PTR(&pin_GPIO47),
|
||||||
|
MP_ROM_PTR(&pin_GPIO21),
|
||||||
|
MP_ROM_PTR(&pin_GPIO14),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
STATIC const mp_rom_obj_tuple_t tft_b_pins = {
|
||||||
|
{&mp_type_tuple},
|
||||||
|
5,
|
||||||
|
{
|
||||||
|
MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b
|
||||||
|
MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b
|
||||||
|
MP_ROM_PTR(&pin_GPIO40),
|
||||||
|
MP_ROM_PTR(&pin_GPIO39),
|
||||||
|
MP_ROM_PTR(&pin_GPIO38),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
STATIC const mp_rom_map_elem_t tft_table[] = {
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO2) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO42) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO41) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_dclk), MP_ROM_PTR(&pin_GPIO1) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_red), MP_ROM_PTR(&tft_r_pins) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_green), MP_ROM_PTR(&tft_g_pins) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_blue), MP_ROM_PTR(&tft_b_pins) },
|
||||||
|
};
|
||||||
|
MP_DEFINE_CONST_DICT(tft_dict, tft_table);
|
||||||
|
|
||||||
|
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||||
|
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||||
|
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_TFT), MP_ROM_PTR(&tft_dict) },
|
||||||
|
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(MICROPY_HW_NEOPIXEL) },
|
||||||
|
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
|
||||||
|
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SDA) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SCL) },
|
||||||
|
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(DEFAULT_SPI_BUS_MOSI) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(DEFAULT_SPI_BUS_MISO) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(DEFAULT_SPI_BUS_SCK) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO16) },
|
||||||
|
|
||||||
|
// boot mode button can be used in SW as well
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_BUTTON_UP), MP_ROM_PTR(&pin_GPIO0) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_BUTTON_DOWN), MP_ROM_PTR(&pin_GPIO5) },
|
||||||
|
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_TP_IRQ), MP_ROM_PTR(&pin_GPIO9) },
|
||||||
|
|
||||||
|
{ 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_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||||
|
};
|
||||||
|
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
@ -0,0 +1,41 @@
|
|||||||
|
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||||
|
#
|
||||||
|
# SPI RAM config
|
||||||
|
#
|
||||||
|
# CONFIG_SPIRAM_MODE_QUAD is not set
|
||||||
|
CONFIG_SPIRAM_MODE_OCT=y
|
||||||
|
CONFIG_SPIRAM_TYPE_AUTO=y
|
||||||
|
# end of SPI RAM config
|
||||||
|
|
||||||
|
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||||
|
#
|
||||||
|
# PSRAM Clock and CS IO for ESP32S3
|
||||||
|
#
|
||||||
|
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||||
|
# end of PSRAM Clock and CS IO for ESP32S3
|
||||||
|
|
||||||
|
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||||
|
# CONFIG_SPIRAM_RODATA is not set
|
||||||
|
CONFIG_SPIRAM_SPEED_80M=y
|
||||||
|
# CONFIG_SPIRAM_SPEED_40M is not set
|
||||||
|
CONFIG_SPIRAM=y
|
||||||
|
CONFIG_SPIRAM_BOOT_INIT=y
|
||||||
|
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||||
|
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||||
|
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||||
|
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||||
|
CONFIG_SPIRAM_MEMTEST=y
|
||||||
|
#
|
||||||
|
# LWIP
|
||||||
|
#
|
||||||
|
CONFIG_LWIP_LOCAL_HOSTNAME="matouch-tft"
|
||||||
|
# end of LWIP
|
||||||
|
#
|
||||||
|
# CONFIG_ESP_CONSOLE_NONE is not set
|
||||||
|
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
||||||
|
CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
|
||||||
|
CONFIG_ESP_CONSOLE_UART_CUSTOM=y
|
||||||
|
CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||||
|
CONFIG_ESP_CONSOLE_UART_RX_GPIO=44
|
||||||
|
CONFIG_ESP_CONSOLE_UART_TX_GPIO=43
|
||||||
|
CONFIG_ESP_CONSOLE_UART=y
|
Loading…
Reference in New Issue
Block a user