Add Schmitt SPI display driver
This commit is contained in:
parent
26fe6e7703
commit
8592cb9d29
|
@ -44,6 +44,8 @@ elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C)
|
|||
list(APPEND SOURCES "lvgl_tft/ili9163c.c")
|
||||
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
||||
list(APPEND SOURCES "lvgl_tft/pcd8544.c")
|
||||
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT)
|
||||
list(APPEND SOURCES "lvgl_tft/schmitt.c")
|
||||
else()
|
||||
message(WARNING "LVGL ESP32 drivers: Display controller not defined.")
|
||||
endif()
|
||||
|
|
|
@ -154,7 +154,7 @@ bool lvgl_spi_driver_init(int host,
|
|||
int dma_channel,
|
||||
int quadwp_pin, int quadhd_pin)
|
||||
{
|
||||
assert((0 <= host) && (SPI_HOST_MAX > host));
|
||||
assert((0 <= host) && (3 > host));
|
||||
const char *spi_names[] = {
|
||||
"SPI1_HOST", "SPI2_HOST", "SPI3_HOST"
|
||||
};
|
||||
|
|
|
@ -78,6 +78,8 @@ extern "C" {
|
|||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
||||
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8))
|
||||
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT)
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX)
|
||||
#else
|
||||
#error "No display controller selected"
|
||||
#endif
|
||||
|
|
|
@ -114,7 +114,11 @@ extern "C" {
|
|||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) || \
|
||||
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT)
|
||||
|
||||
#define SPI_BUS_MAX_TRANSFER_SZ (DISP_BUF_SIZE * 4)
|
||||
|
||||
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) || \
|
||||
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488)
|
||||
|
||||
#define SPI_BUS_MAX_TRANSFER_SZ (DISP_BUF_SIZE * 3)
|
||||
|
@ -161,7 +165,7 @@ extern "C" {
|
|||
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
||||
#define SPI_TFT_CLOCK_SPEED_HZ (4*1000*1000)
|
||||
#else
|
||||
#define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000)
|
||||
#define SPI_TFT_CLOCK_SPEED_HZ (5*1000*1000) // Set to 40 later
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -178,6 +178,10 @@ menu "LVGL TFT Display controller"
|
|||
bool
|
||||
help
|
||||
PCD8544 display controller (Nokia 3110/5110)
|
||||
config LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||
bool
|
||||
help
|
||||
Schmitt's display controller
|
||||
# Display controller communication protocol
|
||||
#
|
||||
# This symbols define the communication protocol used by the
|
||||
|
@ -349,6 +353,10 @@ menu "LVGL TFT Display controller"
|
|||
select LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
||||
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
||||
select LV_TFT_DISPLAY_MONOCHROME
|
||||
config LV_TFT_DISPLAY_USER_CONTROLLER_SCHMITT
|
||||
bool "SCHMITT"
|
||||
select LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
||||
endchoice
|
||||
|
||||
config CUSTOM_DISPLAY_BUFFER_SIZE
|
||||
|
|
|
@ -45,6 +45,8 @@ void *disp_driver_init(void)
|
|||
ili9163c_init();
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
||||
pcd8544_init();
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||
schmitt_init();
|
||||
#endif
|
||||
|
||||
// We still use menuconfig for these settings
|
||||
|
@ -111,6 +113,8 @@ void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t *
|
|||
ili9163c_flush(drv, area, color_map);
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
||||
pcd8544_flush(drv, area, color_map);
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||
schmitt_flush(drv, area, color_map);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ extern "C" {
|
|||
#include "ili9163c.h"
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
||||
#include "pcd8544.h"
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||
#include "schmitt.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
|
|
27
lvgl_tft/schmitt.c
Normal file
27
lvgl_tft/schmitt.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "schmitt.h"
|
||||
#include "disp_spi.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
static const char* TAG = "SCHMITT_DIS";
|
||||
|
||||
void schmitt_init(void)
|
||||
{
|
||||
disp_spi_acquire();
|
||||
// Do things
|
||||
ESP_LOGI(TAG, "schmitt_init() called");
|
||||
disp_spi_release();
|
||||
}
|
||||
|
||||
void schmitt_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
|
||||
{
|
||||
disp_spi_acquire();
|
||||
// Do things
|
||||
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);
|
||||
disp_spi_send_colors(color_map, size * 4);
|
||||
ESP_LOGI(TAG, "schmitt_flush() called");
|
||||
disp_spi_release();
|
||||
lv_disp_flush_ready(drv);
|
||||
}
|
20
lvgl_tft/schmitt.h
Normal file
20
lvgl_tft/schmitt.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef SCHMITT_H_
|
||||
#define SCHMITT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "lvgl/lvgl.h"
|
||||
#endif
|
||||
#include "../lvgl_helpers.h"
|
||||
|
||||
#define LV_HOR_RES_MAX 64
|
||||
#define LV_VER_RES_MAX 64
|
||||
|
||||
void schmitt_init(void);
|
||||
|
||||
void schmitt_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||
|
||||
#endif /* SCHMITT_H_ */
|
Loading…
Reference in a new issue