diff --git a/.gitignore b/.gitignore index c6127b3..38eeab7 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,9 @@ modules.order Module.symvers Mkfile.old dkms.conf + +# MacOS +.DS_Store + +# ESP-IDF build dir +build diff --git a/lvgl_tft/EVE_commands.h b/lvgl_tft/EVE_commands.h index 7377a7f..aa9d061 100644 --- a/lvgl_tft/EVE_commands.h +++ b/lvgl_tft/EVE_commands.h @@ -68,7 +68,7 @@ void EVE_get_cmdoffset(void); /* commands to operate on memory: */ void EVE_cmd_memzero(uint32_t ptr, uint32_t num); void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num); -void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *data); +void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *data); void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num); #if FT81X_FULL diff --git a/lvgl_tft/FT81x.c b/lvgl_tft/FT81x.c index 4afc52b..63e0dee 100644 --- a/lvgl_tft/FT81x.c +++ b/lvgl_tft/FT81x.c @@ -250,7 +250,7 @@ void TFT_bitmap_display(void) EVE_cmd_dl(TAG(0)); EVE_cmd_dl(DL_DISPLAY); /* instruct the graphics processor to show the list */ - + EVE_cmd_dl(CMD_SWAP); /* make this list active */ EVE_end_cmd_burst(); /* stop writing to the cmd-fifo */ @@ -273,7 +273,7 @@ void FT81x_init(void) #endif spi_acquire(); - + if(EVE_init()) { tft_active = 1; @@ -284,7 +284,7 @@ void FT81x_init(void) EVE_cmd_memset(SCREEN_BITMAP_ADDR, BLACK, SCREEN_BUFFER_SIZE); // clear screen buffer EVE_cmd_execute(); - + TFT_bitmap_display(); // set DL for fullscreen bitmap display } @@ -326,4 +326,4 @@ void TFT_WriteBitmap(uint8_t* Bitmap, uint16_t X, uint16_t Y, uint16_t Width, ui void FT81x_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map) { TFT_WriteBitmap((uint8_t*)color_map, area->x1, area->y1, lv_area_get_width(area), lv_area_get_height(area)); -} \ No newline at end of file +} diff --git a/lvgl_tft/GC9A01.c b/lvgl_tft/GC9A01.c index 525efc9..6f32051 100644 --- a/lvgl_tft/GC9A01.c +++ b/lvgl_tft/GC9A01.c @@ -173,7 +173,7 @@ void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo uint8_t data[4]; /*Column addresses*/ - GC9A01_send_cmd(0x2A); //0x2A + GC9A01_send_cmd(0x2A); //0x2A data[0] = (area->x1 >> 8) & 0xFF; data[1] = area->x1 & 0xFF; data[2] = (area->x2 >> 8) & 0xFF; @@ -181,7 +181,7 @@ void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo GC9A01_send_data(data, 4); /*Page addresses*/ - GC9A01_send_cmd(0x2B); //0x2B + GC9A01_send_cmd(0x2B); //0x2B data[0] = (area->y1 >> 8) & 0xFF; data[1] = area->y1 & 0xFF; data[2] = (area->y2 >> 8) & 0xFF; @@ -189,7 +189,7 @@ void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo GC9A01_send_data(data, 4); /*Memory write*/ - GC9A01_send_cmd(0x2C); //0x2C + GC9A01_send_cmd(0x2C); //0x2C uint32_t size = lv_area_get_width(area) * lv_area_get_height(area); @@ -217,7 +217,7 @@ void GC9A01_sleep_in() { uint8_t data[] = {0x08}; GC9A01_send_cmd(0x10); //0x10 Enter Sleep Mode - GC9A01_send_data(&data, 1); + GC9A01_send_data(&data, 1); } void GC9A01_sleep_out() diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index d206393..01bb4ba 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -744,11 +744,11 @@ menu "LVGL TFT Display controller" config LV_DISP_ST7789_SOFT_RESET bool "Soft reset - use software reset instead of reset pin" - depends on LV_TFT_DISPLAY_CONTROLLER_ST7789 + depends on LV_TFT_DISPLAY_CONTROLLER_ST7789 default n help Use software reset and ignores configured reset pin (some hardware does not use a reset pin). - + endmenu # menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y diff --git a/lvgl_tft/il3820.c b/lvgl_tft/il3820.c index 80358b2..fee39e2 100644 --- a/lvgl_tft/il3820.c +++ b/lvgl_tft/il3820.c @@ -73,9 +73,9 @@ static uint8_t il3820_lut_initial[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t il3820_lut_default[] = { - 0x10, 0x18, 0x18, 0x08, 0x18, 0x18, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x18, 0x18, 0x08, 0x18, 0x18, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -113,7 +113,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m uint8_t *buffer = (uint8_t*) color_map; uint16_t x_addr_counter = 0; uint16_t y_addr_counter = 0; - + /* Configure entry mode */ il3820_write_cmd(IL3820_CMD_ENTRY_MODE, &il3820_scan_mode, 1); @@ -131,7 +131,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m il3820_set_cursor(x_addr_counter, y_addr_counter); il3820_send_cmd(IL3820_CMD_WRITE_RAM); - + /* Write the pixel data to graphic RAM, linelen bytes at the time. */ for(size_t row = 0; row <= (EPD_PANEL_HEIGHT - 1); row++){ il3820_send_data(buffer, linelen); @@ -139,7 +139,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m } il3820_set_window(0, EPD_PANEL_WIDTH - 1, 0, EPD_PANEL_HEIGHT - 1); - + il3820_update_display(); /* IMPORTANT!!! @@ -152,7 +152,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m * BIT_SET(byte_index, bit_index) clears the bit_index pixel at byte_index of * the display buffer. * BIT_CLEAR(byte_index, bit_index) sets the bit_index pixel at the byte_index - * of the display buffer. */ + * of the display buffer. */ void il3820_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa) @@ -217,7 +217,7 @@ void il3820_init(void) /* Software reset */ il3820_write_cmd(IL3820_CMD_SW_RESET, NULL, 0); - + /* Busy wait for the BUSY signal to go low */ il3820_waitbusy(IL3820_WAIT); @@ -245,10 +245,10 @@ void il3820_init(void) // allow partial updates now il3820_partial = true; - + /* Update LUT */ il3820_write_cmd(IL3820_CMD_UPDATE_LUT, il3820_lut_default, sizeof(il3820_lut_default)); - + /* Clear control memory and update */ il3820_clear_cntlr_mem(IL3820_CMD_WRITE_RAM, true); } @@ -257,10 +257,10 @@ void il3820_init(void) void il3820_sleep_in(void) { uint8_t data[] = {0x01}; - + /* Wait for the BUSY signal to go low */ il3820_waitbusy(IL3820_WAIT); - + il3820_write_cmd(IL3820_CMD_SLEEP_MODE, data, 1); } @@ -270,15 +270,15 @@ static void il3820_waitbusy(int wait_ms) int i = 0; vTaskDelay(10 / portTICK_RATE_MS); // 10ms delay - + for(i = 0; i < (wait_ms * 10); i++) { if(gpio_get_level(IL3820_BUSY_PIN) != IL3820_BUSY_LEVEL) { return; } - + vTaskDelay(10 / portTICK_RATE_MS); } - + ESP_LOGE( TAG, "busy exceeded %dms", i*10 ); } @@ -294,10 +294,10 @@ static inline void il3820_data_mode(void) gpio_set_level(IL3820_DC_PIN, 1); } -static inline void il3820_write_cmd(uint8_t cmd, uint8_t *data, size_t len) +static inline void il3820_write_cmd(uint8_t cmd, uint8_t *data, size_t len) { disp_wait_for_pending_transactions(); - + il3820_command_mode(); disp_spi_send_data(&cmd, 1); @@ -308,10 +308,10 @@ static inline void il3820_write_cmd(uint8_t cmd, uint8_t *data, size_t len) } /* Send cmd to the display */ -static inline void il3820_send_cmd(uint8_t cmd) +static inline void il3820_send_cmd(uint8_t cmd) { disp_wait_for_pending_transactions(); - + il3820_command_mode(); disp_spi_send_data(&cmd, 1); } @@ -320,14 +320,14 @@ static inline void il3820_send_cmd(uint8_t cmd) static void il3820_send_data(uint8_t *data, uint16_t length) { disp_wait_for_pending_transactions(); - + il3820_data_mode(); disp_spi_send_colors(data, length); } /* Specify the start/end positions of the window address in the X and Y * directions by an address unit. - * + * * @param sx: X Start position. * @param ex: X End position. * @param ys: Y Start position. @@ -336,7 +336,7 @@ static void il3820_send_data(uint8_t *data, uint16_t length) static inline void il3820_set_window( uint16_t sx, uint16_t ex, uint16_t ys, uint16_t ye) { uint8_t tmp[4] = {0}; - + tmp[0] = sx / 8; tmp[1] = ex / 8; @@ -384,7 +384,7 @@ static void il3820_update_display(void) } else { tmp = (IL3820_CTRL2_ENABLE_CLK | IL3820_CTRL2_ENABLE_ANALOG | IL3820_CTRL2_TO_PATTERN); } - + il3820_write_cmd(IL3820_CMD_UPDATE_CTRL2, &tmp, 1); il3820_write_cmd(IL3820_CMD_MASTER_ACTIVATION, NULL, 0); @@ -400,10 +400,10 @@ static void il3820_clear_cntlr_mem(uint8_t ram_cmd, bool update) /* Arrays used by SPI must be word alligned */ WORD_ALIGNED_ATTR uint8_t clear_page[IL3820_COLUMNS]; memset(clear_page, 0xff, sizeof clear_page); - + /* Configure entry mode */ il3820_write_cmd(IL3820_CMD_ENTRY_MODE, &il3820_scan_mode, 1); - + /* Configure the window */ il3820_set_window(0, EPD_PANEL_WIDTH - 1, 0, EPD_PANEL_HEIGHT - 1); diff --git a/lvgl_tft/ili9486.c b/lvgl_tft/ili9486.c index dd82ac9..166bef8 100644 --- a/lvgl_tft/ili9486.c +++ b/lvgl_tft/ili9486.c @@ -60,8 +60,8 @@ void ili9486_init(void) {0xE0, {0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00}, 15}, {0XE1, {0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00}, 15}, {0x20, {0}, 0}, /* display inversion OFF */ - {0x36, {0x48}, 1}, - {0x29, {0}, 0x80}, /* display on */ + {0x36, {0x48}, 1}, + {0x29, {0}, 0x80}, /* display on */ {0x00, {0}, 0xff}, }; @@ -140,7 +140,7 @@ void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col ili9486_send_cmd(0x2C); size = lv_area_get_width(area) * lv_area_get_height(area); - + ili9486_send_color((void*) color_map, size * 2); } diff --git a/lvgl_tft/ili9488.c b/lvgl_tft/ili9488.c index 5379b77..ce8bba0 100644 --- a/lvgl_tft/ili9488.c +++ b/lvgl_tft/ili9488.c @@ -50,7 +50,7 @@ static void ili9488_send_color(void * data, uint16_t length); /********************** * GLOBAL FUNCTIONS **********************/ -// From github.com/jeremyjh/ESP32_TFT_library +// From github.com/jeremyjh/ESP32_TFT_library // From github.com/mvturnho/ILI9488-lvgl-ESP32-WROVER-B void ili9488_init(void) { @@ -102,7 +102,7 @@ void ili9488_init(void) // Exit sleep ili9488_send_cmd(0x01); /* Software reset */ vTaskDelay(100 / portTICK_RATE_MS); - + //Send all the commands uint16_t cmd = 0; while (ili_init_cmds[cmd].databytes!=0xff) { @@ -151,7 +151,7 @@ void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col (uint8_t) (area->x2 >> 8) & 0xFF, (uint8_t) (area->x2) & 0xFF, }; - + /* Page addresses */ uint8_t yb[] = { (uint8_t) (area->y1 >> 8) & 0xFF,