Added LCD driver, modified include.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
341ecdc028
commit
5195172168
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef __ST7789_LCD_H
|
||||||
|
#define __ST7789_LCD_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define ST7789_PANEL_SELECTION st7789_zjy_240_240_init_sequence
|
||||||
|
|
||||||
|
#define ST7789_ERROR_CHECK(x) if(x != ST7789_RET_OK) return ST7789_RET_ERR
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ST7789_RET_OK,
|
||||||
|
ST7789_RET_ERR
|
||||||
|
} st7789_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
st7789_ret_t (*write_cmd_cb)(void *handle, uint8_t *cmd, uint16_t len);
|
||||||
|
st7789_ret_t (*write_data_cb)(void *handle, uint8_t *data, uint16_t len);
|
||||||
|
} st7789_cb_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
void *user_data;
|
||||||
|
st7789_cb_t cb;
|
||||||
|
} st7789_handle_t;
|
||||||
|
|
||||||
|
st7789_ret_t st7789_lcd_init(st7789_handle_t *lcd);
|
||||||
|
|
||||||
|
#endif //__ST7789_LCD_H
|
|
@ -25,7 +25,7 @@
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#include "st7789_lcd.h"
|
||||||
|
|
||||||
|
const uint8_t st7789_zjy_240_240_init_sequence[] = {
|
||||||
|
0x05, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33, // Porch Setting
|
||||||
|
0x01, 0xB7, 0x35, // Gate Control
|
||||||
|
0x01, 0xBB, 0x19, // VCOM Setting // Factory 0x19 -> 0.725V
|
||||||
|
0x01, 0xC0, 0x2C, // LCM Control
|
||||||
|
0x01, 0xC2, 0x01, // VDV and VRH Command Enable
|
||||||
|
0x01, 0xC3, 0x12, // VRH Set // Factory 12H
|
||||||
|
0x01, 0xC4, 0x20, // VDV Set
|
||||||
|
0x01, 0xC6, 0x0F, //Frame Rate Control in Normal Mode
|
||||||
|
0x02, 0xD0, 0xA4, 0xA1, // Power Control 1
|
||||||
|
0x0E, 0xE0, 0xD0, 0x04, 0x0D, 0x11, 0x13, 0x2B, 0x3F, 0x54, 0x4C, 0x18, 0x0D, 0x0B, 0x1F,
|
||||||
|
0x23, // Positive Voltage Gamma Control
|
||||||
|
0x0E, 0xE1, 0xD0, 0x04, 0x0C, 0x11, 0x13, 0x2C, 0x3F, 0x44, 0x51, 0x2F, 0x1F, 0x1F, 0x20,
|
||||||
|
0x23, // Negative Voltage Gamma Control
|
||||||
|
0x00, 0x21, // Inversion On
|
||||||
|
};
|
||||||
|
|
||||||
|
st7789_ret_t _st7789_init_seq(st7789_handle_t *lcd) {
|
||||||
|
uint16_t i = 0;
|
||||||
|
while(i < sizeof(ST7789_PANEL_SELECTION)) {
|
||||||
|
ST7789_ERROR_CHECK(lcd->cb.write_cmd_cb(lcd->user_data, &ST7789_PANEL_SELECTION[i + 1], ST7789_PANEL_SELECTION[i] + 1));
|
||||||
|
i = ST7789_PANEL_SELECTION[i] + 2;
|
||||||
|
}
|
||||||
|
return ST7789_RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
st7789_ret_t _st7789_ptr(st7789_handle_t *lcd, uint16_t x_start, uint16_t x_end, uint16_t y_start, uint16_t y_end) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
st7789_ret_t st7789_lcd_init(st7789_handle_t *lcd) {
|
||||||
|
return _st7789_init_seq(lcd);
|
||||||
|
}
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -60,6 +60,7 @@ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c \
|
||||||
Core/Src/system_stm32h7xx.c \
|
Core/Src/system_stm32h7xx.c \
|
||||||
Core/Src/freertos.c \
|
Core/Src/freertos.c \
|
||||||
Core/Src/stm32h7xx_hal_timebase_tim.c \
|
Core/Src/stm32h7xx_hal_timebase_tim.c \
|
||||||
|
Core/Src/st7789_lcd.c \
|
||||||
FATFS/App/fatfs.c \
|
FATFS/App/fatfs.c \
|
||||||
FATFS/Target/bsp_driver_sd.c \
|
FATFS/Target/bsp_driver_sd.c \
|
||||||
FATFS/Target/sd_diskio.c \
|
FATFS/Target/sd_diskio.c \
|
||||||
|
|
Loading…
Reference in New Issue