Use a TOML file to configure custom boards
mainWhile not strictly required, using a .toml file is strongly recommended to tie together display and input device (indev) configurations. The TOML file allows you to define MCU settings, bus configurations (I80, I2C), devices, and drivers in a structured way.
TOML Structure Rules
[MCU.{target}]: Defines MCU-specific build parameters.{target}is your build target (e.g.,esp32).- Convert CLI flags: Remove leading
--and replace all-with_(e.g.,--octal-flashbecomesoctal_flash). - Case sensitivity: Options are case-sensitive.
- Strings: Wrap string values in double quotes (
"value"). - Booleans: Options that take no value must be set to
true. - Limitation:
DISPLAYandINDEVsections cannot be repeated; only one display and one indev can be supplied.
- Convert CLI flags: Remove leading
[{bus_type}.{variable_name}]: Defines a bus (e.g.,[I80Bus.display_bus]). This is converted into a constructor call likedisplay_bus = lcd_bus.I80Bus(...). The options listed under this heading must match the parameter names of the class being used.[I2C.Bus.{variable_name}]and[I2C.Device.{variable_name}]: Used to configure I2C buses and the devices attached to them.
[MCU.esp32]
BOARD = "ESP32_GENERIC_S3"
BOARD_VARIANT = "SPIRAM_OCT"
octal_flash = true
flash_size = 16
enable_jtag_repl = 'n'
enable_cdc_repl = 'n'
enable_uart_repl = 'y'
uart_repl_bitrate = 115200
[I80Bus.display_bus]
data0 = 9
data1 = 46
data2 = 3
data3 = 8
data4 = 18
data5 = 17
data6 = 16
data7 = 15
dc = 0
wr = 47
cs = -1
freq = 20000000
[I2C.Bus.i2c_bus]
host = 0
scl = 5
sda = 6
freq = 100000
[I2C.Device.indev_device]
bus = "i2c_bus"
dev_id = "ft6x36.I2C_ADDR"
reg_bits = "ft6x36.BITS"
[ST7796.display]
data_bus = "display_bus"
display_width = 320
display_height = 480
backlight_pin = 45
color_byte_order = "st7789.BYTE_ORDER_BGR"
color_space = "lv.COLOR_FORMAT.RGB565"
rgb565_byte_swap = true
[ST7796.display.init]
params = []
[FT6x36.indev]
device = "indev_device"
[display.set_color_inversion]
params = [true]
[display.set_rotation]
params = ["lv.DISPLAY_ROTATION._90"]
[display.set_backlight]
params = [100]
[task_handler.TaskHandler]
params=[]