generated from Embedded_Projects/Fire_RT1021_EVK_Template
82 lines
1.7 KiB
C
82 lines
1.7 KiB
C
/*
|
|
* Copyright 2024 NXP
|
|
* Copyright 2024 Yilin Sun <imi415@imi.moe>
|
|
* All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
/* Board */
|
|
#include "board.h"
|
|
#include "clock_config.h"
|
|
#include "pin_mux.h"
|
|
|
|
/* FreeRTOS */
|
|
#include "FreeRTOS.h"
|
|
#include "task.h"
|
|
|
|
/* LCD */
|
|
#include "epd-spi/panel/lcd_tk0096f611.h"
|
|
|
|
/* App */
|
|
#include "app_lcd_impl.h"
|
|
|
|
static uint16_t s_display_buf[160 * 80];
|
|
|
|
static void app_task_initialization(void *arguments);
|
|
|
|
int main(void) {
|
|
/* Init board hardware. */
|
|
BOARD_ConfigMPU();
|
|
BOARD_InitBootPins();
|
|
BOARD_InitBootClocks();
|
|
|
|
BOARD_InitDebugConsole();
|
|
|
|
if (xTaskCreate(app_task_initialization, "Init", 256, NULL, 2, NULL) != pdPASS) {
|
|
goto dead_loop;
|
|
}
|
|
|
|
vTaskStartScheduler();
|
|
|
|
dead_loop:
|
|
for (;;) {
|
|
__WFI();
|
|
}
|
|
}
|
|
|
|
static void app_task_initialization(void *arguments) {
|
|
lcd_st7789_t lcd = {
|
|
.cb =
|
|
{
|
|
.write_command_cb = app_lcd_impl_write_command,
|
|
.write_data_cb = app_lcd_impl_write_data,
|
|
.delay_cb = app_lcd_impl_delay,
|
|
},
|
|
};
|
|
|
|
app_lcd_impl_init(NULL);
|
|
|
|
lcd_st7789_init(&lcd, &lcd_tk0096_panel_config);
|
|
lcd_st7789_set_direction(&lcd, LCD_ST7789_DIR_90);
|
|
lcd_st7789_set_pixel_format(&lcd, LCD_ST7789_RGB565);
|
|
lcd_st7789_enable_display(&lcd, true);
|
|
|
|
memset(s_display_buf, 0xDD, sizeof(s_display_buf));
|
|
|
|
epd_coord_t coord = {
|
|
.x_start = 0,
|
|
.x_end = 159,
|
|
.y_start = 0,
|
|
.y_end = 79,
|
|
};
|
|
|
|
lcd_st7789_load(&lcd, &coord, (const uint8_t *)s_display_buf);
|
|
|
|
for (;;) {
|
|
GPIO_PortToggle(BOARD_INITLEDPINS_LEDA_GPIO, BOARD_INITLEDPINS_LEDA_PIN_MASK);
|
|
vTaskDelay(pdMS_TO_TICKS(250));
|
|
}
|
|
} |