2020-12-17 06:02:55 +00:00
|
|
|
/**
|
|
|
|
* @file lvgl_helpers.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LVGL_HELPERS_H
|
|
|
|
#define LVGL_HELPERS_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "lvgl_spi_conf.h"
|
|
|
|
#include "lvgl_tft/disp_driver.h"
|
|
|
|
#include "lvgl_touch/touch_driver.h"
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
2021-02-07 23:55:20 +00:00
|
|
|
|
|
|
|
/* DISP_BUF_SIZE value doesn't have an special meaning, but it's the size
|
|
|
|
* of the buffer(s) passed to LVGL as display buffers. The default values used
|
|
|
|
* were the values working for the contributor of the display controller.
|
|
|
|
*
|
|
|
|
* As LVGL supports partial display updates the DISP_BUF_SIZE doesn't
|
|
|
|
* necessarily need to be equal to the display size.
|
|
|
|
*
|
|
|
|
* When using RGB displays the display buffer size will also depends on the
|
|
|
|
* color format being used, for RGB565 each pixel needs 2 bytes.
|
|
|
|
* When using the mono theme, the display pixels can be represented in one bit,
|
|
|
|
* so the buffer size can be divided by 8, e.g. see SSD1306 display size. */
|
2021-02-08 00:02:21 +00:00
|
|
|
#if defined (CONFIG_CUSTOM_DISPLAY_BUFFER_SIZE)
|
|
|
|
#define DISP_BUF_SIZE CONFIG_CUSTOM_DISPLAY_BUFFER_BYTES
|
|
|
|
#else
|
2020-12-17 06:02:55 +00:00
|
|
|
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789)
|
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
|
|
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S
|
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
2020-12-24 17:44:17 +00:00
|
|
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S
|
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
2020-12-17 06:02:55 +00:00
|
|
|
#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
|
2021-01-09 21:04:53 +00:00
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX)
|
2020-12-17 06:02:55 +00:00
|
|
|
#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
|
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
|
|
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488
|
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
|
|
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
2021-02-07 23:55:45 +00:00
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
2020-12-17 06:02:55 +00:00
|
|
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306
|
2021-01-31 23:28:03 +00:00
|
|
|
#if defined (CONFIG_LV_THEME_MONO)
|
2021-01-20 05:54:14 +00:00
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8))
|
2021-01-31 23:28:03 +00:00
|
|
|
#else
|
|
|
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX)
|
|
|
|
#endif
|
2020-12-17 06:02:55 +00:00
|
|
|
#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)
|
2021-01-09 21:04:53 +00:00
|
|
|
#define DISP_BUF_SIZE (LV_VER_RES_MAX * IL3820_COLUMNS)
|
2020-12-17 06:02:55 +00:00
|
|
|
#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)
|
2021-01-09 21:04:53 +00:00
|
|
|
#define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 5KB
|
2020-12-17 06:02:55 +00:00
|
|
|
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D)
|
2021-01-09 21:04:53 +00:00
|
|
|
#define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 2888 bytes
|
2020-12-17 06:02:55 +00:00
|
|
|
#else
|
|
|
|
#error "No display controller selected"
|
|
|
|
#endif
|
2021-02-08 00:02:21 +00:00
|
|
|
#endif
|
2020-12-17 06:02:55 +00:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/* Initialize detected SPI and I2C bus and devices */
|
|
|
|
void lvgl_driver_init(void);
|
|
|
|
|
|
|
|
/* Initialize SPI master */
|
|
|
|
bool lvgl_spi_driver_init(int host, int miso_pin, int mosi_pin, int sclk_pin,
|
|
|
|
int max_transfer_sz, int dma_channel, int quadwp_pin, int quadhd_pin);
|
|
|
|
/* Initialize I2C master */
|
|
|
|
bool lvgl_i2c_driver_init(int port, int sda_pin, int scl_pin, int speed);
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* LVGL_HELPERS_H */
|