17eb416ef8
* [lvgl_helpers] Cleanup and misc code cleanup Checks for SPI_HOST_MAX symbol before using it. Rename lvgl_driver_init to lvgl_interface_init because it now only initialize the interface bus for display drivers, we still need to remove the indev drivers from here. Use types defined in spi_types.h for spi host (spi_host_device_t) and spi dma channels (spi_dma_chan_t). Also add a couple of symbols to avoid using magic numbers * [lvgl_helpers] Reduce usage of if defined in lvgl_interface_init * [lvgl_helpers] Fix spi dma channel for ESP-IDF versions <= 4.2 * [examples] Update hello_world to call lvgl_interface_init * Add lvgl_get_display_buffer_size helper This helper will allow us to get the calculated display buffer size instead of using a global symbol. * Implement lvgl_get_display_buffer_size This API will be used to get the calculation of display buffer size. * Delete DISP_BUF_SIZE symbols The same functionality is handled by lvgl_get_display_buffer_size * Move SPI max transfer size calculation to helper Use calculate_spi_max_transfer_size to calculate the SPI max transfer size for the SPI master configuration * Remove SPI_BUS_MAX_TRANSFER_SZ definition Same functionality is now handled in calculate_spi_max_transfer_size * Update display buffer size calculation Use lvgl_get_display_buffer_size helper instead of DISP_BUF_SIZE symbol * Update example to LVGL v8 Add comments about changes from: - LVGL v7 to LVGL v8 - Configuration helpers and display drivers * Update lvgl_helpers.c * Update sh1107 driver * Update EVE driver Check for symbols used in previous implementations before trying to use them and add a fallback temporary implementation when not found. The falback implementation isn't tested with hardware. Symbols: - DISP_BUF_SIZE - SPI_TRANSFER_SIZE * Update uc8151d driver * Update jd79653a driver * Update ra8875 driver * Update il3820.h Check for LV_HOR_RES_MAX and LV_VER_RES_MAX before trying to use them * Update lvgl_helpers.c Check for ESP-IDF version before trying to use spi_dma_chan_t type
126 lines
3.7 KiB
C
126 lines
3.7 KiB
C
/**
|
|
* @file il3820.h
|
|
*
|
|
*/
|
|
|
|
#ifndef IL3820_H
|
|
#define IL3820_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
|
#include "lvgl.h"
|
|
#else
|
|
#include "lvgl/lvgl.h"
|
|
#endif
|
|
#include "sdkconfig.h"
|
|
|
|
/* Values for Waveshare 2.9inch e-Paper Module, this values shouldn't be
|
|
* swapped to change display orientation */
|
|
#if defined (LV_HOR_RES_MAX)
|
|
#define EPD_PANEL_WIDTH LV_HOR_RES_MAX /* 128 */
|
|
#else
|
|
/* Fallback to default value */
|
|
#define EPD_PANEL_WIDTH 128u
|
|
#endif
|
|
|
|
#if defined (LV_VER_RES_MAX)
|
|
#define EPD_PANEL_HEIGHT LV_VER_RES_MAX /* 296 */
|
|
#else
|
|
/* Fallback to default value */
|
|
#define EPD_PANEL_HEIGHT 296u
|
|
#endif
|
|
|
|
/* 128 = panel width */
|
|
#define IL3820_COLUMNS (EPD_PANEL_WIDTH / 8)
|
|
|
|
#define IL3820_DC_PIN CONFIG_LV_DISP_PIN_DC
|
|
#define IL3820_RST_PIN CONFIG_LV_DISP_PIN_RST
|
|
#define IL3820_USE_RST CONFIG_LV_DISP_USE_RST
|
|
#define IL3820_BUSY_PIN CONFIG_LV_DISP_PIN_BUSY
|
|
#define IL3820_BUSY_LEVEL 1
|
|
|
|
/* IL3820 commands */
|
|
#define IL3820_CMD_GDO_CTRL 0x01
|
|
#define IL3820_CMD_GDV_CTRL 0x03
|
|
#define IL3820_CMD_SDV_CTRL 0x04
|
|
#define IL3820_CMD_SOFTSTART 0x0c
|
|
#define IL3820_CMD_GSCAN_START 0x0f
|
|
#define IL3820_CMD_SLEEP_MODE 0x10
|
|
#define IL3820_CMD_ENTRY_MODE 0x11
|
|
#define IL3820_CMD_SW_RESET 0x12
|
|
#define IL3820_CMD_TSENS_CTRL 0x1a
|
|
#define IL3820_CMD_MASTER_ACTIVATION 0x20
|
|
#define IL3820_CMD_UPDATE_CTRL1 0x21
|
|
#define IL3820_CMD_UPDATE_CTRL2 0x22
|
|
#define IL3820_CMD_WRITE_RAM 0x24
|
|
#define IL3820_CMD_WRITE_RED_RAM 0x26
|
|
#define IL3820_CMD_VCOM_SENSE 0x28
|
|
#define IL3820_CMD_VCOM_SENSE_DURATON 0x29
|
|
#define IL3820_CMD_PRGM_VCOM_OTP 0x2a
|
|
#define IL3820_CMD_VCOM_VOLTAGE 0x2c
|
|
#define IL3820_CMD_PRGM_WS_OTP 0x30
|
|
#define IL3820_CMD_UPDATE_LUT 0x32
|
|
#define IL3820_CMD_PRGM_OTP_SELECTION 0x36
|
|
#define IL3820_CMD_OTP_SELECTION_CTRL 0x37
|
|
#define IL3820_CMD_DUMMY_LINE 0x3a
|
|
#define IL3820_CMD_GATE_LINE_WIDTH 0x3b
|
|
#define IL3820_CMD_BWF_CTRL 0x3c
|
|
#define IL3820_CMD_RAM_XPOS_CTRL 0x44
|
|
#define IL3820_CMD_RAM_YPOS_CTRL 0x45
|
|
#define IL3820_CMD_RAM_XPOS_CNTR 0x4e
|
|
#define IL3820_CMD_RAM_YPOS_CNTR 0x4f
|
|
#define IL3820_CMD_TERMINATE_FRAME_RW 0xff
|
|
|
|
/* Data entry sequence modes */
|
|
#define IL3820_DATA_ENTRY_MASK 0x07
|
|
#define IL3820_DATA_ENTRY_XDYDX 0x00
|
|
#define IL3820_DATA_ENTRY_XIYDX 0x01
|
|
#define IL3820_DATA_ENTRY_XDYIX 0x02
|
|
#define IL3820_DATA_ENTRY_XIYIX 0x03
|
|
#define IL3820_DATA_ENTRY_XDYDY 0x04
|
|
#define IL3820_DATA_ENTRY_XIYDY 0x05
|
|
#define IL3820_DATA_ENTRY_XDYIY 0x06
|
|
#define IL3820_DATA_ENTRY_XIYIY 0x07
|
|
|
|
/* Options for display update */
|
|
#define IL3820_CTRL1_INITIAL_UPDATE_LL 0x00
|
|
#define IL3820_CTRL1_INITIAL_UPDATE_LH 0x01
|
|
#define IL3820_CTRL1_INITIAL_UPDATE_HL 0x02
|
|
#define IL3820_CTRL1_INITIAL_UPDATE_HH 0x03
|
|
|
|
/* Options for display update sequence */
|
|
#define IL3820_CTRL2_ENABLE_CLK 0x80
|
|
#define IL3820_CTRL2_ENABLE_ANALOG 0x40
|
|
#define IL3820_CTRL2_TO_INITIAL 0x08
|
|
#define IL3820_CTRL2_TO_PATTERN 0x04
|
|
#define IL3820_CTRL2_DISABLE_ANALOG 0x02
|
|
#define IL3820_CTRL2_DISABLE_CLK 0x01
|
|
|
|
#define IL3820_SLEEP_MODE_DSM 0x01
|
|
#define IL3820_SLEEP_MODE_PON 0x00
|
|
|
|
/* time constants in ms */
|
|
#define IL3820_RESET_DELAY 20
|
|
#define IL3820_BUSY_DELAY 1
|
|
// normal wait time max 200ms
|
|
#define IL3820_WAIT 20
|
|
|
|
void il3820_init(void);
|
|
void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
|
void il3820_fullflush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
|
void il3820_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area);
|
|
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);
|
|
void il3820_sleep_in(void);
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
|
|
#endif /* __IL3820_REGS_H__ */
|
|
|