GD32H759I-EVAL开发板板载一个RGB的液晶屏,使用了MCU的TLI外设来驱动的,这个TLI外设很强大,是专用于驱动RGB液晶屏的接口。TLI支持两个独立的显示层,并支持层窗口和层混叠功能。
下面就来试试这个TLI外设驱动LCD屏测试一下效果。
开发板的mcu与RGB屏接口如下。要注意跳线帽配置,因为RGB液晶屏占用GPIO比较多,与其他外设有共用引脚。

下面就开始初始化TLI外设。参考例子代码,首先初始化用到的GPIO引脚,然后就是TLI。代码如下:
这里使用了SDRAM作为LCD的显存,还要添加SDRAM驱动。
#include "gd32h759i_lcd_eval.h"
#include "gd32h759i_eval_exmc_sdram.h"
#include <string.h>
#define LCD_FRAME_BUFFER ((uint32_t)0xC0000000)
#define BUFFER_OFFSET ((uint32_t)0x7F800) //480*272*4
static font_struct *current_font;
static uint16_t current_textcolor = 0x0000;
static uint16_t current_backcolor = 0xFFFF;
static uint32_t current_framebuffer = LCD_FRAME_BUFFER;
static uint32_t current_layer = LCD_LAYER_BACKGROUND;
static void lcd_char_draw(uint16_t xpos, uint16_t ypos, const uint16_t *c);
static void lcd_vertical_char_draw(uint16_t xpos, uint16_t ypos, const uint16_t *c);
static void pixel_set(int16_t x, int16_t y);
#define HORIZONTAL_SYNCHRONOUS_PULSE 41
#define HORIZONTAL_BACK_PORCH 2
#define ACTIVE_WIDTH 480
#define HORIZONTAL_FRONT_PORCH 2
#define VERTICAL_SYNCHRONOUS_PULSE 10
#define VERTICAL_BACK_PORCH 2
#define ACTIVE_HEIGHT 272
#define VERTICAL_FRONT_PORCH 2
/*!
\brief initialize the LCD GPIO and TLI
\param[in] none
\param[out] none
\retval none
*/
void lcd_init(void)
{
tli_parameter_struct tli_init_struct;
/* enable GPIO clock */
rcu_periph_clock_enable(RCU_GPIOA);
rcu_periph_clock_enable(RCU_GPIOB);
rcu_periph_clock_enable(RCU_GPIOC);
rcu_periph_clock_enable(RCU_GPIOD);
rcu_periph_clock_enable(RCU_GPIOE);
rcu_periph_clock_enable(RCU_GPIOF);
rcu_periph_clock_enable(RCU_GPIOH);
rcu_periph_clock_enable(RCU_GPIOG);
/* configure HSYNC(PE15), VSYNC(PA7), PCLK(PG7) */
gpio_af_set(GPIOE, GPIO_AF_14, GPIO_PIN_15);
gpio_af_set(GPIOA, GPIO_AF_14, GPIO_PIN_7);
gpio_af_set(GPIOG, GPIO_AF_14, GPIO_PIN_7);
gpio_mode_set(GPIOE, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_15);
gpio_output_options_set(GPIOE, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_15);
gpio_mode_set(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_7);
gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_7);
gpio_mode_set(GPIOG, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_7);
gpio_output_options_set(GPIOG, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_7);
/* configure LCD_R7(PG6), LCD_R6(PH12), LCD_R5(PH11), LCD_R4(PA5), LCD_R3(PH9),LCD_R2(PH8),
LCD_R1(PH3), LCD_R0(PH2) */
gpio_af_set(GPIOG, GPIO_AF_14, GPIO_PIN_6);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_12);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_11);
gpio_af_set(GPIOA, GPIO_AF_14, GPIO_PIN_5);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_9);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_8);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_3);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_2);
gpio_mode_set(GPIOG, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_6);
gpio_output_options_set(GPIOG, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_6);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_12);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_12);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_11);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_11);
gpio_mode_set(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_5);
gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_5);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_9);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_9);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_8);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_8);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_3);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_3);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_2);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_2);
/* configure LCD_G7(PD3), LCD_G6(PC7), LCD_G5(PC1), LCD_G4(PH15), LCD_G3(PH14), LCD_G2(PH13),LCD_G1(PB0), LCD_G0(PB1) */
gpio_af_set(GPIOD, GPIO_AF_14, GPIO_PIN_3);
gpio_af_set(GPIOC, GPIO_AF_14, GPIO_PIN_7);
gpio_af_set(GPIOC, GPIO_AF_14, GPIO_PIN_1);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_15);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_14);
gpio_af_set(GPIOH, GPIO_AF_14, GPIO_PIN_13);
gpio_af_set(GPIOB, GPIO_AF_14, GPIO_PIN_0);
gpio_af_set(GPIOB, GPIO_AF_14, GPIO_PIN_1);
gpio_mode_set(GPIOD, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_3);
gpio_output_options_set(GPIOD, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_3);
gpio_mode_set(GPIOC, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_7);
gpio_output_options_set(GPIOC, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_7);
gpio_mode_set(GPIOC, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_1);
gpio_output_options_set(GPIOC, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_1);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_15);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_15);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_14);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_14);
gpio_mode_set(GPIOH, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_13);
gpio_output_options_set(GPIOH, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_13);
gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_0);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_0);
gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_1);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_1);
/* configure LCD_B7(PB9), LCD_B6(PB8), LCD_B5(PB5), LCD_B4(PC11), LCD_B3(PG11),LCD_B2(PG10), LCD_B1(PG12), LCD_B0(PG14) */
gpio_af_set(GPIOB, GPIO_AF_14, GPIO_PIN_9);
gpio_af_set(GPIOB, GPIO_AF_14, GPIO_PIN_8);
gpio_af_set(GPIOB, GPIO_AF_3, GPIO_PIN_5);
gpio_af_set(GPIOC, GPIO_AF_14, GPIO_PIN_11);
gpio_af_set(GPIOG, GPIO_AF_14, GPIO_PIN_11);
gpio_af_set(GPIOG, GPIO_AF_14, GPIO_PIN_10);
gpio_af_set(GPIOG, GPIO_AF_14, GPIO_PIN_12);
gpio_af_set(GPIOG, GPIO_AF_14, GPIO_PIN_14);
gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_9);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_9);
gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_8);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_8);
gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_5);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_5);
gpio_mode_set(GPIOC, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_11);
gpio_output_options_set(GPIOC, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_11);
gpio_mode_set(GPIOG, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_11);
gpio_output_options_set(GPIOG, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_11);
gpio_mode_set(GPIOG, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_10);
gpio_output_options_set(GPIOG, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_10);
gpio_mode_set(GPIOG, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_12);
gpio_output_options_set(GPIOG, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_12);
gpio_mode_set(GPIOG, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_14);
gpio_output_options_set(GPIOG, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_14);
/* configure LCD_DE(PF10) */
gpio_af_set(GPIOF, GPIO_AF_14, GPIO_PIN_10);
gpio_mode_set(GPIOF, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_10);
gpio_output_options_set(GPIOF, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_10);
/* LCD PWM BackLight(PG13) */
gpio_mode_set(GPIOG, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, GPIO_PIN_13);
gpio_output_options_set(GPIOG, GPIO_OTYPE_PP, GPIO_OSPEED_100_220MHZ, GPIO_PIN_13);
gpio_bit_set(GPIOG, GPIO_PIN_13);
rcu_periph_clock_enable(RCU_TLI);
/* configure PLL2 to generate TLI clock 25MHz/25*192/3 = 64MHz*/
rcu_pll_input_output_clock_range_config(IDX_PLL1,RCU_PLL1RNG_1M_2M,RCU_PLL1VCO_192M_836M);
if(ERROR == rcu_pll2_config(25,192,3,3,3)){
while(1){
}
}
rcu_pll_clock_output_enable(RCU_PLL2R);
rcu_tli_clock_div_config(RCU_PLL2R_DIV8);
rcu_osci_on(RCU_PLL2_CK);
if(ERROR == rcu_osci_stab_wait(RCU_PLL2_CK)){
while(1){
}
}
/* configure the EXMC access mode */
exmc_synchronous_dynamic_ram_init(EXMC_SDRAM_DEVICE0);
/* TLI initialization */
tli_init_struct.signalpolarity_hs = TLI_HSYN_ACTLIVE_LOW;
tli_init_struct.signalpolarity_vs = TLI_VSYN_ACTLIVE_LOW;
tli_init_struct.signalpolarity_de = TLI_DE_ACTLIVE_LOW;
tli_init_struct.signalpolarity_pixelck = TLI_PIXEL_CLOCK_INVERTEDTLI;
/* LCD display timing configuration */
tli_init_struct.synpsz_hpsz = HORIZONTAL_SYNCHRONOUS_PULSE - 1;
tli_init_struct.synpsz_vpsz = VERTICAL_SYNCHRONOUS_PULSE - 1;
tli_init_struct.backpsz_hbpsz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH - 1;
tli_init_struct.backpsz_vbpsz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH - 1;
tli_init_struct.activesz_hasz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH + ACTIVE_WIDTH - 1;
tli_init_struct.activesz_vasz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH + ACTIVE_HEIGHT - 1;
tli_init_struct.totalsz_htsz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH + ACTIVE_WIDTH + HORIZONTAL_FRONT_PORCH - 1;
tli_init_struct.totalsz_vtsz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH + ACTIVE_HEIGHT + VERTICAL_FRONT_PORCH - 1;
/* LCD background color configure*/
tli_init_struct.backcolor_red = 0xFF;
tli_init_struct.backcolor_green = 0xFF;
tli_init_struct.backcolor_blue = 0xFF;
tli_init(&tli_init_struct);
}
复制代码然后就是初始化TLI的独立显示层Layer0和Layer1。
/*!
\brief initialize TLI layer0 or layer1
\param[in] layer: LCD layer
\arg LCD_LAYER_BACKGROUND
\arg LCD_LAYER_FOREGROUND
\param[in] width: width of the window
\param[in] height: height of the window
\param[out] none
\retval none
*/
void lcd_layer_init(uint32_t layer,uint16_t x_offset, uint16_t y_offset, uint16_t width, uint16_t height,uint8_t alpha)
{
tli_layer_parameter_struct tli_layer_init_struct;
if(LCD_LAYER_BACKGROUND == layer){
/* TLI layer0 configuration */
tli_layer_init_struct.layer_window_leftpos = (x_offset + HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH);
tli_layer_init_struct.layer_window_rightpos = (x_offset + width + HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH - 1);
tli_layer_init_struct.layer_window_toppos = (y_offset + VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH);
tli_layer_init_struct.layer_window_bottompos = (y_offset + height + VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH - 1);
tli_layer_init_struct.layer_ppf = LAYER_PPF_RGB565;
tli_layer_init_struct.layer_sa = alpha;
tli_layer_init_struct.layer_default_blue = 0x00;
tli_layer_init_struct.layer_default_green = 0x00;
tli_layer_init_struct.layer_default_red = 0x00;
tli_layer_init_struct.layer_default_alpha = 0xFF;
tli_layer_init_struct.layer_acf1 = LAYER_ACF1_PASA;
tli_layer_init_struct.layer_acf2 = LAYER_ACF2_PASA;
tli_layer_init_struct.layer_frame_bufaddr = LCD_FRAME_BUFFER;
tli_layer_init_struct.layer_frame_line_length = ((width * 2) + 3);
tli_layer_init_struct.layer_frame_buf_stride_offset = (width * 2);
tli_layer_init_struct.layer_frame_total_line_number = height;
tli_layer_init(LAYER0, &tli_layer_init_struct);
}else if(LCD_LAYER_FOREGROUND == layer){
/* TLI layer1 configuration */
tli_layer_init_struct.layer_window_leftpos = (x_offset + HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH);
tli_layer_init_struct.layer_window_rightpos = (x_offset + width + HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH - 1);
tli_layer_init_struct.layer_window_toppos = (y_offset + VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH);
tli_layer_init_struct.layer_window_bottompos = (y_offset + height + VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH - 1);
tli_layer_init_struct.layer_ppf = LAYER_PPF_RGB565;
tli_layer_init_struct.layer_sa = alpha;
tli_layer_init_struct.layer_default_blue = 0xFF;
tli_layer_init_struct.layer_default_green = 0xFF;
tli_layer_init_struct.layer_default_red = 0xFF;
tli_layer_init_struct.layer_default_alpha = 0x0;
tli_layer_init_struct.layer_acf1 = LAYER_ACF1_PASA;
tli_layer_init_struct.layer_acf2 = LAYER_ACF2_PASA;
tli_layer_init_struct.layer_frame_bufaddr = LCD_FRAME_BUFFER + BUFFER_OFFSET;
tli_layer_init_struct.layer_frame_line_length = ((width * 2) + 3);
tli_layer_init_struct.layer_frame_buf_stride_offset = (width * 2);
tli_layer_init_struct.layer_frame_total_line_number = height;
tli_layer_init(LAYER1, &tli_layer_init_struct);
}
tli_reload_config(TLI_REQUEST_RELOAD_EN);
lcd_font_set(&LCD_DEFAULT_FONT);
}
复制代码整体初始化,调用之后就可以显示LCD界面了。
/*!
\brief initializes the LCD of GD EVAL board
\param[in] none
\param[out] none
\retval none
*/
void gd_eval_lcd_init(void)
{
lcd_init();
lcd_layer_init(LCD_LAYER_BACKGROUND, 0,0,LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT,0xff);
lcd_layer_init(LCD_LAYER_FOREGROUND, 0,0,LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT,0x00);
tli_layer_enable(LAYER0);
tli_layer_enable(LAYER1);
tli_enable();
lcd_layer_set(LCD_LAYER_BACKGROUND);
lcd_transparency_set(255);
lcd_clear(LCD_COLOR_WHITE);
lcd_layer_set(LCD_LAYER_FOREGROUND);
lcd_transparency_set(128);
lcd_clear(LCD_COLOR_WHITE);
}
复制代码在下面是我添加的绘图函数,其他画点,画线,填充和字符显示使用例子的代码。
void lcd_draw_image(uint16_t xpos, uint16_t ypos,uint16_t width, uint16_t height, uint16_t *fb_color)
{
uint32_t x,y = 0;
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
{
*(__IO uint16_t*)(current_framebuffer + (2*(x+xpos) + (y+ypos) * LCD_PIXEL_WIDTH * 2)) = *fb_color++;
}
}
}
复制代码下面是main函数添加测试代码:
int main(void)
{
/* enable the CPU cache */
/* enable i-cache */
SCB_EnableICache();
/* enable d-cache */
SCB_EnableDCache();
/* configure systick */
systick_config();
init_cycle_counter(true);
gpio_config();
usart_config();
/* output a message on hyperterminal using printf function */
printf("\r\n USART printf example.\r\n");
gd_eval_lcd_init();
delay_ms(200);
lcd_layer_set(LCD_LAYER_FOREGROUND);
lcd_text_color_set(LCD_COLOR_RED);
lcd_background_color_set(LCD_COLOR_BLACK);
delay_ms(400);
lcd_layer_set(LCD_LAYER_BACKGROUND);
lcd_transparency_set(128);
lcd_clear(LCD_COLOR_RED);
lcd_string_display(80,(uint8_t *)"RED ");
delay_ms(400);
lcd_clear(LCD_COLOR_GREEN);
lcd_string_display(80,(uint8_t *)"GREEN ");
delay_ms(400);
lcd_clear(LCD_COLOR_BLUE);
lcd_string_display(80,(uint8_t *)"BLUE ");
delay_ms(400);
lcd_clear(LCD_COLOR_YELLOW);
lcd_string_display(80,(uint8_t *)"YELLOW ");
delay_ms(400);
lcd_clear(LCD_COLOR_CYAN);
lcd_string_display(80,(uint8_t *)"CYAN ");
delay_ms(400);
lcd_clear(LCD_COLOR_MAGENTA);
lcd_string_display(80,(uint8_t *)"MAGENTA");
delay_ms(400);
lcd_clear(LCD_COLOR_WHITE);
lcd_string_display(40,(uint8_t *)"GD32H759 LCD Layer0 Color.");
delay_ms(1000);
lcd_layer_set(LCD_LAYER_FOREGROUND);
lcd_transparency_set(255);
lcd_clear(LCD_COLOR_RED);
lcd_string_display(120,(uint8_t *)"RED ");
delay_ms(400);
lcd_clear(LCD_COLOR_GREEN);
lcd_string_display(120,(uint8_t *)"GREEN ");
delay_ms(400);
lcd_clear(LCD_COLOR_BLUE);
lcd_string_display(120,(uint8_t *)"BLUE ");
delay_ms(400);
lcd_clear(LCD_COLOR_YELLOW);
lcd_string_display(120,(uint8_t *)"YELLOW ");
delay_ms(400);
lcd_clear(LCD_COLOR_CYAN);
lcd_string_display(120,(uint8_t *)"CYAN ");
delay_ms(400);
lcd_clear(LCD_COLOR_MAGENTA);
lcd_string_display(120,(uint8_t *)"MAGENTA");
delay_ms(400);
lcd_clear(LCD_COLOR_BLUE);
lcd_string_display(0,(uint8_t *)"GD32H759 LCD Layer1 Color.");
for(int i=0;i<100;i+=10)
{
lcd_draw_image(20+i*2,30+i,247,118,(uint16_t *)gImage_image1);
delay_ms(200);
}
while(1)
{
GPIO_TG(LED2_GPIO_PORT) = LED2_PIN;
delay_1ms(100);
GPIO_TG(LED1_GPIO_PORT) = LED1_PIN;
delay_1ms(100);
if(gpio_input_bit_get(TAMPER_KEY_GPIO_PORT, TAMPER_KEY_PIN) == RESET)
{
printf("\r\n TAMPER_KEY Press.\r\n");
}
if(gpio_input_bit_get(WAKEUP_KEY_GPIO_PORT, WAKEUP_KEY_PIN) == RESET)
{
printf("\r\n WAKEUP_KEY Press.\r\n");
}
if(gpio_input_bit_get(USER_KEY_GPIO_PORT, USER_KEY_PIN) == RESET)
{
printf("\r\n USER_KEY Press.\r\n");
}
}
}
复制代码整体工程结构如下:

工程如下:

热门资料
热门活动
全部回复 1
- 0 主题
- 5 帖子
- 219 积分
身份:LV1 技术小白
E币:204
发消息
大佬你好,想租用以下GD32H759I-EVAL板子参加验电赛用,诚心,可以联系我哦微信T17754923932