Skip to content

Commit 5ae2909

Browse files
authored
Merge pull request #8625 from RetiredWizard/matouch1024
Updates for Makerfabs TFT 7" touch dotclock panel
2 parents 1374a15 + 7bcb95a commit 5ae2909

File tree

3 files changed

+46
-15
lines changed

3 files changed

+46
-15
lines changed

ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
USB_VID = 0x239A
2-
USB_PID = 0x814A
1+
USB_VID = 0x303A
2+
USB_PID = 0x81BF
33
USB_PRODUCT = "MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch"
44
USB_MANUFACTURER = "MakerFabs"
55

@@ -14,3 +14,13 @@ CIRCUITPY_ESP_PSRAM_MODE = opi
1414
CIRCUITPY_ESP_PSRAM_FREQ = 80m
1515

1616
CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1
17+
18+
# To build with USB disabled allowing access to I2S pins
19+
#CIRCUITPY_CREATOR_ID = 0x000C303A
20+
#CIRCUITPY_CREATION_ID = 0x00A30001
21+
#CIRCUITPY_USB=0
22+
#CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
23+
#UF2_BOOTLOADER = 1
24+
#CIRCUITPY_WIFI=1
25+
#CIRCUITPY_WEB_WORKFLOW=1
26+
#OPTIMIZATION_FLAGS = -Os

ports/espressif/boards/makerfabs_tft7/pins.c

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,43 @@ STATIC const mp_rom_map_elem_t timings800_table[] = {
6767
};
6868
MP_DEFINE_CONST_DICT(timings800_dict, timings800_table);
6969

70+
STATIC const mp_rom_map_elem_t timings1024_table[] = {
71+
{ MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(10000000) }, // nominal 16MHz, but display is unstable/tears at that frequency
72+
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_INT(1024) },
73+
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_INT(600) },
74+
{ MP_ROM_QSTR(MP_QSTR_hsync_pulse_width), MP_ROM_INT(30) },
75+
{ MP_ROM_QSTR(MP_QSTR_hsync_front_porch), MP_ROM_INT(210) },
76+
{ MP_ROM_QSTR(MP_QSTR_hsync_back_porch), MP_ROM_INT(16) },
77+
{ MP_ROM_QSTR(MP_QSTR_hsync_idle_low), MP_ROM_FALSE },
78+
{ MP_ROM_QSTR(MP_QSTR_vsync_pulse_width), MP_ROM_INT(13) },
79+
{ MP_ROM_QSTR(MP_QSTR_vsync_front_porch), MP_ROM_INT(22) },
80+
{ MP_ROM_QSTR(MP_QSTR_vsync_back_porch), MP_ROM_INT(10) },
81+
{ MP_ROM_QSTR(MP_QSTR_vsync_idle_low), MP_ROM_FALSE },
82+
{ MP_ROM_QSTR(MP_QSTR_de_idle_high), MP_ROM_FALSE },
83+
{ MP_ROM_QSTR(MP_QSTR_pclk_active_high), MP_ROM_FALSE },
84+
{ MP_ROM_QSTR(MP_QSTR_pclk_idle_high), MP_ROM_FALSE },
85+
};
86+
MP_DEFINE_CONST_DICT(timings1024_dict, timings1024_table);
87+
7088
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
7189
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
7290

7391
{ MP_ROM_QSTR(MP_QSTR_TFT_PINS), MP_ROM_PTR(&tft_pins_dict) },
7492
{ MP_ROM_QSTR(MP_QSTR_TFT_TIMINGS), MP_ROM_PTR(&timings800_dict) },
93+
{ MP_ROM_QSTR(MP_QSTR_TFT_TIMINGS800), MP_ROM_PTR(&timings800_dict) },
94+
{ MP_ROM_QSTR(MP_QSTR_TFT_TIMINGS1024), MP_ROM_PTR(&timings1024_dict) },
7595
{ MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO10) },
7696

7797
// GPIO pins available on Mabee connector port (also shared with I2S & USB D+/D-)
7898
{ MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO20) },
7999
{ MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO19) },
80100

101+
// I2S pins are shared with USB D+/D-, these are only useful if USB is disabled
102+
#if CIRCUITPY_USB == 0
81103
{ MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO20) },
82104
{ MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO2) },
83105
{ MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO19) },
106+
#endif
84107

85108
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) },
86109
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
@@ -89,16 +112,16 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
89112
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO17) },
90113
{ MP_ROM_QSTR(MP_QSTR_TOUCH_RESET), MP_ROM_PTR(&pin_GPIO38) },
91114

92-
{ MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_GPIO11) },
93-
{ MP_ROM_QSTR(MP_QSTR_SDIO_D0), MP_ROM_PTR(&pin_GPIO13) },
94-
{ MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_GPIO12) },
115+
// IO10 <> SD_CS is cut at factory (non-placed resistor position R34) and pulled up.
116+
// Permanent SDIO 1-bit mode?
117+
// Until SDIO 1-bit mode is support on Espressif ports these pins aren't useful
118+
// { MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_GPIO11) },
119+
// { MP_ROM_QSTR(MP_QSTR_SDIO_D0), MP_ROM_PTR(&pin_GPIO13) },
120+
// { MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_GPIO12) },
95121

96122
// boot mode button can be used in SW as well
97123
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO1) },
98124

99-
// IO10 <> SD_CS is cut at factory (non-placed resistor position R34) and pulled up.
100-
// Permanent SDIO 1-bit mode?
101-
102125
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
103126
};
104127
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/espressif/common-hal/microcontroller/Pin.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,15 @@ static const uint64_t pin_mask_reset_forbidden =
173173
GPIO_SEL_23 |
174174
GPIO_SEL_24 |
175175
#endif
176-
#endif // ESP32C6
176+
#endif // ESP32H2
177177

178178
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
179-
// Never ever reset pins used to communicate with SPI flash and PSRAM.
179+
#if CIRCUITPY_USB
180+
// Never ever reset USB pins.
180181
GPIO_SEL_19 | // USB D-
181182
GPIO_SEL_20 | // USB D+
183+
#endif
184+
// Never ever reset pins used to communicate with SPI flash and PSRAM.
182185
#if defined(CONFIG_ESP32_SPIRAM_SUPPORT) || defined(CONFIG_ESP32S2_SPIRAM_SUPPORT) || defined(CONFIG_ESP32S3_SPIRAM_SUPPORT)
183186
// Note ESP32-C3 does not have SPIRAM support.
184187
// Board uses PSRAM, and needs another chip select.
@@ -198,11 +201,6 @@ static const uint64_t pin_mask_reset_forbidden =
198201
GPIO_SEL_36 | // SPIIO7
199202
GPIO_SEL_37 | // SPIDQS
200203
#endif
201-
#if CIRCUITPY_USB
202-
// Never ever reset USB pins.
203-
GPIO_SEL_19 | // USB D-
204-
GPIO_SEL_20 | // USB D+
205-
#endif
206204
#if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) && CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0
207205
// Don't reset/use the IDF UART console.
208206
GPIO_SEL_43 | // UART TX

0 commit comments

Comments
 (0)