Merge pull request #19 from lvgl/fix/update_lvgl_helpers
Fix/update lvgl helpers
This commit is contained in:
commit
ccb30922f8
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
||||
#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
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486
|
||||
|
@ -38,20 +38,20 @@ extern "C" {
|
|||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 64)
|
||||
#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)
|
||||
#define DISP_BUF_LINES 40
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * DISP_BUF_LINES)
|
||||
#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
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
||||
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01)
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
||||
#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)
|
||||
#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
|
||||
#error "No display controller selected"
|
||||
#endif
|
||||
|
|
|
@ -476,45 +476,6 @@ menu "LVGL TFT Display controller"
|
|||
bool "I2C PORT 1"
|
||||
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
|
||||
bool "Use custom SPI clock frequency." if LV_TFT_DISPLAY_PROTOCOL_SPI
|
||||
default n
|
||||
|
|
|
@ -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)))
|
||||
|
||||
/* 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_ROWS_PER_PAGE 8
|
||||
|
|
|
@ -20,8 +20,8 @@ extern "C"
|
|||
|
||||
/* Values for Waveshare 2.9inch e-Paper Module, this values shouldn't be
|
||||
* swapped to change display orientation */
|
||||
#define EPD_PANEL_WIDTH CONFIG_LV_DISPLAY_WIDTH /* 128 */
|
||||
#define EPD_PANEL_HEIGHT CONFIG_LV_DISPLAY_HEIGHT /* 296 */
|
||||
#define EPD_PANEL_WIDTH LV_HOR_RES_MAX /* 128 */
|
||||
#define EPD_PANEL_HEIGHT LV_VER_RES_MAX /* 296 */
|
||||
|
||||
/* 128 = panel width */
|
||||
#define IL3820_COLUMNS (EPD_PANEL_WIDTH / 8)
|
||||
|
|
|
@ -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_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_BUSY)))
|
||||
#define EVT_BUSY (1UL << 0UL)
|
||||
#define EPD_WIDTH CONFIG_LV_DISPLAY_WIDTH
|
||||
#define EPD_HEIGHT CONFIG_LV_DISPLAY_HEIGHT
|
||||
#define EPD_WIDTH LV_HOR_RES_MAX
|
||||
#define EPD_HEIGHT LV_VER_RES_MAX
|
||||
#define EPD_ROW_LEN (EPD_HEIGHT / 8u)
|
||||
#define EPD_PARTIAL_CNT 5;
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
#endif
|
||||
#define BYTES_PER_PIXEL (LV_COLOR_DEPTH / 8)
|
||||
|
||||
#define HDWR_VAL (CONFIG_LV_DISPLAY_WIDTH/8 - 1)
|
||||
#define VDHR_VAL (CONFIG_LV_DISPLAY_HEIGHT - 1)
|
||||
#define HDWR_VAL (LV_HOR_RES_MAX/8 - 1)
|
||||
#define VDHR_VAL (LV_VER_RES_MAX - 1)
|
||||
|
||||
#define VDIR_MASK (1 << 2)
|
||||
#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
|
||||
ESP_LOGI(TAG, "flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2);
|
||||
#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;
|
||||
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
|
||||
y = area->y2 + 1;
|
||||
if (y >= CONFIG_LV_DISPLAY_HEIGHT) {
|
||||
if (y >= LV_VER_RES_MAX) {
|
||||
y = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
#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;
|
||||
#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;
|
||||
#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
|
||||
size = area->y2 - area->y1 + 1;
|
||||
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
|
||||
ptr = color_map + i * CONFIG_LV_DISPLAY_HEIGHT;
|
||||
ptr = color_map + i * LV_VER_RES_MAX;
|
||||
#else
|
||||
ptr = color_map + i * CONFIG_LV_DISPLAY_WIDTH;
|
||||
ptr = color_map + i * LV_HOR_RES_MAX;
|
||||
#endif
|
||||
if(i != row2){
|
||||
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
|
||||
area->x1 = 0;
|
||||
area->y1 = 0;
|
||||
area->x2 = CONFIG_LV_DISPLAY_WIDTH-1;
|
||||
area->y2 = CONFIG_LV_DISPLAY_HEIGHT-1;
|
||||
area->x2 = LV_HOR_RES_MAX-1;
|
||||
area->y2 = LV_VER_RES_MAX-1;
|
||||
}
|
||||
|
||||
void sh1107_sleep_in()
|
||||
|
|
|
@ -130,7 +130,7 @@ void ssd1306_init()
|
|||
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) {
|
||||
uint16_t byte_index = x + (( y>>3 ) * buf_w);
|
||||
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;
|
||||
i2c_cmd_handle_t cmd;
|
||||
|
||||
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
|
||||
// Divide by 8
|
||||
row1 = area->y1 >> 3;
|
||||
row2 = area->y2 >> 3;
|
||||
#else
|
||||
row1 = area->y1>>3;
|
||||
row2 = area->y2>>3;
|
||||
#endif
|
||||
|
||||
cmd = i2c_cmd_link_create();
|
||||
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);
|
||||
}
|
||||
|
||||
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->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->y1 = 0;
|
||||
area->x2 = CONFIG_LV_DISPLAY_WIDTH-1;
|
||||
area->y2 = CONFIG_LV_DISPLAY_HEIGHT-1;
|
||||
area->x2 = hor_max - 1;
|
||||
area->y2 = ver_max - 1;
|
||||
}
|
||||
|
||||
void ssd1306_sleep_in()
|
||||
|
|
|
@ -38,8 +38,8 @@ extern "C" {
|
|||
**********************/
|
||||
void ssd1306_init(void);
|
||||
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_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_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area);
|
||||
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);
|
||||
|
||||
void ssd1306_sleep_in(void);
|
||||
|
|
|
@ -23,7 +23,6 @@ extern "C" {
|
|||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
// #define DISP_BUF_SIZE (CONFIG_LV_DISPLAY_WIDTH*CONFIG_LV_DISPLAY_HEIGHT)
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
||||
|
||||
#define ST7735S_DC CONFIG_LV_DISP_PIN_DC
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
#define PIN_BUSY CONFIG_LV_DISP_PIN_BUSY
|
||||
#define PIN_BUSY_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_BUSY)))
|
||||
#define EVT_BUSY (1UL << 0UL)
|
||||
#define EPD_WIDTH CONFIG_LV_DISPLAY_WIDTH
|
||||
#define EPD_HEIGHT CONFIG_LV_DISPLAY_HEIGHT
|
||||
#define EPD_WIDTH LV_HOR_RES_MAX
|
||||
#define EPD_HEIGHT LV_VER_RES_MAX
|
||||
#define EPD_ROW_LEN (EPD_HEIGHT / 8u)
|
||||
|
||||
#define BIT_SET(a, b) ((a) |= (1U << (b)))
|
||||
|
|
|
@ -38,16 +38,16 @@ extern "C" {
|
|||
|
||||
/*GetMaxX Macro*/
|
||||
#if CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
|
||||
#define GetMaxX() (CONFIG_LV_DISPLAY_WIDTH - 1)
|
||||
#define GetMaxX() (LV_HOR_RES_MAX - 1)
|
||||
#else
|
||||
#define GetMaxX() (CONFIG_LV_DISPLAY_HEIGHT - 1)
|
||||
#define GetMaxX() (LV_VER_RES_MAX - 1)
|
||||
#endif
|
||||
|
||||
/*GetMaxY Macro*/
|
||||
#if CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
|
||||
#define GetMaxY() (CONFIG_LV_DISPLAY_HEIGHT - 1)
|
||||
#define GetMaxY() (LV_VER_RES_MAX - 1)
|
||||
#else
|
||||
#define GetMaxY() (CONFIG_LV_DISPLAY_WIDTH - 1)
|
||||
#define GetMaxY() (LV_HOR_RES_MAX - 1)
|
||||
#endif
|
||||
|
||||
#ifndef CONCAT3
|
||||
|
|
Loading…
Reference in a new issue