PROGMEM static const setting_table_t power_on_setting_table[] = {
{ILI9806_EXTCCSET,3, {0xFF, 0x98, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0},
{ILI9806_GIP1, 21, {0x03, 0x0F, 0x63, 0x69, 0x01, 0x01, 0x1B, 0x11, 0x70, 0x73, 0xFF, 0xFF, 0x08, 0x09, 0x05, 0x00, 0xEE, 0xE2, 0x01, 0x00, 0xC1}, 0}, // magic stuff happens here
{ILI9806_GIP2, 8, {0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0},
{ILI9806_GIP3, 9, {0x00, 0x22, 0x27, 0x6A, 0xBC, 0xD8, 0x92, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0},
{ILI9806_VCCTRL1, 1, {0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // VCOM Control 1
{ILI9806_VOLTMSET,3, {0x7F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0},
{ILI9806_PCTRL1, 3, {0xE3, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Power Control 1
{ILI9806_LVGLVSET,1, {0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // LVGL Voltage Setting
{ILI9806_ENGSET, 6, {0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Engineering Setting
{ILI9806_DVDDVSET,1, {0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // DVDD Voltage Setting
{ILI9806_DINVCTRL,3, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Display Inversion Control
{ILI9806_PRSSET, 1, {ILI9806_R480x854, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Panel Resolution Selection Set 480x854 resolution
{ILI9806_FRCTRL1, 3, {0x00, 0x10, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Frame Rate Control 1
{ILI9806_PTCTRL1, 3, {0x29, 0x8A, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Panel Timing Control 1
{ILI9806_PTCTRL2, 4, {0x40, 0xD2, 0x50, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Panel Timing Control 2
{ILI9806_PCTRL2, 4, {0x17, 0X85, 0x85, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Power Control 2
{ILI9806_PGCTRL, 16, {0x00, 0x0C, 0x15, 0x0D, 0x0F, 0x0C, 0x07, 0x05, 0x07, 0x0B, 0x10, 0x10, 0x0D, 0x17, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Positive Gamma Control
{ILI9806_NGCTRL, 16, {0x00, 0x0D, 0x15, 0x0E, 0x10, 0x0D, 0x08, 0x06, 0x07, 0x0C, 0x11, 0x11, 0x0E, 0x17, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Negative Gamma Correction
{ILI9806_TREFLON, 1, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0}, // Tearing Effect Line ON
{ILI9806_MADCTL, 1, {ILI9806_IXFORMAT, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 30},
{ILI9806_VSCROLLS,1, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0},
{ILI9806_CASET, 1, {0x00, 0x00, 0x03, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0},
{ILI9806_PASET, 1, {0x00, 0x00, 0x01, 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0},
{ILI9806_IPIXFOR, 1, {0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 30},
{ILI9806_SLPOUT, 0, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 120}, // Exit Sleep
{ILI9806_DISLYON, 0, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 50} // Display On
};
#define ILI9806_R480x864 0x80
#define ILI9806_R480x854 0x81
#define ILI9806_R480x640 0x82
#define ILI9806_R480x720 0x84
#define ILI9806_NOP 0x00 // No Op, also reset write state (acording to PDF)
#define ILI9806_SOFTRST 0x01 // Software reset
#define ILI9806_SLPOUT 0x11 // Sleep out (Exit sleep)
#define ILI9806_DISLYON 0x29 // Display ON
#define ILI9806_CASET 0x2A // Column Address Set
#define ILI9806_PASET 0x2B // Page Address Set
#define ILI9806_RAMWR 0x2C // Memory Write
#define ILI9806_RAMRD 0x2E // Memory Read
#define ILI9806_TREFLON 0x35 // Tearing Effect Line ON
#define ILI9806_VSCROLLS 0x37 // Vertical Scrolling Start Address
#define ILI9806_IPIXFOR 0x3A // Interface Pixel Format
#define ILI9806_FRCTRL1 0xB1 // Frame Rate Control 1
#define ILI9806_FRCTRL2 0xB2 // Frame Rate Control 2
#define ILI9806_DINVCTRL 0xB4 // Display Inversion Control
#define ILI9806_MADCTL 0xB9 // PANELCTRL. doesn't respond to 0x36 dispite pdf indicating so
#define ILI9806_GIP1 0xBC // GIP 1
#define ILI9806_GIP2 0xBD // GIP 2
#define ILI9806_GIP3 0xBE // GIP 3
#define ILI9806_PCTRL1 0xC0 // Power Control 1
#define ILI9806_PCTRL2 0xC1 // Power Control 2
#define ILI9806_VCCTRL1 0xC7 // VCOM Control 1
#define ILI9806_BLCTRL1 0xC8 // Backlight Control 2
#define ILI9806_ENGSET 0xDF // Engineering Setting
#define ILI9806_PGCTRL 0xE0 // Positive Gamma Control
#define ILI9806_NGCTRL 0xE1 // Negative Gamma Control
#define ILI9806_VOLTMSET 0xED // VGMP / VGMN / VGSP / VGSN Voltage Measurement Set
#define ILI9806_PTCTRL1 0xF1 // Panel Timing Control 1
#define ILI9806_PTCTRL2 0xF2 // Panel Timing Control 2
#define ILI9806_DVDDVSET 0xF3 // DVDD Voltage Setting
#define ILI9806_PRSSET 0xF7 // Panel Resolution Selection Set
#define ILI9806_LVGLVSET 0xFC // LVGL Voltage Setting
#define ILI9806_EXTCCSET 0xFF
#define MADCTL_RGB 0x00 // Red-Green-Blue pixel order
#define MADCTL_GS 0x01
#define MADCTL_SS 0x02
#define MADCTL_MH 0x04 // LCD refresh right to left
#define MADCTL_BGR 0x08 // Blue-Green-Red pixel order
#define MADCTL_ML 0x10 // LCD refresh Bottom to top
#define MADCTL_MV 0x20 // Row/Column exchange
#define MADCTL_MX 0x40 // Right to left
#define MADCTL_MY 0x80 // Bottom to top