chore: 更新组件lvgl_esp32_drivers,适配ESP-IDF v5.1.1
This commit is contained in:
parent
26fe6e7703
commit
f9cd95c4c9
5 changed files with 11 additions and 11 deletions
|
@ -3,7 +3,7 @@ if(ESP_PLATFORM)
|
||||||
file(GLOB SOURCES *.c)
|
file(GLOB SOURCES *.c)
|
||||||
set(LVGL_INCLUDE_DIRS . lvgl_tft)
|
set(LVGL_INCLUDE_DIRS . lvgl_tft)
|
||||||
list(APPEND SOURCES "lvgl_tft/disp_driver.c")
|
list(APPEND SOURCES "lvgl_tft/disp_driver.c")
|
||||||
list(APPEND SOURCES "lvgl_tft/esp_lcd_backlight.c")
|
# list(APPEND SOURCES "lvgl_tft/esp_lcd_backlight.c")
|
||||||
|
|
||||||
# Include only the source file of the selected
|
# Include only the source file of the selected
|
||||||
# display controller.
|
# display controller.
|
||||||
|
|
|
@ -16,7 +16,7 @@ extern "C" {
|
||||||
|
|
||||||
#include "lvgl_spi_conf.h"
|
#include "lvgl_spi_conf.h"
|
||||||
#include "lvgl_tft/disp_driver.h"
|
#include "lvgl_tft/disp_driver.h"
|
||||||
#include "lvgl_tft/esp_lcd_backlight.h"
|
// #include "lvgl_tft/esp_lcd_backlight.h" // 与IDF 5不兼容
|
||||||
#include "lvgl_touch/touch_driver.h"
|
#include "lvgl_touch/touch_driver.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "disp_driver.h"
|
#include "disp_driver.h"
|
||||||
#include "disp_spi.h"
|
#include "disp_spi.h"
|
||||||
#include "esp_lcd_backlight.h"
|
// #include "lvgl_tft/esp_lcd_backlight.h" // 与IDF 5不兼容
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
void *disp_driver_init(void)
|
void *disp_driver_init(void)
|
||||||
|
|
|
@ -66,7 +66,7 @@ void st7735s_init(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lcd_init_cmd_t init_cmds[]={
|
lcd_init_cmd_t init_cmds[]={
|
||||||
{ST7735_SWRESET, {0}, 0x80}, // Software reset, 0 args, w/delay 150
|
{ST7735_SWRESET, {0}, 0x80}, // Soft ware reset, 0 args, w/delay 150
|
||||||
{ST7735_SLPOUT, {0}, 0x80}, // Out of sleep mode, 0 args, w/delay 500
|
{ST7735_SLPOUT, {0}, 0x80}, // Out of sleep mode, 0 args, w/delay 500
|
||||||
{ST7735_FRMCTR1, {0x01, 0x2C, 0x2D}, 3}, // Frame rate ctrl - normal mode, 3 args: Rate = fosc/(1x2+40) * (LINE+2C+2D)
|
{ST7735_FRMCTR1, {0x01, 0x2C, 0x2D}, 3}, // Frame rate ctrl - normal mode, 3 args: Rate = fosc/(1x2+40) * (LINE+2C+2D)
|
||||||
{ST7735_FRMCTR2, {0x01, 0x2C, 0x2D}, 3}, // Frame rate control - idle mode, 3 args:Rate = fosc/(1x2+40) * (LINE+2C+2D)
|
{ST7735_FRMCTR2, {0x01, 0x2C, 0x2D}, 3}, // Frame rate control - idle mode, 3 args:Rate = fosc/(1x2+40) * (LINE+2C+2D)
|
||||||
|
@ -98,18 +98,18 @@ void st7735s_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ST7735S_DC);
|
esp_rom_gpio_pad_select_gpio(ST7735S_DC);
|
||||||
gpio_set_direction(ST7735S_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7735S_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ST7735S_USE_RST
|
#if ST7735S_USE_RST
|
||||||
gpio_pad_select_gpio(ST7735S_RST);
|
esp_rom_gpio_pad_select_gpio(ST7735S_RST);
|
||||||
gpio_set_direction(ST7735S_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7735S_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ST7735S_RST, 0);
|
gpio_set_level(ST7735S_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ST7735S_RST, 1);
|
gpio_set_level(ST7735S_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "ST7735S initialization.");
|
ESP_LOGI(TAG, "ST7735S initialization.");
|
||||||
|
@ -120,7 +120,7 @@ void st7735s_init(void)
|
||||||
st7735s_send_cmd(init_cmds[cmd].cmd);
|
st7735s_send_cmd(init_cmds[cmd].cmd);
|
||||||
st7735s_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes&0x1F);
|
st7735s_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes&0x1F);
|
||||||
if (init_cmds[cmd].databytes & 0x80) {
|
if (init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ extern "C" {
|
||||||
// https://github.com/adafruit/Adafruit-ST7735-Library
|
// https://github.com/adafruit/Adafruit-ST7735-Library
|
||||||
//
|
//
|
||||||
#define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 / 1 offset)
|
#define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 / 1 offset)
|
||||||
#define COLSTART 26
|
#define COLSTART 24 // ST7735s是为128 x 160屏幕设计的,我们是160 x 80的屏幕,需要偏移一部分像素。
|
||||||
#define ROWSTART 1
|
#define ROWSTART 0 // ST7735s是为128 x 160屏幕设计的,我们是160 x 80的屏幕,需要偏移一部分像素。
|
||||||
|
|
||||||
// Delay between some initialisation commands
|
// Delay between some initialisation commands
|
||||||
#define TFT_INIT_DELAY 0x80
|
#define TFT_INIT_DELAY 0x80
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue