Initial commit.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
parent
234cec773b
commit
ef517e5e5b
|
@ -42,7 +42,7 @@
|
|||
|
||||
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
|
||||
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_SIZE (64 * 1024U) /*[bytes]*/
|
||||
#define LV_MEM_SIZE (96 * 1024U) /*[bytes]*/
|
||||
|
||||
/*Size of the memory expand for `lv_malloc()` in bytes*/
|
||||
#define LV_MEM_POOL_EXPAND_SIZE 0
|
||||
|
@ -365,9 +365,9 @@
|
|||
*https://fonts.google.com/specimen/Montserrat*/
|
||||
#define LV_FONT_MONTSERRAT_8 0
|
||||
#define LV_FONT_MONTSERRAT_10 0
|
||||
#define LV_FONT_MONTSERRAT_12 0
|
||||
#define LV_FONT_MONTSERRAT_12 1
|
||||
#define LV_FONT_MONTSERRAT_14 1
|
||||
#define LV_FONT_MONTSERRAT_16 0
|
||||
#define LV_FONT_MONTSERRAT_16 1
|
||||
#define LV_FONT_MONTSERRAT_18 0
|
||||
#define LV_FONT_MONTSERRAT_20 0
|
||||
#define LV_FONT_MONTSERRAT_22 0
|
||||
|
@ -906,7 +906,7 @@
|
|||
====================*/
|
||||
|
||||
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
|
||||
#define LV_USE_DEMO_WIDGETS 1
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#endif
|
||||
|
@ -924,13 +924,13 @@
|
|||
#define LV_USE_DEMO_STRESS 0
|
||||
|
||||
/*Music player demo*/
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#define LV_USE_DEMO_MUSIC 1
|
||||
#if LV_USE_DEMO_MUSIC
|
||||
#define LV_DEMO_MUSIC_SQUARE 0
|
||||
#define LV_DEMO_MUSIC_SQUARE 1
|
||||
#define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
#define LV_DEMO_MUSIC_ROUND 0
|
||||
#define LV_DEMO_MUSIC_LARGE 0
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY 1
|
||||
#endif
|
||||
|
||||
/*Flex layout demo*/
|
||||
|
|
2
lib/lcd
2
lib/lcd
|
@ -1 +1 @@
|
|||
Subproject commit 651efeb64848a969657f58171ae1dbab2f7e454d
|
||||
Subproject commit b5b0a042da4f729c07e3a5ffff462b94940ab039
|
|
@ -1,3 +1,5 @@
|
|||
#include <stdio.h>
|
||||
|
||||
/* FreeRTOS */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
@ -20,7 +22,7 @@ int app_lcd_impl_init(void *handle) {
|
|||
lpspi_master_config_t spi_cfg;
|
||||
LPSPI_MasterGetDefaultConfig(&spi_cfg);
|
||||
|
||||
spi_cfg.baudRate = 24000000UL;
|
||||
spi_cfg.baudRate = 48000000UL;
|
||||
|
||||
LPSPI_MasterInit(LPSPI4, &spi_cfg, CLOCK_GetClockRootFreq(kCLOCK_LpspiClkRoot));
|
||||
|
||||
|
@ -30,12 +32,79 @@ int app_lcd_impl_init(void *handle) {
|
|||
epd_ret_t app_lcd_impl_write_command(void *handle, uint8_t *command, uint32_t len) {
|
||||
/* 02 - 00 - CMD - 00 - DATA0 - ... - DATAN */
|
||||
|
||||
uint8_t command_buf[4] = {0x02, 0x00, command[0], 0x00};
|
||||
|
||||
LPSPI4->TCR |= LPSPI_TCR_CONT(1U) | LPSPI_TCR_CONTC(1U) | LPSPI_TCR_RXMSK(1U);
|
||||
while (LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
uint8_t fifo_length = (LPSPI4->PARAM & LPSPI_PARAM_TXFIFO_MASK) >> LPSPI_PARAM_TXFIFO_SHIFT;
|
||||
|
||||
for (uint8_t i = 0; i < sizeof(command_buf); i++) {
|
||||
while ((LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) >> LPSPI_FSR_TXCOUNT_SHIFT == fifo_length) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
LPSPI4->TDR = command_buf[i];
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < (len - 1); i++) {
|
||||
while ((LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) >> LPSPI_FSR_TXCOUNT_SHIFT == fifo_length) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
LPSPI4->TDR = command[i + 1];
|
||||
}
|
||||
|
||||
while (LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
LPSPI4->TCR &= ~(LPSPI_TCR_CONT_MASK | LPSPI_TCR_CONTC_MASK);
|
||||
while (LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
return EPD_OK;
|
||||
}
|
||||
|
||||
epd_ret_t app_lcd_impl_write_data(void *handle, const uint8_t *data, uint32_t len) {
|
||||
/* 02 - 00 - CMD(2C) - 00 - DATA0 - ... - DATAN */
|
||||
|
||||
uint8_t command_buf[4] = {0x02, 0x00, 0x2C, 0x00};
|
||||
|
||||
LPSPI4->TCR |= LPSPI_TCR_CONT(1U) | LPSPI_TCR_CONTC(1U) | LPSPI_TCR_RXMSK(1U);
|
||||
while (LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
uint8_t fifo_length = (LPSPI4->PARAM & LPSPI_PARAM_TXFIFO_MASK) >> LPSPI_PARAM_TXFIFO_SHIFT;
|
||||
|
||||
for (uint8_t i = 0; i < sizeof(command_buf); i++) {
|
||||
while ((LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) >> LPSPI_FSR_TXCOUNT_SHIFT == fifo_length) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
LPSPI4->TDR = command_buf[i];
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
while ((LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) >> LPSPI_FSR_TXCOUNT_SHIFT == fifo_length) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
LPSPI4->TDR = data[i];
|
||||
}
|
||||
|
||||
while (LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) {
|
||||
/* -- */
|
||||
}
|
||||
|
||||
LPSPI4->TCR &= ~(LPSPI_TCR_CONT_MASK | LPSPI_TCR_CONTC_MASK);
|
||||
while (LPSPI4->FSR & LPSPI_FSR_TXCOUNT_MASK) {
|
||||
/* -- */
|
||||
}
|
||||
return EPD_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,16 +8,27 @@
|
|||
#include "lv_demos.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
/* LCD */
|
||||
#include "epd-spi/panel/lcd_h189s001.h"
|
||||
|
||||
/* App */
|
||||
#include "app_impl_lcd.h"
|
||||
#include "app_lvgl.h"
|
||||
|
||||
#define APP_LVGL_WIDTH (360)
|
||||
#define APP_LVGL_HEIGHT (360)
|
||||
static lcd_gc9b71_t s_lcd = {
|
||||
.cb =
|
||||
{
|
||||
.write_command_cb = app_lcd_impl_write_command,
|
||||
.write_data_cb = app_lcd_impl_write_data,
|
||||
.delay_cb = app_lcd_impl_delay,
|
||||
|
||||
},
|
||||
.user_data = NULL,
|
||||
};
|
||||
|
||||
static SemaphoreHandle_t s_lvgl_semphr = NULL;
|
||||
|
||||
static uint16_t s_lcd_buffer[APP_LVGL_WIDTH * 10];
|
||||
static uint16_t s_lcd_buffer[320 * 40];
|
||||
|
||||
static uint32_t app_lvgl_get_tick_cb(void);
|
||||
static void app_lvgl_lcd_flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map);
|
||||
|
@ -33,12 +44,15 @@ int app_lvgl_init(void) {
|
|||
|
||||
app_lcd_impl_init(NULL);
|
||||
|
||||
lcd_gc9b71_init(&s_lcd, &lcd_h189s001_panel_config);
|
||||
lcd_gc9b71_set_pixel_format(&s_lcd, LCD_GC9B71_RGB565);
|
||||
lcd_gc9b71_enable_display(&s_lcd, true);
|
||||
lv_init();
|
||||
|
||||
lv_tick_set_cb(app_lvgl_get_tick_cb);
|
||||
|
||||
uint16_t hor_res = APP_LVGL_WIDTH;
|
||||
uint16_t ver_res = APP_LVGL_HEIGHT;
|
||||
uint16_t hor_res = s_lcd.panel_config->size_x;
|
||||
uint16_t ver_res = s_lcd.panel_config->size_y;
|
||||
|
||||
lv_display_t *display = lv_display_create(hor_res, ver_res);
|
||||
if (display == NULL) {
|
||||
|
@ -48,7 +62,7 @@ int app_lvgl_init(void) {
|
|||
lv_display_set_flush_cb(display, app_lvgl_lcd_flush_cb);
|
||||
lv_display_set_buffers(display, s_lcd_buffer, NULL, sizeof(s_lcd_buffer), LV_DISPLAY_RENDER_MODE_PARTIAL);
|
||||
|
||||
lv_demo_widgets();
|
||||
lv_demo_music();
|
||||
|
||||
if (xTaskCreate(app_lvgl_task, "LVGL", 2048, NULL, 3, NULL) != pdPASS) {
|
||||
goto destroy_display_exit;
|
||||
|
@ -83,6 +97,17 @@ static uint32_t app_lvgl_get_tick_cb(void) {
|
|||
}
|
||||
|
||||
static void app_lvgl_lcd_flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map) {
|
||||
epd_coord_t coord = {
|
||||
.x_start = area->x1,
|
||||
.x_end = area->x2,
|
||||
.y_start = area->y1,
|
||||
.y_end = area->y2,
|
||||
};
|
||||
|
||||
lv_draw_sw_rgb565_swap(px_map, (area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1));
|
||||
|
||||
lcd_gc9b71_load(&s_lcd, &coord, px_map);
|
||||
|
||||
lv_display_flush_ready(disp);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ static void app_task_initialization(void *arguments) {
|
|||
app_lvgl_init();
|
||||
|
||||
for (;;) {
|
||||
GPIO_PortToggle(BOARD_INITLEDPINS_LEDA_GPIO, BOARD_INITLEDPINS_LEDA_PIN_MASK);
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
GPIO_PortToggle(BOARD_INITLEDPINS_LEDR_GPIO, BOARD_INITLEDPINS_LEDR_PIN_MASK);
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue