-
-
Notifications
You must be signed in to change notification settings - Fork 55
How to add new display to the library
Aleksei edited this page Dec 15, 2019
·
2 revisions
lcdgfx code for all displays is generated automatically by tools/lcd_code_generator.py
script:
cd tools && ./lcd_code_generator.py all
So, to add new display to the library, you need to describe your display for the python script: create json file. All json files are located in tools/templates/lcd
folder.
{
"il9163": # display name you want to use in c++ code
{
"options": # options, which define specific display behvaior
{
"no_bits_in_name": false, # do not use bits mode in generated display name: il9163_128x128x16 (true) or il9163_128x128 (false)
"rowcol_bits": 16, # number of bits, used in column or row addressing: refer to display datasheet
"args_in_cmd_mode": false, # true if command arguments should be passed in command mode.
"col_cmd": "0x2A", # set column range command (refer to datasheet)
"column_div": 1, # dividend for x-position. For most displays it should be 1.
"row_cmd": "0x2B", # set row range command (refer to datasheet)
"reset_duration": 20, # duration in milliseconds to hold reset line
"reset_delay": 120, # duration to wait after releasing reset line before sending any command
"exit_cmd_mode_command": "0x2C" # special command for exiting from command mode. Not required for many displays
},
"functions": # list of custom functions. This section allows to redefine standard functions
{
"interface_list": ["setRotation"], # list of new display specific functions
"setRotation": {}
},
"interfaces": # list of interfaces, supported by display
{
"spi": # spi section
{
"frequency": 8000000 # maximum supported frequency
}
},
"bits": # list of bit-modes supported by display
{
"16": # Each such section contains list of resolutions, supported by display controller
{
"128x128":
{
"init": # init section describes list of initialization commands, this list supports some special commands
[
"#ifdef SDL_EMULATION", # SDL_EMULATION can be skipped if no emulator is supported
" SDL_LCD_IL9163, 0x00,",
" 0x00, 0x00,",
"#endif",
# each command includes:
# 1. op-code from display datasheet;
# 2. number, specifying count of arguments;
# 3. list of arguments if any
" 0x11, 0x00, # exit sleep mode",
" 0x3A, 0x01, 0x05, # set 16-bit pixel format",
" 0x26, 0x01, 0x04, # set gamma curve: valid values 1, 2, 4, 8",
" 0xC0, 0x02, 0x0A, 0x02, # power control 1",
" 0xC1, 0x01, 0x02, # power control 2",
" 0xC5, 0x02, 0x50, 0x5B, # vcom control 1",
" 0xC7, 0x01, 0x40, # vcom offset",
" 0x36, 0x01, 0b00000000, # Horizontal addressing mode",
" 0x29, 0x00,"
]
},
"128x160":
{
"init":
[
"#ifdef SDL_EMULATION",
" SDL_LCD_IL9163, 0x00,",
" 0b00000011, 0x00,",
"#endif",
" 0x11, 0x00, # exit sleep mode",
" 0x3A, 0x01, 0x05, # set 16-bit pixel format",
" 0x26, 0x01, 0x04, # set gamma curve: valid values 1, 2, 4, 8",
" 0xC0, 0x02, 0x0A, 0x02, # power control 1",
" 0xC1, 0x01, 0x02, # power control 2",
" 0xC5, 0x02, 0x50, 0x5B, # vcom control 1",
" 0xC7, 0x01, 0x40, # vcom offset",
" 0x36, 0x01, 0b00000000, # Horizontal addressing mode",
" 0x29, 0x00"
]
}
}
}
}
}