Skip to content

Commit e79e83e

Browse files
committed
add lilygo T-QT Pro, two variants with shared PID
1 parent ca0eec3 commit e79e83e

File tree

11 files changed

+381
-0
lines changed

11 files changed

+381
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "supervisor/board.h"
8+
#include "mpconfigboard.h"
9+
#include "shared-bindings/busio/SPI.h"
10+
#include "shared-bindings/fourwire/FourWire.h"
11+
#include "shared-bindings/microcontroller/Pin.h"
12+
#include "shared-module/displayio/__init__.h"
13+
#include "shared-module/displayio/mipi_constants.h"
14+
#include "shared-bindings/board/__init__.h"
15+
16+
17+
#define DELAY 0x80
18+
19+
// display init sequence according to LilyGO example app
20+
uint8_t display_init_sequence[] = {
21+
// sw reset
22+
0x01, 0 | DELAY, 150,
23+
// sleep out
24+
0x11, 0 | DELAY, 255,
25+
// normal display mode on
26+
0x13, 0,
27+
// display and color format settings
28+
0x36, 1, 0x68,
29+
0xB6, 2, 0x0A, 0x82,
30+
0x3A, 1 | DELAY, 0x55, 10,
31+
// ST7789V frame rate setting
32+
0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33,
33+
// voltages: VGH / VGL
34+
0xB7, 1, 0x35,
35+
// ST7789V power setting
36+
0xBB, 1, 0x28,
37+
0xC0, 1, 0x0C,
38+
0xC2, 2, 0x01, 0xFF,
39+
0xC3, 1, 0x10,
40+
0xC4, 1, 0x20,
41+
0xC6, 1, 0x0F,
42+
0xD0, 2, 0xA4, 0xA1,
43+
// ST7789V gamma setting
44+
0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17,
45+
0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E,
46+
0x21, 0,
47+
// display on
48+
0x29, 0 | DELAY, 255,
49+
};
50+
51+
52+
void board_init(void) {
53+
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
54+
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
55+
bus->base.type = &fourwire_fourwire_type;
56+
57+
common_hal_fourwire_fourwire_construct(
58+
bus,
59+
spi,
60+
&pin_GPIO6, // DC
61+
&pin_GPIO5, // CS
62+
&pin_GPIO1, // RST
63+
40000000, // baudrate
64+
0, // polarity
65+
0 // phase
66+
);
67+
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
68+
display->base.type = &busdisplay_busdisplay_type;
69+
70+
common_hal_busdisplay_busdisplay_construct(
71+
display,
72+
bus,
73+
128, // width (after rotation)
74+
128, // height (after rotation)
75+
1, // column start
76+
2, // row start
77+
90, // rotation
78+
16, // color depth
79+
false, // grayscale
80+
false, // pixels in a byte share a row. Only valid for depths < 8
81+
1, // bytes per cell. Only valid for depths < 8
82+
false, // reverse_pixels_in_byte. Only valid for depths < 8
83+
true, // reverse_pixels_in_word
84+
MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command
85+
MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command
86+
MIPI_COMMAND_WRITE_MEMORY_START, // write memory command
87+
display_init_sequence,
88+
sizeof(display_init_sequence),
89+
&pin_GPIO10, // backlight pin
90+
NO_BRIGHTNESS_COMMAND,
91+
1.0f, // brightness
92+
false, // single_byte_bounds
93+
false, // data_as_commands
94+
true, // auto_refresh
95+
60, // native_frames_per_second
96+
false, // backlight_on_high
97+
false, // SH1107_addressing
98+
50000 // backlight pwm frequency
99+
);
100+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
// Micropython setup
10+
11+
#define MICROPY_HW_BOARD_NAME "LILYGO T-QT PRO NO PSRAM"
12+
#define MICROPY_HW_MCU_NAME "ESP32S3"
13+
14+
#define CIRCUITPY_BOARD_I2C (1)
15+
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO44, .sda = &pin_GPIO43}}
16+
17+
#define CIRCUITPY_BOARD_SPI (1)
18+
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO3, .mosi = &pin_GPIO2}}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
USB_VID = 0x303a
2+
USB_PID = 0x8154
3+
USB_PRODUCT = "T-QT PRO NO PSRAM"
4+
USB_MANUFACTURER = "LILYGO"
5+
6+
IDF_TARGET = esp32s3
7+
8+
CIRCUITPY_ESP_FLASH_MODE = qio
9+
CIRCUITPY_ESP_FLASH_FREQ = 80m
10+
CIRCUITPY_ESP_FLASH_SIZE = 8MB
11+
12+
CIRCUITPY_ESPCAMERA = 0
13+
# Not enough pins.
14+
CIRCUITPY_PARALLELDISPLAYBUS = 0
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "shared-bindings/board/__init__.h"
8+
#include "shared-module/displayio/__init__.h"
9+
10+
static const mp_rom_map_elem_t board_module_globals_table[] = {
11+
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
12+
13+
// front buttons
14+
{ MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_GPIO0) },
15+
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
16+
17+
{ MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_GPIO47) },
18+
{ MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) },
19+
20+
// Left side top to bottom
21+
{ MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },
22+
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },
23+
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
24+
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
25+
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },
26+
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },
27+
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },
28+
29+
// Right side top to bottom
30+
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
31+
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
32+
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
33+
{ MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) },
34+
35+
// Stemma QT port
36+
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },
37+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO43) },
38+
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
39+
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO44) },
40+
41+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
42+
{ MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) },
43+
44+
// 0.85 inch LCD GC9107
45+
{ MP_ROM_QSTR(MP_QSTR_LCD_BCKL), MP_ROM_PTR(&pin_GPIO10) },
46+
{ MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO6) },
47+
{ MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) },
48+
{ MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO3) },
49+
{ MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO2) },
50+
{ MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO1) },
51+
52+
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
53+
{ MP_ROM_QSTR(MP_QSTR_LCD_SPI), MP_ROM_PTR(&board_spi_obj) },
54+
55+
};
56+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/espressif/boards/lilygo_tqt_pro_nopsram/sdkconfig

Whitespace-only changes.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "supervisor/board.h"
8+
#include "mpconfigboard.h"
9+
#include "shared-bindings/busio/SPI.h"
10+
#include "shared-bindings/fourwire/FourWire.h"
11+
#include "shared-bindings/microcontroller/Pin.h"
12+
#include "shared-module/displayio/__init__.h"
13+
#include "shared-module/displayio/mipi_constants.h"
14+
#include "shared-bindings/board/__init__.h"
15+
16+
17+
#define DELAY 0x80
18+
19+
// display init sequence according to LilyGO example app
20+
uint8_t display_init_sequence[] = {
21+
// sw reset
22+
0x01, 0 | DELAY, 150,
23+
// sleep out
24+
0x11, 0 | DELAY, 255,
25+
// normal display mode on
26+
0x13, 0,
27+
// display and color format settings
28+
0x36, 1, 0x68,
29+
0xB6, 2, 0x0A, 0x82,
30+
0x3A, 1 | DELAY, 0x55, 10,
31+
// ST7789V frame rate setting
32+
0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33,
33+
// voltages: VGH / VGL
34+
0xB7, 1, 0x35,
35+
// ST7789V power setting
36+
0xBB, 1, 0x28,
37+
0xC0, 1, 0x0C,
38+
0xC2, 2, 0x01, 0xFF,
39+
0xC3, 1, 0x10,
40+
0xC4, 1, 0x20,
41+
0xC6, 1, 0x0F,
42+
0xD0, 2, 0xA4, 0xA1,
43+
// ST7789V gamma setting
44+
0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17,
45+
0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E,
46+
0x21, 0,
47+
// display on
48+
0x29, 0 | DELAY, 255,
49+
};
50+
51+
52+
void board_init(void) {
53+
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
54+
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
55+
bus->base.type = &fourwire_fourwire_type;
56+
57+
common_hal_fourwire_fourwire_construct(
58+
bus,
59+
spi,
60+
&pin_GPIO6, // DC
61+
&pin_GPIO5, // CS
62+
&pin_GPIO1, // RST
63+
40000000, // baudrate
64+
0, // polarity
65+
0 // phase
66+
);
67+
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
68+
display->base.type = &busdisplay_busdisplay_type;
69+
70+
common_hal_busdisplay_busdisplay_construct(
71+
display,
72+
bus,
73+
128, // width (after rotation)
74+
128, // height (after rotation)
75+
1, // column start
76+
2, // row start
77+
90, // rotation
78+
16, // color depth
79+
false, // grayscale
80+
false, // pixels in a byte share a row. Only valid for depths < 8
81+
1, // bytes per cell. Only valid for depths < 8
82+
false, // reverse_pixels_in_byte. Only valid for depths < 8
83+
true, // reverse_pixels_in_word
84+
MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command
85+
MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command
86+
MIPI_COMMAND_WRITE_MEMORY_START, // write memory command
87+
display_init_sequence,
88+
sizeof(display_init_sequence),
89+
&pin_GPIO10, // backlight pin
90+
NO_BRIGHTNESS_COMMAND,
91+
1.0f, // brightness
92+
false, // single_byte_bounds
93+
false, // data_as_commands
94+
true, // auto_refresh
95+
60, // native_frames_per_second
96+
false, // backlight_on_high
97+
false, // SH1107_addressing
98+
50000 // backlight pwm frequency
99+
);
100+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
// Micropython setup
10+
11+
#define MICROPY_HW_BOARD_NAME "LILYGO T-QT PRO PSRAM"
12+
#define MICROPY_HW_MCU_NAME "ESP32S3"
13+
14+
#define CIRCUITPY_BOARD_I2C (1)
15+
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO44, .sda = &pin_GPIO43}}
16+
17+
#define CIRCUITPY_BOARD_SPI (1)
18+
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO3, .mosi = &pin_GPIO2}}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
USB_VID = 0x303a
2+
USB_PID = 0x8154
3+
USB_PRODUCT = "T-QT PRO PSRAM"
4+
USB_MANUFACTURER = "LILYGO"
5+
6+
IDF_TARGET = esp32s3
7+
8+
CIRCUITPY_ESP_FLASH_SIZE = 4MB
9+
CIRCUITPY_ESP_FLASH_MODE = qio
10+
CIRCUITPY_ESP_FLASH_FREQ = 80m
11+
12+
CIRCUITPY_ESP_PSRAM_SIZE = 2MB
13+
CIRCUITPY_ESP_PSRAM_MODE = qio
14+
CIRCUITPY_ESP_PSRAM_FREQ = 80m
15+
16+
CIRCUITPY_ESPCAMERA = 0
17+
# Not enough pins.
18+
CIRCUITPY_PARALLELDISPLAYBUS = 0
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "shared-bindings/board/__init__.h"
8+
#include "shared-module/displayio/__init__.h"
9+
10+
static const mp_rom_map_elem_t board_module_globals_table[] = {
11+
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
12+
13+
// front buttons
14+
{ MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_GPIO0) },
15+
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
16+
17+
{ MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_GPIO47) },
18+
{ MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) },
19+
20+
// Left side top to bottom
21+
{ MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },
22+
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },
23+
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
24+
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
25+
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },
26+
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },
27+
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },
28+
29+
// Right side top to bottom
30+
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
31+
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
32+
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
33+
{ MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) },
34+
35+
// Stemma QT port
36+
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },
37+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO43) },
38+
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
39+
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO44) },
40+
41+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
42+
{ MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) },
43+
44+
// 0.85 inch LCD GC9107
45+
{ MP_ROM_QSTR(MP_QSTR_LCD_BCKL), MP_ROM_PTR(&pin_GPIO10) },
46+
{ MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO6) },
47+
{ MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) },
48+
{ MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO3) },
49+
{ MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO2) },
50+
{ MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO1) },
51+
52+
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
53+
{ MP_ROM_QSTR(MP_QSTR_LCD_SPI), MP_ROM_PTR(&board_spi_obj) },
54+
55+
};
56+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/espressif/boards/lilygo_tqt_pro_psram/sdkconfig

Whitespace-only changes.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy