Merge pull request #19 from lvgl/fix/update_lvgl_helpers

Fix/update lvgl helpers
This commit is contained in:
Carlos Diaz 2021-01-15 00:02:23 -06:00 committed by GitHub
commit ccb30922f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 39 additions and 80 deletions

View file

@ -28,7 +28,7 @@ extern "C" {
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107
#define DISP_BUF_SIZE (CONFIG_LV_DISPLAY_WIDTH*CONFIG_LV_DISPLAY_HEIGHT) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486
@ -38,20 +38,20 @@ extern "C" {
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 64) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 64)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306
#define DISP_BUF_SIZE (CONFIG_LV_DISPLAY_WIDTH*CONFIG_LV_DISPLAY_HEIGHT) #define DISP_BUF_SIZE (LV_HOR_RES_MAX*LV_VER_RES_MAX)
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X)
#define DISP_BUF_LINES 40 #define DISP_BUF_LINES 40
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * DISP_BUF_LINES) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * DISP_BUF_LINES)
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820) #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820)
#define DISP_BUF_SIZE (CONFIG_LV_DISPLAY_HEIGHT * IL3820_COLUMNS) #define DISP_BUF_SIZE (LV_VER_RES_MAX * IL3820_COLUMNS)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01) #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01)
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A) #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A)
#define DISP_BUF_SIZE ((CONFIG_LV_DISPLAY_HEIGHT * CONFIG_LV_DISPLAY_WIDTH) / 8) // 5KB #define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 5KB
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D) #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D)
#define DISP_BUF_SIZE ((CONFIG_LV_DISPLAY_HEIGHT * CONFIG_LV_DISPLAY_WIDTH) / 8) // 2888 bytes #define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 2888 bytes
#else #else
#error "No display controller selected" #error "No display controller selected"
#endif #endif

View file

@ -476,45 +476,6 @@ menu "LVGL TFT Display controller"
bool "I2C PORT 1" bool "I2C PORT 1"
endchoice endchoice
choice
prompt "Display orientation"
depends on LV_TFT_DISPLAY_CONTROLLER_ILI9341 || \
LV_TFT_DISPLAY_CONTROLLER_ILI9481 || \
LV_TFT_DISPLAY_CONTROLLER_ILI9486 || \
LV_TFT_DISPLAY_CONTROLLER_ILI9488 || \
LV_TFT_DISPLAY_CONTROLLER_SH1107 || \
LV_TFT_DISPLAY_CONTROLLER_SSD1306 || \
LV_TFT_DISPLAY_CONTROLLER_FT81X || \
LV_TFT_DISPLAY_CONTROLLER_ST7789 || \
LV_TFT_DISPLAY_CONTROLLER_GC9A01 || \
LV_TFT_DISPLAY_CONTROLLER_ST7735S || \
LV_TFT_DISPLAY_CONTROLLER_IL3820 || \
LV_TFT_DISPLAY_CONTROLLER_RA8875 || \
LV_TFT_DISPLAY_CONTROLLER_JD79653A || \
LV_TFT_DISPLAY_CONTROLLER_UC8151D
default LV_DISPLAY_ORIENTATION_LANDSCAPE \
if !LV_TFT_DISPLAY_CONTROLLER_JD79653A || \
!LV_TFT_DISPLAY_CONTROLLER_UC8151D
default LV_DISPLAY_ORIENTATION_PORTRAIT if LV_TFT_DISPLAY_CONTROLLER_JD79653A || LV_TFT_DISPLAY_CONTROLLER_UC8151D
help
Display orientation.
config LV_DISPLAY_ORIENTATION_PORTRAIT
bool "Portrait"
config LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED
bool "Inverted Portrait"
depends on !LV_TFT_DISPLAY_CONTROLLER_IL3820
config LV_DISPLAY_ORIENTATION_LANDSCAPE
bool "Landscape"
depends on !LV_TFT_DISPLAY_CONTROLLER_JD79653A
depends on !LV_TFT_DISPLAY_CONTROLLER_UC8151D
config LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED
bool "Inverted Landscape"
depends on !LV_TFT_DISPLAY_CONTROLLER_IL3820
depends on !LV_TFT_DISPLAY_CONTROLLER_JD79653A
depends on !LV_TFT_DISPLAY_CONTROLLER_UC8151D
endchoice
config LV_TFT_USE_CUSTOM_SPI_CLK_DIVIDER config LV_TFT_USE_CUSTOM_SPI_CLK_DIVIDER
bool "Use custom SPI clock frequency." if LV_TFT_DISPLAY_PROTOCOL_SPI bool "Use custom SPI clock frequency." if LV_TFT_DISPLAY_PROTOCOL_SPI
default n default n

View file

@ -49,7 +49,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#define BIT_CLEAR(a,b) ((a) &= ~(1U<<(b))) #define BIT_CLEAR(a,b) ((a) &= ~(1U<<(b)))
/* Number of pixels? */ /* Number of pixels? */
#define IL3820_PIXEL (CONFIG_LV_DISPLAY_WIDTH * CONFIG_LV_DISPLAY_HEIGHT) #define IL3820_PIXEL (LV_HOR_RES_MAX * LV_VER_RES_MAX)
#define EPD_PANEL_NUMOF_COLUMS EPD_PANEL_WIDTH #define EPD_PANEL_NUMOF_COLUMS EPD_PANEL_WIDTH
#define EPD_PANEL_NUMOF_ROWS_PER_PAGE 8 #define EPD_PANEL_NUMOF_ROWS_PER_PAGE 8

View file

@ -20,8 +20,8 @@ extern "C"
/* Values for Waveshare 2.9inch e-Paper Module, this values shouldn't be /* Values for Waveshare 2.9inch e-Paper Module, this values shouldn't be
* swapped to change display orientation */ * swapped to change display orientation */
#define EPD_PANEL_WIDTH CONFIG_LV_DISPLAY_WIDTH /* 128 */ #define EPD_PANEL_WIDTH LV_HOR_RES_MAX /* 128 */
#define EPD_PANEL_HEIGHT CONFIG_LV_DISPLAY_HEIGHT /* 296 */ #define EPD_PANEL_HEIGHT LV_VER_RES_MAX /* 296 */
/* 128 = panel width */ /* 128 = panel width */
#define IL3820_COLUMNS (EPD_PANEL_WIDTH / 8) #define IL3820_COLUMNS (EPD_PANEL_WIDTH / 8)

View file

@ -43,8 +43,8 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#define PIN_BUSY CONFIG_LV_DISP_PIN_BUSY #define PIN_BUSY CONFIG_LV_DISP_PIN_BUSY
#define PIN_BUSY_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_BUSY))) #define PIN_BUSY_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_BUSY)))
#define EVT_BUSY (1UL << 0UL) #define EVT_BUSY (1UL << 0UL)
#define EPD_WIDTH CONFIG_LV_DISPLAY_WIDTH #define EPD_WIDTH LV_HOR_RES_MAX
#define EPD_HEIGHT CONFIG_LV_DISPLAY_HEIGHT #define EPD_HEIGHT LV_VER_RES_MAX
#define EPD_ROW_LEN (EPD_HEIGHT / 8u) #define EPD_ROW_LEN (EPD_HEIGHT / 8u)
#define EPD_PARTIAL_CNT 5; #define EPD_PARTIAL_CNT 5;

View file

@ -37,8 +37,8 @@
#endif #endif
#define BYTES_PER_PIXEL (LV_COLOR_DEPTH / 8) #define BYTES_PER_PIXEL (LV_COLOR_DEPTH / 8)
#define HDWR_VAL (CONFIG_LV_DISPLAY_WIDTH/8 - 1) #define HDWR_VAL (LV_HOR_RES_MAX/8 - 1)
#define VDHR_VAL (CONFIG_LV_DISPLAY_HEIGHT - 1) #define VDHR_VAL (LV_VER_RES_MAX - 1)
#define VDIR_MASK (1 << 2) #define VDIR_MASK (1 << 2)
#define HDIR_MASK (1 << 3) #define HDIR_MASK (1 << 3)
@ -248,7 +248,7 @@ void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
#if DEBUG #if DEBUG
ESP_LOGI(TAG, "flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2); ESP_LOGI(TAG, "flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2);
#endif #endif
ra8875_set_window(area->x1, area->x2, 0, CONFIG_LV_DISPLAY_HEIGHT-1); ra8875_set_window(area->x1, area->x2, 0, LV_VER_RES_MAX-1);
x1 = area->x1; x1 = area->x1;
x2 = area->x2; x2 = area->x2;
} }
@ -264,7 +264,7 @@ void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
// Update to future cursor location // Update to future cursor location
y = area->y2 + 1; y = area->y2 + 1;
if (y >= CONFIG_LV_DISPLAY_HEIGHT) { if (y >= LV_VER_RES_MAX) {
y = 0; y = 0;
} }

View file

@ -124,10 +124,10 @@ void sh1107_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t b
uint8_t bit_index = 0; uint8_t bit_index = 0;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE #if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
byte_index = y + (( x>>3 ) * CONFIG_LV_DISPLAY_HEIGHT); byte_index = y + (( x>>3 ) * LV_VER_RES_MAX);
bit_index = x & 0x7; bit_index = x & 0x7;
#elif defined CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT #elif defined CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT
byte_index = x + (( y>>3 ) * CONFIG_LV_DISPLAY_WIDTH); byte_index = x + (( y>>3 ) * LV_HOR_RES_MAX);
bit_index = y & 0x7; bit_index = y & 0x7;
#endif #endif
@ -159,9 +159,9 @@ void sh1107_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
sh1107_send_cmd(0xB0 | i); // Set Page Start Address for Page Addressing Mode sh1107_send_cmd(0xB0 | i); // Set Page Start Address for Page Addressing Mode
size = area->y2 - area->y1 + 1; size = area->y2 - area->y1 + 1;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE #if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
ptr = color_map + i * CONFIG_LV_DISPLAY_HEIGHT; ptr = color_map + i * LV_VER_RES_MAX;
#else #else
ptr = color_map + i * CONFIG_LV_DISPLAY_WIDTH; ptr = color_map + i * LV_HOR_RES_MAX;
#endif #endif
if(i != row2){ if(i != row2){
sh1107_send_data( (void *) ptr, size); sh1107_send_data( (void *) ptr, size);
@ -177,8 +177,8 @@ void sh1107_rounder(struct _disp_drv_t * disp_drv, lv_area_t *area)
// workaround: always send complete size display buffer // workaround: always send complete size display buffer
area->x1 = 0; area->x1 = 0;
area->y1 = 0; area->y1 = 0;
area->x2 = CONFIG_LV_DISPLAY_WIDTH-1; area->x2 = LV_HOR_RES_MAX-1;
area->y2 = CONFIG_LV_DISPLAY_HEIGHT-1; area->y2 = LV_VER_RES_MAX-1;
} }
void sh1107_sleep_in() void sh1107_sleep_in()

View file

@ -130,7 +130,7 @@ void ssd1306_init()
i2c_cmd_link_delete(cmd); i2c_cmd_link_delete(cmd);
} }
void ssd1306_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, void ssd1306_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) { lv_color_t color, lv_opa_t opa) {
uint16_t byte_index = x + (( y>>3 ) * buf_w); uint16_t byte_index = x + (( y>>3 ) * buf_w);
uint8_t bit_index = y & 0x7; uint8_t bit_index = y & 0x7;
@ -147,13 +147,9 @@ void ssd1306_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t
uint8_t row1 = 0, row2 = 0; uint8_t row1 = 0, row2 = 0;
i2c_cmd_handle_t cmd; i2c_cmd_handle_t cmd;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE // Divide by 8
row1 = area->y1 >> 3; row1 = area->y1 >> 3;
row2 = area->y2 >> 3; row2 = area->y2 >> 3;
#else
row1 = area->y1>>3;
row2 = area->y2>>3;
#endif
cmd = i2c_cmd_link_create(); cmd = i2c_cmd_link_create();
i2c_master_start(cmd); i2c_master_start(cmd);
@ -185,16 +181,19 @@ void ssd1306_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t
lv_disp_flush_ready(disp_drv); lv_disp_flush_ready(disp_drv);
} }
void ssd1306_rounder(struct _disp_drv_t * disp_drv, lv_area_t *area) // workaround: always send complete size display buffer, no partial update
void ssd1306_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area)
{ {
// area->y1 = (area->y1 & (~0x7)); // area->y1 = (area->y1 & (~0x7));
// area->y2 = (area->y2 & (~0x7)) + 7; // area->y2 = (area->y2 & (~0x7)) + 7;
// workaround: always send complete size display buffer uint8_t hor_max = disp_drv->hor_res;
uint8_t ver_max = disp_drv->ver_res;
area->x1 = 0; area->x1 = 0;
area->y1 = 0; area->y1 = 0;
area->x2 = CONFIG_LV_DISPLAY_WIDTH-1; area->x2 = hor_max - 1;
area->y2 = CONFIG_LV_DISPLAY_HEIGHT-1; area->y2 = ver_max - 1;
} }
void ssd1306_sleep_in() void ssd1306_sleep_in()

View file

@ -38,8 +38,8 @@ extern "C" {
**********************/ **********************/
void ssd1306_init(void); void ssd1306_init(void);
void ssd1306_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map); void ssd1306_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
void ssd1306_rounder(struct _disp_drv_t * disp_drv, lv_area_t *area); void ssd1306_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area);
void ssd1306_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, void ssd1306_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); lv_color_t color, lv_opa_t opa);
void ssd1306_sleep_in(void); void ssd1306_sleep_in(void);

View file

@ -23,7 +23,6 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
// #define DISP_BUF_SIZE (CONFIG_LV_DISPLAY_WIDTH*CONFIG_LV_DISPLAY_HEIGHT)
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#define ST7735S_DC CONFIG_LV_DISP_PIN_DC #define ST7735S_DC CONFIG_LV_DISP_PIN_DC

View file

@ -44,8 +44,8 @@
#define PIN_BUSY CONFIG_LV_DISP_PIN_BUSY #define PIN_BUSY CONFIG_LV_DISP_PIN_BUSY
#define PIN_BUSY_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_BUSY))) #define PIN_BUSY_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_BUSY)))
#define EVT_BUSY (1UL << 0UL) #define EVT_BUSY (1UL << 0UL)
#define EPD_WIDTH CONFIG_LV_DISPLAY_WIDTH #define EPD_WIDTH LV_HOR_RES_MAX
#define EPD_HEIGHT CONFIG_LV_DISPLAY_HEIGHT #define EPD_HEIGHT LV_VER_RES_MAX
#define EPD_ROW_LEN (EPD_HEIGHT / 8u) #define EPD_ROW_LEN (EPD_HEIGHT / 8u)
#define BIT_SET(a, b) ((a) |= (1U << (b))) #define BIT_SET(a, b) ((a) |= (1U << (b)))

View file

@ -38,16 +38,16 @@ extern "C" {
/*GetMaxX Macro*/ /*GetMaxX Macro*/
#if CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE #if CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#define GetMaxX() (CONFIG_LV_DISPLAY_WIDTH - 1) #define GetMaxX() (LV_HOR_RES_MAX - 1)
#else #else
#define GetMaxX() (CONFIG_LV_DISPLAY_HEIGHT - 1) #define GetMaxX() (LV_VER_RES_MAX - 1)
#endif #endif
/*GetMaxY Macro*/ /*GetMaxY Macro*/
#if CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE #if CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#define GetMaxY() (CONFIG_LV_DISPLAY_HEIGHT - 1) #define GetMaxY() (LV_VER_RES_MAX - 1)
#else #else
#define GetMaxY() (CONFIG_LV_DISPLAY_WIDTH - 1) #define GetMaxY() (LV_HOR_RES_MAX - 1)
#endif #endif
#ifndef CONCAT3 #ifndef CONCAT3