当前位置: 首页 > news >正文

甘肃省建设厅执业资格注册中心网站seo关键词外包公司

甘肃省建设厅执业资格注册中心网站,seo关键词外包公司,在哪个网站里下载的图片可以做展架,在上面网站上可以做统计图本篇文章来自极术社区与兆易创新组织的GD32F427开发板评测活动,更多开发板试用活动请关注极术社区网站。作者:hehung 之前发帖 【GD32F427开发板试用】1. 串口实现scanf输入控制LED 【GD32F427开发板试用】2. RT-Thread标准版移植 【GD32F427开发板试用…

本篇文章来自极术社区与兆易创新组织的GD32F427开发板评测活动,更多开发板试用活动请关注极术社区网站。作者:hehung

之前发帖

【GD32F427开发板试用】1. 串口实现scanf输入控制LED
【GD32F427开发板试用】2. RT-Thread标准版移植
【GD32F427开发板试用】3. 硬件IIC0驱动OLED显示中文
【GD32F427开发板试用】4. ADC采集摇杆模块移动量

前言

本文实现了使用GD32FF427V-START板子的SPI1驱动TFTLCD,LCD是2.2寸的ILI9341屏,不带触摸功能,这块屏幕是我从n年前参加兆易创新比赛获得的奖品GD32E230C-EVAL开发板上薅下来的,这块板子已经吃灰多年,没有派上什么用处,这次想起来还有这么一块板子,遂将LCD屏幕取下来,使用GD32F427V驱动试一下。
遗憾的是这块屏幕一直有一条蓝色的竖线,可能是放的时间太久了,电路有了断点。
本文实现功能如下:

  1. 基于RT-Thread Studio开发,基于RT-Thread OS;
  2. 使用SPI1驱动;
  3. 完成英文字符显示。

LCD屏资料

我手头并没有这块LCD屏幕的资料,遂到GD官网找了一番,还是没有,然后在万能的淘宝上才找到了资料。
资料网址:2.2inch SPI Module ILI9341 SKU: MSP2202

这个网址介绍的很详细,本文不做赘述。
下图是产品参数:

下图是引脚连接,引脚布局很重要,后面都需要连接到单片机上使用:

线路连接

知道了LCD的引脚布局,接下来就是与单片机连接了,这块LCD是SPI驱动的,所以我们需要选择一路SPI作为我们的驱动总线,本文选择了SPI1。
SPI硬件连接如下图,复用关系为AF5。

线路连接如下:

GD32F427V-STARTTFTLCD Pin
3.3VVCC
GNDGND
PB0CS
PB1RESET
PB12DC/RS
PB15SDI/MOSI
PB13SCK
3.3VLED
PB14SDO/MISO

软件实现

软件也是在GD32E230C-EVAL板子提供的源码基础上修改而来的,适配了我定义的这几个引脚,,该驱动程序不止适用于该LCD,也适用于其他的ILI9341驱动芯片的屏幕。

驱动代码由三个文件组成:
app_tftlcd_drv.c;
app_tftlcd_drv.h;
app_tftlcd_font.h。

app_tftlcd_drv.c

该文件主要实现了spi1以及使用到的其他IO口的初始化以及LCD屏幕的驱动代码。

/** @hehung* 2022-12-11* 转载请注明出处*/
#include "app_tftlcd_drv.h"
#include "app_tftlcd_font.h"
#include <rtthread.h>
#include "gd32f4xx.h"#define H_VIEW#ifdef H_VIEW#define X_MAX_PIXEL         320#define Y_MAX_PIXEL         240
#else#define X_MAX_PIXEL         240#define Y_MAX_PIXEL         320
#endifstatic uint8_t spi_write_byte(uint32_t spi_periph,uint8_t byte);
static void spi1_init(void);
static void lcd_write_index(uint8_t index);
static void lcd_write_data(uint8_t data);static void lcd_write_data_16bit(uint8_t datah,uint8_t datal);
static void lcd_reset(void);/*!\brief      write an unsigned 8-bit bytes\param[in]  spi_periph: SPIx(x=0,1,2)\param[in]  byte: write byte\param[out] none\retval     none
*/
static uint8_t spi_write_byte(uint32_t spi_periph,uint8_t byte)
{
//    SPI_CTL1(spi_periph) |= SPI_CTL1_BYTEN;while(RESET == (SPI_STAT(spi_periph)&SPI_FLAG_TBE));SPI_DATA(spi_periph) = byte;while(RESET == (SPI_STAT(spi_periph)&SPI_FLAG_RBNE));return(SPI_DATA(spi_periph));
} /*!\brief      init SPI1\param[in]  none\param[out] none\retval     none
*/
static void spi1_init(void)
{spi_parameter_struct spi_init_struct;/* enable the gpio clock */rcu_periph_clock_enable(RCU_GPIOB);rcu_periph_clock_enable(RCU_SPI1);/* GPIOB config, PB13(SPI1_SCK), PB14(SPI1_MISO), PB15(LCD_SPI1_MOSI) */gpio_af_set(GPIOB, GPIO_AF_5, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);/* GPIOB config */gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_12);gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_12);/* SPI1 parameter config */spi_init_struct.trans_mode           = SPI_TRANSMODE_FULLDUPLEX;spi_init_struct.device_mode          = SPI_MASTER;spi_init_struct.frame_size           = SPI_FRAMESIZE_8BIT;spi_init_struct.clock_polarity_phase = SPI_CK_PL_HIGH_PH_2EDGE;spi_init_struct.nss                  = SPI_NSS_SOFT;spi_init_struct.prescale             = SPI_PSC_32;spi_init_struct.endian               = SPI_ENDIAN_MSB;spi_init(SPI1, &spi_init_struct);/* set crc polynomial */spi_enable(SPI1);
}/*!\brief      write the register address\param[in]  index: register address\param[out] none\retval     none
*/
static void lcd_write_index(uint8_t index)
{LCD_RS_CLR;spi_write_byte(SPI1,index);
}/*!\brief      write the register data\param[in]  data: register data\param[out] none\retval     none
*/
static void lcd_write_data(uint8_t data)
{LCD_RS_SET;spi_write_byte(SPI1,data);
}/*!\brief      write the register data(an unsigned 16-bit data)\param[in]  datah: register data high 8bit\param[in]  datal: register data low 8bit\param[out] none\retval     none
*/
static void lcd_write_data_16bit(uint8_t datah,uint8_t datal)
{lcd_write_data(datah);lcd_write_data(datal);
}/*!\brief      lcd reset\param[in]  none\param[out] none\retval     none
*/
static void lcd_reset(void)
{LCD_RST_CLR;rt_thread_mdelay(100);LCD_RST_SET;rt_thread_mdelay(50);
}/*!\brief      lcd init\param[in]  none\param[out] none\retval     none
*/
void lcd_init(void)
{spi1_init();LCD_CS_CLR;lcd_reset();/* write the register address 0xCB*/lcd_write_index(0xCB);lcd_write_data(0x39);lcd_write_data(0x2C);lcd_write_data(0x00);lcd_write_data(0x34);lcd_write_data(0x02);/* write the register address 0xCF*/lcd_write_index(0xCF);lcd_write_data(0x00);lcd_write_data(0XC1);lcd_write_data(0X30);/* write the register address 0xE8*/lcd_write_index(0xE8);lcd_write_data(0x85);lcd_write_data(0x00);lcd_write_data(0x78);/* write the register address 0xEA*/lcd_write_index(0xEA);lcd_write_data(0x00);lcd_write_data(0x00);/* write the register address 0xED*/lcd_write_index(0xED);lcd_write_data(0x64);lcd_write_data(0x03);lcd_write_data(0X12);lcd_write_data(0X81);/* write the register address 0xF7*/lcd_write_index(0xF7);lcd_write_data(0x20);/* power control VRH[5:0] */lcd_write_index(0xC0);lcd_write_data(0x23);/* power control SAP[2:0];BT[3:0] */lcd_write_index(0xC1);lcd_write_data(0x10);/* vcm control */lcd_write_index(0xC5);lcd_write_data(0x3e);lcd_write_data(0x28); /* vcm control2 */lcd_write_index(0xC7);lcd_write_data(0x86);lcd_write_index(0x36);
#ifdef H_VIEWlcd_write_data(0xE8);
#elselcd_write_data(0x48); 
#endif/* write the register address 0x3A*/lcd_write_index(0x3A);lcd_write_data(0x55);/* write the register address 0xB1*/lcd_write_index(0xB1);lcd_write_data(0x00);lcd_write_data(0x18);/* display function control */lcd_write_index(0xB6);lcd_write_data(0x08); lcd_write_data(0x82);lcd_write_data(0x27);  /* 3gamma function disable */lcd_write_index(0xF2);lcd_write_data(0x00); /* gamma curve selected  */lcd_write_index(0x26);lcd_write_data(0x01); /* set gamma  */lcd_write_index(0xE0);lcd_write_data(0x0F);lcd_write_data(0x31);lcd_write_data(0x2B);lcd_write_data(0x0C);lcd_write_data(0x0E);lcd_write_data(0x08);lcd_write_data(0x4E);lcd_write_data(0xF1);lcd_write_data(0x37);lcd_write_data(0x07);lcd_write_data(0x10);lcd_write_data(0x03);lcd_write_data(0x0E);lcd_write_data(0x09);lcd_write_data(0x00);/* set gamma  */lcd_write_index(0XE1);lcd_write_data(0x00);lcd_write_data(0x0E);lcd_write_data(0x14);lcd_write_data(0x03);lcd_write_data(0x11);lcd_write_data(0x07);lcd_write_data(0x31);lcd_write_data(0xC1);lcd_write_data(0x48);lcd_write_data(0x08);lcd_write_data(0x0F);lcd_write_data(0x0C);lcd_write_data(0x31);lcd_write_data(0x36);lcd_write_data(0x0F);/* exit sleep */lcd_write_index(0x11);rt_thread_mdelay(120);/* display on */lcd_write_index(0x29);lcd_write_index(0x2c);LCD_CS_SET;
}/*!\brief      set lcd display region\param[in]  x_start: the x position of the start point\param[in]  y_start: the y position of the start point\param[in]  x_end: the x position of the end point\param[in]  y_end: the y position of the end point\param[out] none\retval     none
*/
void lcd_set_region(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end)
{LCD_CS_CLR;/* write the register address 0x2A*/lcd_write_index(0x2A);lcd_write_data_16bit(x_start >> 8,x_start);lcd_write_data_16bit(x_end >> 8,x_end);/* write the register address 0x2B*/lcd_write_index(0x2B);lcd_write_data_16bit(y_start >> 8,y_start);lcd_write_data_16bit(y_end >> 8,y_end);/* write the register address 0x2C*/lcd_write_index(0x2C);LCD_CS_SET;
}/*!\brief      set the start display point of lcd\param[in]  x: the x position of the start point\param[in]  y: the y position of the start point\param[out] none\retval     none
*/
void lcd_set_xy(uint16_t x,uint16_t y)
{/* write the register address 0x2A*/lcd_write_index(0x2A);lcd_write_data_16bit(x >> 8,x);/* write the register address 0x2B*/lcd_write_index(0x2B);lcd_write_data_16bit(y >> 8,y);/* write the register address 0x2C*/lcd_write_index(0x2C);
}/*!\brief      draw a point on the lcd\param[in]  x: the x position of the point \param[in]  y: the y position of the point \param[in]  data: write the register data\param[out] none\retval     none
*/
void lcd_draw_point(uint16_t x,uint16_t y,uint16_t data)
{lcd_set_xy(x,y);lcd_write_data(data >> 8);lcd_write_data(data);
}/*!\brief      clear the lcd\param[in]  color: lcd display color \param[out] none\retval     none
*/
void lcd_clear(uint16_t color)
{unsigned int i,m;/* set lcd display region */lcd_set_region(0,0,X_MAX_PIXEL - 1,Y_MAX_PIXEL - 1);LCD_RS_SET;LCD_CS_CLR;for(i = 0;i < Y_MAX_PIXEL;i ++){for(m = 0;m < X_MAX_PIXEL;m ++){spi_write_byte(SPI1,color >> 8);spi_write_byte(SPI1,color);}}LCD_CS_SET;
}/*!\brief      bgr to rgb format conversion\param[in]  c: bgr color value\param[out] none\retval     rgb color value
*/
uint16_t lcd_bgr2rgb(uint16_t c)
{uint16_t r,g,b,rgb;b = (c >> 0) & 0x1f;g = (c >> 5) & 0x3f;r = (c >> 11) & 0x1f;rgb = (b << 11) + (g << 5) + (r << 0);return(rgb);
}/*!\brief      gui circle\param[in]  x: the x position of the start point \param[in]  y: the y position of the start point\param[in]  r: the radius of circle\param[in]  fc: display color of font\param[out] none\retval     none
*/
void lcd_circle_draw(uint16_t x,uint16_t y,uint16_t r,uint16_t fc)
{unsigned short a,b;int c;a = 0;b = r;c = 3 - 2 * r;LCD_CS_CLR;while(a < b){/* draw points on the lcd */lcd_draw_point(x + a,y + b,fc);lcd_draw_point(x - a,y + b,fc);lcd_draw_point(x + a,y - b,fc);lcd_draw_point(x - a,y - b,fc);lcd_draw_point(x + b,y + a,fc);lcd_draw_point(x - b,y + a,fc);lcd_draw_point(x + b,y - a,fc);lcd_draw_point(x - b,y - a,fc);if(c < 0)c = c + 4 * a + 6;else{ c = c + 4 * (a - b) + 10;b -= 1; } a += 1;} if(a == b){/* draw points on the lcd */lcd_draw_point(x + a,y + b,fc);lcd_draw_point(x + a,y + b,fc);lcd_draw_point(x + a,y - b,fc);lcd_draw_point(x - a,y - b,fc);lcd_draw_point(x + b,y + a,fc);lcd_draw_point(x - b,y + a,fc);lcd_draw_point(x + b,y - a,fc);lcd_draw_point(x - b,y - a,fc);} LCD_CS_SET;
}/*!\brief      gui draw line\param[in]  x0: the x position of the start point\param[in]  y0: the y position of the start point\param[in]  x1: the x position of the end point\param[in]  y1: the y position of the end point\param[in]  color: lcd display color\param[out] none\retval     none
*/
void lcd_line_draw(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1,uint16_t color)
{/* - difference in x's- difference in y's- dx,dy * 2- amount in pixel space to move during drawing- amount in pixel space to move during drawing- the discriminant i.e. error i.e. decision variable- used for looping */int dx,dy,dx2,dy2,x_inc,y_inc,error,index;LCD_CS_CLR;lcd_set_xy(x0,y0);/* calculate x distance */dx = x1 - x0;/* calculate y distance */dy = y1 - y0;if(dx >= 0){x_inc = 1;}else{x_inc = -1;dx = -dx;} if(dy >= 0){y_inc = 1;}else{y_inc = -1;dy    = -dy; } dx2 = dx << 1;dy2 = dy << 1;if(dx > dy){/* initialize error */error = dy2 - dx;/* draw the line */for(index = 0;index <= dx;index ++){lcd_draw_point(x0,y0,color);/* test if error has overflowed */if(0 <= error){error -= dx2;/* move to next line */y0 += y_inc;}/* adjust the error term */error += dy2;/* move to the next pixel */x0 += x_inc;}}else{/* initialize error term */error = dx2 - dy;/* draw the linedraw the line*/for(index = 0;index <= dy;index ++){/* set the pixel */lcd_draw_point(x0,y0,color);/* test if error overflowed */if(0 <= error){error -= dy2;/* move to next line */x0 += x_inc;}/* adjust the error term */error += dx2;/* move to the next pixel */y0 += y_inc;}}LCD_CS_SET;
}/*!\brief      gui box\param[in]  x: the x position of the start point\param[in]  y: the y position of the start point\param[in]  w: the width of the box\param[in]  h: the high of the box\param[in]  bc: display background color\param[out] none\retval     none
*/
void lcd_rect_draw(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint16_t line_color)
{LCD_CS_CLR;/* gui draw line*/lcd_line_draw(x,y,x + w,y,line_color);lcd_line_draw(x + w,y,x + w,y + h,line_color);lcd_line_draw(x,y + h,x + w,y + h,line_color);lcd_line_draw(x,y,x,y + h,line_color);LCD_CS_SET;
}/*!\brief      lcd box\param[in]  x: the x position of the start point\param[in]  y: the y position of the start point\param[in]  w: the width of the box\param[in]  h: the high of the box\param[in]  bc: display background color\param[out] none\retval     none
*/
void lcd_box(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint16_t bc)
{LCD_CS_CLR;/* gui draw line*/lcd_line_draw(x,y,x + w,y,0xEF7D);lcd_line_draw(x + w - 1,y + 1,x + w-1,y + 1 + h,0x2965);lcd_line_draw(x,y + h,x + w,y + h,0x2965);lcd_line_draw(x,y,x,y + h,0xEF7D);lcd_line_draw(x + 1,y + 1,x + 1 + w - 2,y + 1 + h - 2,bc);LCD_CS_SET;
}/*!\brief      lcd box2\param[in]  x: the x position of the start point\param[in]  y: the y position of the start point\param[in]  w: the width of the box\param[in]  h: the high of the box\param[in]  mode: display color combination mode \param[out] none\retval     none
*/
void lcd_box2(uint16_t x,uint16_t y,uint16_t w,uint16_t h, uint8_t mode)
{LCD_CS_CLR;/* gui box2 display mode0 */if(0 == mode){lcd_line_draw(x,y,x + w,y,0xEF7D);lcd_line_draw(x + w - 1,y + 1,x + w - 1,y + 1 + h,0x2965);lcd_line_draw(x,y + h,x + w,y + h,0x2965);lcd_line_draw(x,y,x,y + h,0xEF7D);}/* gui box2 display mode1 */if(1 == mode){lcd_line_draw(x,y,x + w,y,0x2965);lcd_line_draw(x + w - 1,y + 1,x + w - 1,y + 1 + h,0xEF7D);lcd_line_draw(x,y + h,x + w,y + h,0xEF7D);lcd_line_draw(x,y,x,y + h,0x2965);}/* gui box2 display mode2 */if(2 == mode){lcd_line_draw(x,y,x + w,y,0xffff);lcd_line_draw(x + w - 1,y + 1,x + w - 1,y + 1 + h,0xffff);lcd_line_draw(x,y + h,x + w,y + h,0xffff);lcd_line_draw(x,y,x,y + h,0xffff);}LCD_CS_SET;
}/*!\brief      gui rect\param[in]  x1: the x position of the start point\param[in]  y1: the y position of the start point\param[in]  x2: the x position of the end point\param[in]  y2: the y position of the end point\param[in]  fc: display color of font\param[out] none\retval     none
*/
void lcd_rect_color_draw(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2,uint16_t fc)
{int ix,iy;LCD_CS_CLR;for(ix = x1;ix < x2;ix ++){for(iy = y1;iy < y2;iy ++)/* set the pixel */lcd_draw_point(ix,iy,fc);}LCD_CS_SET;
}/*!\brief      display button down\param[in]  x1: the x position of the start point\param[in]  y1: the y position of the start point\param[in]  x2: the x position of the end point\param[in]  y2: the y position of the end point\param[out] none\retval     none
*/
void display_button_down(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2)
{LCD_CS_CLR;/* gui draw line with gray color*/lcd_line_draw(x1,y1,x2,y1,GRAY2);lcd_line_draw(x1 + 1,y1 + 1,x2,y1 + 1,GRAY1);lcd_line_draw(x1,y1,x1,y2,GRAY2);lcd_line_draw(x1 + 1,y1 + 1,x1 + 1,y2,GRAY1);/* gui draw line with white color*/lcd_line_draw(x1,y2,x2,y2,WHITE);lcd_line_draw(x2,y1,x2,y2,WHITE);LCD_CS_SET;
}/*!\brief      display button up\param[in]  x1: the x position of the start point\param[in]  y1: the y position of the start point\param[in]  x2: the x position of the end point\param[in]  y2: the y position of the end point\param[out] none\retval     none
*/
void display_button_up(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2)
{LCD_CS_CLR;/* gui draw line with white color*/lcd_line_draw(x1,y1,x2,y1,WHITE);lcd_line_draw(x1,y1,x1,y2,WHITE);/* gui draw line with gray color*/lcd_line_draw(x1 + 1,y2 - 1,x2,y2 - 1,GRAY1);lcd_line_draw(x1,y2,x2,y2,GRAY2);lcd_line_draw(x2 - 1,y1 + 1,x2 - 1,y2,GRAY1);lcd_line_draw(x2,y1,x2,y2,GRAY2);LCD_CS_SET;
}/*!\brief      gui draw font to gbk16\param[in]  x: the x position of the start point\param[in]  y: the y position of the start point\param[in]  fc: display color of font\param[in]  bc: display background color\param[in]  *s: display char\param[out] none\retval     none
*/
void lcd_draw_font_gbk16(uint16_t x,uint16_t y,uint16_t fc,uint16_t bc,char *s)
{unsigned char i,j;unsigned short k,x0;x0 = x;LCD_CS_CLR;while(*s){/* ASCII character table from 32 to 128 */if(((uint8_t)(*s)) < 128){k = *s;if(13 == k){x = x0;y += 16;}else{if(k > 32)k -= 32;else k = 0;for(i = 0;i < 16;i ++)for(j = 0;j < 8;j ++){if(asc16[k * 16 + i] & (0x80 >> j))/* draw a point on the lcd */lcd_draw_point(x + j,y + i,fc);else{if(fc != bc)/* draw a point on the lcd */lcd_draw_point(x + j,y + i,bc);}}x += 8;}s ++;}else{for(k = 0;k < hz16_num;k ++){if((hz16[k].Index[0] == *(s)) && (hz16[k].Index[1] == *(s + 1))){ for(i = 0;i < 16;i ++){for(j = 0; j < 8; j ++){if(hz16[k].Msk[i * 2] & (0x80 >> j))/* draw a point on the lcd */lcd_draw_point(x + j,y + i,fc);else{if(fc != bc)/* draw a point on the lcd */lcd_draw_point(x + j,y + i,bc);}}for(j = 0;j < 8;j ++){if(hz16[k].Msk[i * 2 + 1] & (0x80 >> j))/* draw a point on the lcd */lcd_draw_point(x + j + 8,y + i,fc);else{if(fc != bc)/* draw a point on the lcd */lcd_draw_point(x + j + 8,y + i,bc);}}}}}s += 2;x += 16;}}LCD_CS_SET;
}/*!\brief      gui draw font to gbk24\param[in]  x: the x position of the start point\param[in]  y: the y position of the start point\param[in]  fc: display color of font\param[in]  bc: display background color\param[in]  *s: display char\param[out] none\retval     none
*/
void lcd_draw_font_gbk24(uint16_t x,uint16_t y,uint16_t fc,uint16_t bc,char *s)
{unsigned char i,j;unsigned short k;LCD_CS_CLR;while(*s){/* ASCII character table from 32 to 128 */if(((uint8_t)(*s)) < 0x80){k = *s;if(k > 32)k -= 32;elsek = 0;for(i = 0;i < 16;i ++)for(j = 0;j < 8;j ++){if(asc16[k * 16 + i] & (0x80 >> j))/* draw a point on the lcd */lcd_draw_point(x + j,y + i,fc);else{if(fc != bc)/* draw a point on the lcd */lcd_draw_point(x + j,y + i,bc);}}s ++;x += 8;}else{for(k = 0;k < hz24_num;k ++){if((hz24[k].Index[0] == *(s)) && (hz24[k].Index[1] == *(s + 1))){ for(i = 0;i < 24;i ++){for(j = 0;j < 8;j ++){if(hz24[k].Msk[i * 3] & (0x80 >> j))/* draw a point on the lcd */lcd_draw_point(x + j,y + i,fc);else{if(fc != bc)/* draw a point on the lcd */lcd_draw_point(x + j,y + i,bc);}}for(j = 0;j < 8;j ++){if(hz24[k].Msk[i * 3 + 1] & (0x80 >> j))/* draw a point on the lcd */lcd_draw_point(x + j + 8,y + i,fc);else{if(fc != bc)/* draw a point on the lcd */lcd_draw_point(x + j + 8,y + i,bc);}}for(j = 0;j < 8;j ++){if(hz24[k].Msk[i * 3 + 2] & (0x80 >> j))/* draw a point on the lcd */lcd_draw_point(x + j + 16,y + i,fc);else{if(fc != bc)/* draw a point on the lcd */lcd_draw_point(x + j + 16,y + i,bc);}}}}}s += 2;x += 24;}}LCD_CS_SET;
}/*!\brief      gui draw font to num32\param[in]  x: the x position of the start point\param[in]  y: the y position of the start point\param[in]  fc: display color of font\param[in]  bc: display background color\param[in]  num: display num\param[out] none\retval     none
*/
void lcd_draw_font_num32(uint16_t x,uint16_t y,uint16_t fc,uint16_t bc,uint16_t num)
{unsigned char i,j,k,c;LCD_CS_CLR;for(i = 0;i < 32;i ++){for(j = 0;j < 4;j++){c = *(sz32 + num * 32 * 4 + i * 4 + j);for(k = 0;k < 8;k ++){if(c & (0x80 >> k))/* draw a point on the lcd */lcd_draw_point(x + j * 8 + k,y + i,fc);else{if(fc != bc)/* draw a point on the lcd */lcd_draw_point(x + j * 8 + k,y + i,bc);}}}}LCD_CS_SET;
}

app_tftlcd_drv.h

该文件体用app_tftlcd_drv.c实现的函数的头文件以及一些驱动总需要使用到的宏定义。

/** @hehung* 2022-12-11* 转载请注明出处*/
#ifndef APP_TFTLCD_DRV_H
#define APP_TFTLCD_DRV_H#include "stdint.h"/* Colors */
#define RED             0xf800
#define GREEN           0x07e0
#define BLUE            0x001f
#define WHITE           0xffff
#define BLACK           0x0000
#define YELLOW          0xFFE0/* GRAYs */
#define GRAY0           0xEF7D
#define GRAY1           0x8410
#define GRAY2           0x4208/* PB0 tft cs */
#define LCD_CS_SET      ((uint32_t)(GPIO_BOP(GPIOB) = GPIO_PIN_0))
#define LCD_CS_CLR      ((uint32_t)(GPIO_BC(GPIOB) = GPIO_PIN_0))/* PB12 tft rs/dc */
#define LCD_RS_SET      ((uint32_t)(GPIO_BOP(GPIOB) = GPIO_PIN_12))
#define LCD_RS_CLR      ((uint32_t)(GPIO_BC(GPIOB) = GPIO_PIN_12))/* PB1 tft rst */
#define LCD_RST_SET     ((uint32_t)(GPIO_BOP(GPIOB) = GPIO_PIN_1))
#define LCD_RST_CLR     ((uint32_t)(GPIO_BC(GPIOB) = GPIO_PIN_1))/* lcd init */
void lcd_init(void);
/* clear the lcd */
void lcd_clear(uint16_t color);
/* set the start display point of lcd */
void lcd_set_xy(uint16_t x,uint16_t y);
/* draw a point on the lcd */
void lcd_draw_point(uint16_t x,uint16_t y,uint16_t data);/* bgr to rgb format conversion */
uint16_t lcd_bgr2rgb(uint16_t c);
/* draw a circle on the lcd */
void lcd_circle_draw(uint16_t x,uint16_t y,uint16_t r,uint16_t fc);
/* draw a line on the LCD */
void lcd_line_draw(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1,uint16_t color);
/* LCD rectangle draw */
void lcd_rect_draw(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint16_t line_color);
/* LCD box */
void lcd_box(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint16_t bc);
/* LCD box2 */
void lcd_box2(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint8_t mode);
/* draw a rectangle with color on the lcd */
void lcd_rect_color_draw(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2,uint16_t fc);
/* display button down */
void display_button_down(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2);
/* display button up */
void display_button_up(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2);
/* draw gbk16 font on the LCD */
void lcd_draw_font_gbk16(uint16_t x,uint16_t y,uint16_t fc,uint16_t bc,char *s);
/* draw gbk24 font on the LCD */
void lcd_draw_font_gbk24(uint16_t x,uint16_t y,uint16_t fc,uint16_t bc,char *s);
/* draw num32 font on the LCD */
void lcd_draw_font_num32(uint16_t x,uint16_t y,uint16_t fc,uint16_t bc,uint16_t num);void lcd_region_set(uint16_t StartX, uint16_t StartY, uint16_t EndX, uint16_t EndY);#endif /* APP_TFTLCD_DRV_H */

app_tftlcd_font.h

该文件主要是字库,该LCD没有自带字库,需要我们自己做,该文件已经做好了英文字库,中文字库字符是24X24的,字库制作方式在本文前面提到的网址中有描述,如果需要,可以自行下载相应的软件制作,本文不做赘述。
用例中提供了16预计24像素大小的字体,如下:

/** @hehung* 2022-12-11* 转载请注明出处*/
#ifndef APP_TFTLCD_FONT_H
#define APP_TFTLCD_FONT_H#define USE_ONCHIP_FLASH_FONT 1const unsigned char asc16[] =
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* " " */0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x00, /* "!" */0x00,0x00,0x6C,0x6C,0x24,0x24,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* """ */0x00,0x24,0x24,0x24,0x24,0xFE,0x48,0x48,0x48,0x48,0xFC,0x90,0x90,0x90,0x90,0x00, /* "#" */0x00,0x10,0x3C,0x54,0x92,0x90,0x50,0x38,0x14,0x12,0x12,0x92,0x54,0x78,0x10,0x00, /* "$" */0x00,0x00,0x22,0x5C,0x94,0xA8,0x48,0x10,0x10,0x24,0x2A,0x52,0x54,0x88,0x00,0x00, /* "%" */0x00,0x00,0x30,0x48,0x48,0x50,0x20,0x6E,0x54,0x94,0x8C,0x88,0x8A,0x74,0x00,0x00, /* "&" */0x00,0x00,0x30,0x30,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* "'" */0x00,0x04,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x04,0x00, /* "(" */0x00,0x80,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80,0x00, /* ")" */0x00,0x00,0x00,0x00,0x10,0x54,0x38,0x10,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00, /* "*" */0x00,0x00,0x00,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, /* "+" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x20,0x00, /* "," */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* "-" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00, /* "." */0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00, /* "/" */0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00, /* "0" */0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00, /* "1" */0x00,0x00,0x38,0x44,0x82,0x82,0x04,0x08,0x10,0x20,0x40,0x82,0x84,0xFC,0x00,0x00, /* "2" */0x00,0x00,0x38,0x44,0x82,0x02,0x04,0x38,0x04,0x02,0x02,0x82,0x44,0x38,0x00,0x00, /* "3" */0x00,0x00,0x04,0x0C,0x14,0x14,0x24,0x24,0x44,0x44,0xFE,0x04,0x04,0x0E,0x00,0x00, /* "4" */0x00,0x00,0xFC,0x80,0x80,0x80,0xB8,0xC4,0x82,0x02,0x02,0x82,0x84,0x78,0x00,0x00, /* "5" */0x00,0x00,0x3C,0x42,0x82,0x80,0xB8,0xC4,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00, /* "6" */0x00,0x00,0x7E,0x42,0x82,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x10,0x10,0x00,0x00, /* "7" */0x00,0x00,0x38,0x44,0x82,0x82,0x44,0x38,0x44,0x82,0x82,0x82,0x44,0x38,0x00,0x00, /* "8" */0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x46,0x3A,0x02,0x82,0x44,0x38,0x00,0x00, /* "9" */0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00, /* ":" */0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x20,0x00,0x00, /* ";" */0x00,0x00,0x00,0x00,0x06,0x18,0x60,0x80,0x60,0x18,0x06,0x00,0x00,0x00,0x00,0x00, /* "<" */0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, /* "=" */0x00,0x00,0x00,0x00,0xC0,0x30,0x0C,0x02,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00, /* ">" */0x00,0x38,0x44,0x82,0x82,0x02,0x04,0x08,0x10,0x10,0x10,0x00,0x10,0x10,0x00,0x00, /* "?" */0x00,0x00,0x38,0x44,0x82,0x9A,0xAA,0xAA,0xAA,0xAA,0xAA,0x96,0x80,0x42,0x3C,0x00, /* "@" */0x00,0x00,0x10,0x10,0x10,0x28,0x28,0x28,0x44,0x44,0x7C,0x44,0x44,0xEE,0x00,0x00, /* "A" */0x00,0x00,0xFC,0x42,0x42,0x42,0x42,0x7C,0x42,0x42,0x42,0x42,0x42,0xFC,0x00,0x00, /* "B" */0x00,0x00,0x3C,0x44,0x82,0x80,0x80,0x80,0x80,0x80,0x82,0x82,0x44,0x38,0x00,0x00, /* "C" */0x00,0x00,0xF8,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0xF8,0x00,0x00, /* "D" */0x00,0x00,0xFC,0x44,0x42,0x40,0x44,0x7C,0x44,0x40,0x40,0x42,0x44,0xFC,0x00,0x00, /* "E" */0x00,0x00,0xFC,0x44,0x42,0x40,0x44,0x7C,0x44,0x40,0x40,0x40,0x40,0xF0,0x00,0x00, /* "F" */0x00,0x00,0x34,0x4C,0x82,0x80,0x80,0x80,0x8E,0x84,0x84,0x84,0x4C,0x34,0x00,0x00, /* "G" */0x00,0x00,0xEE,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x44,0xEE,0x00,0x00, /* "H" */0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00, /* "I" */0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x00, /* "J" */0x00,0x00,0xEE,0x44,0x48,0x48,0x50,0x60,0x50,0x48,0x48,0x44,0x44,0xEE,0x00,0x00, /* "K" */0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0x44,0xFC,0x00,0x00, /* "L" */0x00,0x00,0xC6,0x44,0x6C,0x6C,0x6C,0x54,0x54,0x54,0x44,0x44,0x44,0xEE,0x00,0x00, /* "M" */0x00,0x00,0xCE,0x44,0x64,0x64,0x64,0x54,0x54,0x4C,0x4C,0x4C,0x44,0xE4,0x00,0x00, /* "N" */0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00, /* "O" */0x00,0x00,0xF8,0x44,0x42,0x42,0x42,0x44,0x78,0x40,0x40,0x40,0x40,0xE0,0x00,0x00, /* "P" */0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0xBA,0x44,0x3C,0x02,0x00, /* "Q" */0x00,0x00,0xF0,0x48,0x44,0x44,0x44,0x48,0x70,0x48,0x44,0x44,0x44,0xE6,0x00,0x00, /* "R" */0x00,0x00,0x3C,0x44,0x82,0x80,0x40,0x30,0x0C,0x02,0x02,0x82,0x44,0x78,0x00,0x00, /* "S" */0x00,0x00,0x7C,0x54,0x92,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, /* "T" */0x00,0x00,0xEE,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, /* "U" */0x00,0x00,0xEE,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x28,0x10,0x10,0x10,0x00,0x00, /* "V" */0x00,0x00,0xEE,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x28,0x28,0x28,0x00,0x00, /* "W" */0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x44,0xEE,0x00,0x00, /* "X" */0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, /* "Y" */0x00,0x00,0x7E,0x44,0x84,0x08,0x08,0x10,0x20,0x20,0x40,0x82,0x84,0xFC,0x00,0x00, /* "Z" */0x00,0x1C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1C,0x00, /* "[" */0x00,0x00,0xEE,0x44,0x54,0x54,0xFE,0x54,0x54,0x54,0x28,0x28,0x28,0x28,0x00,0x00, /* "\" */0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, /* "]" */0x00,0x30,0x48,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* "^" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, /* "_" */0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* "`" */0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x84,0x04,0x7C,0x84,0x84,0x8C,0x76,0x00,0x00, /* "a" */0x00,0x00,0xC0,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x42,0x64,0x58,0x00,0x00, /* "b" */0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x80,0x80,0x80,0x80,0x44,0x38,0x00,0x00, /* "c" */0x00,0x00,0x0C,0x04,0x04,0x04,0x34,0x4C,0x84,0x84,0x84,0x84,0x4C,0x36,0x00,0x00, /* "d" */0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x84,0x84,0xFC,0x80,0x80,0x84,0x78,0x00,0x00, /* "e" */0x00,0x00,0x18,0x24,0x20,0x20,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* "f" */0x00,0x00,0x00,0x00,0x00,0x00,0x3A,0x44,0x44,0x78,0x80,0x7C,0x82,0x82,0x7C,0x00, /* "g" */0x00,0x00,0xC0,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0xEE,0x00,0x00, /* "h" */0x00,0x00,0x10,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, /* "i" */0x00,0x00,0x10,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00, /* "j" */0x00,0x00,0xC0,0x40,0x40,0x40,0x5C,0x48,0x50,0x60,0x50,0x48,0x44,0xEE,0x00,0x00, /* "k" */0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x11,0x10,0x10,0x10,0x10,0x10,0x39,0x00,0x00, /* "l" */0x00,0x00,0x00,0x00,0x00,0x00,0xAC,0xD2,0x92,0x92,0x92,0x92,0x92,0xD6,0x00,0x00, /* "m" */0x00,0x00,0x00,0x00,0x00,0x00,0x58,0xE4,0x44,0x44,0x44,0x44,0x44,0xEE,0x00,0x00, /* "n" */0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00, /* "o" */0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x64,0x42,0x42,0x42,0x64,0x58,0x40,0xE0,0x00, /* "p" */0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x4C,0x84,0x84,0x84,0x4C,0x34,0x04,0x0E,0x00, /* "q" */0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x30,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* "r" */0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x88,0x84,0x60,0x18,0x84,0x44,0x78,0x00,0x00, /* "s" */0x00,0x00,0x00,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00, /* "t" */0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, /* "u" */0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, /* "v" */0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x44,0x44,0x54,0x54,0x28,0x28,0x28,0x00,0x00, /* "w" */0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x44,0x28,0x10,0x10,0x28,0x44,0xEE,0x00,0x00, /* "x" */0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x10,0x10,0xA0,0xC0,0x00, /* "y" */0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x44,0x88,0x10,0x20,0x42,0x84,0xFC,0x00,0x00, /* "z" */0x00,0x0C,0x10,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x10,0x0C,0x00, /* "{" */0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, /* "|" */0x00,0xC0,0x20,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0x20,0x20,0xC0,0x00, /* "}" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x8C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* "~" */
};/* Digital tube font */
const unsigned char sz32[]={/* "0" */0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x1F,0xE0,0x00,0x01,0x80,0x06,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x01,0x80,0x06,0x00,0x00,0x1F,0xE0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x1F,0xE0,0x00,/* "1" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x03,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x03,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,/* "2" */0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x00,0x00,0x3F,0xF0,0x00,0x00,0xFF,0xF0,0x00,0x01,0xFF,0xE0,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x1F,0xE3,0x00,0x00,0x7F,0xF8,0x00,0x00,0x7F,0xF8,0x00,0x00,0x1F,0xE0,0x00,0x03,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x1F,0xF0,0x00,0x00,0x3F,0xF8,0x00,0x00,0x3F,0xFC,0x00,0x00,0x1F,0xFE,0x00,/* "3" */0x00,0x00,0x00,0x00,0x03,0xFF,0x80,0x00,0x01,0xFF,0xC0,0x00,0x00,0xFF,0xC0,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x7F,0x8C,0x00,0x01,0xFF,0xE0,0x00,0x01,0xFF,0xF0,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x18,0x00,0x00,0x7F,0x80,0x00,0x00,0xFF,0xC0,0x00,0x01,0xFF,0xC0,0x00,0x03,0xFF,0x80,0x00,/* "4" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x03,0x00,0x03,0x00,0x03,0x80,0x07,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0x1F,0xE3,0x00,0x00,0x7F,0xF8,0x00,0x00,0x7F,0xFC,0x00,0x00,0x1F,0xE0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,/* "5" */0x00,0x00,0x00,0x00,0x00,0x1F,0xFC,0x00,0x00,0x3F,0xF8,0x00,0x00,0x3F,0xF0,0x00,0x00,0x1F,0xE0,0x00,0x01,0x80,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0x1F,0xE0,0x00,0x00,0x7F,0xF8,0x00,0x00,0x7F,0xF8,0x00,0x00,0x1F,0xE0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x06,0x00,0x00,0x3F,0xE0,0x00,0x00,0x7F,0xF0,0x00,0x00,0xFF,0xF0,0x00,0x01,0xFF,0xE0,0x00,/* "6" */0x00,0x00,0x00,0x00,0x00,0x1F,0xFC,0x00,0x00,0x3F,0xF8,0x00,0x00,0x3F,0xF0,0x00,0x00,0x1F,0xE0,0x00,0x01,0x80,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0x1F,0xE0,0x00,0x00,0x7F,0xF8,0x00,0x00,0x7F,0xFC,0x00,0x00,0x1F,0xE0,0x00,0x03,0x00,0x03,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x01,0x80,0x06,0x00,0x00,0x1F,0xE0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x1F,0xE0,0x00,/* "7" */0x00,0x00,0x00,0x00,0x07,0xFF,0xE0,0x00,0x03,0xFF,0xC0,0x00,0x01,0xFF,0x88,0x00,0x00,0xFF,0x18,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,/* "8" */0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x1F,0xE0,0x00,0x01,0x80,0x06,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0x1F,0xE3,0x00,0x00,0x7F,0xF8,0x00,0x00,0x7F,0xFC,0x00,0x00,0x1F,0xE0,0x00,0x03,0x00,0x03,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x01,0x80,0x06,0x00,0x00,0x1F,0xE0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x1F,0xE0,0x00,/* "9" */0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x1F,0xE0,0x00,0x01,0x80,0x06,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0xC0,0x0F,0x00,0x03,0x1F,0xE3,0x00,0x00,0x7F,0xF8,0x00,0x00,0x7F,0xFC,0x00,0x00,0x1F,0xE0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x06,0x00,0x00,0x1F,0xE0,0x00,0x00,0x3F,0xF0,0x00,0x00,0x7F,0xF0,0x00,0x00,0xFF,0xE0,0x00,/* "." */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/* ":" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/* "%" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x06,0x00,0x0F,0xE0,0x06,0x00,0x00,0x00,0x0C,0x00,0x30,0x18,0x18,0x00,0x30,0x18,0x18,0x00,0x30,0x18,0x30,0x00,0x30,0x18,0x30,0x00,0x30,0x18,0x60,0x00,0x30,0x08,0xC0,0x00,0x07,0xC0,0xC0,0x00,0x0F,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x00,0x06,0x07,0xC0,0x00,0x06,0x30,0x18,0x00,0x0C,0x30,0x18,0x00,0x0C,0x30,0x18,0x00,0x18,0x30,0x18,0x00,0x30,0x30,0x18,0x00,0x30,0x30,0x18,0x00,0x60,0x00,0x00,0x00,0xC0,0x0F,0xE0,0x00,0xC0,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/* "℃" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0xE0,0x00,0x08,0x87,0xFC,0x00,0x08,0x8E,0x03,0x00,0x08,0x98,0x01,0x80,0x07,0x18,0x00,0x80,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x18,0x01,0x00,0x00,0x0C,0x03,0x00,0x00,0x07,0xFC,0x00,0x00,0x01,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/* "-" */0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x00,0x00,0x7F,0xF0,0x00,0x00,0x7F,0xE0,0x00,0x00,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};struct typFNT_GB162
{unsigned char Index[3];char Msk[32];
};#define hz16_num   100const struct typFNT_GB162 hz16[] = {"显",0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,0x10,0x10,0x1F,0xF0,0x04,0x40,0x44,0x44,0x24,0x44,0x14,0x48,0x14,0x50,0x04,0x40,0xFF,0xFE,0x00,0x00,"示",0x00,0x00,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x01,0x00,0x01,0x00,0x11,0x10,0x11,0x08,0x21,0x04,0x41,0x02,0x81,0x02,0x05,0x00,0x02,0x00,"测",0x00,0x04,0x27,0xC4,0x14,0x44,0x14,0x54,0x85,0x54,0x45,0x54,0x45,0x54,0x15,0x54,0x15,0x54,0x25,0x54,0xE5,0x54,0x21,0x04,0x22,0x84,0x22,0x44,0x24,0x14,0x08,0x08,"试",0x00,0x28,0x20,0x24,0x10,0x24,0x10,0x20,0x07,0xFE,0x00,0x20,0xF0,0x20,0x17,0xE0,0x11,0x20,0x11,0x10,0x11,0x10,0x15,0x10,0x19,0xCA,0x17,0x0A,0x02,0x06,0x00,0x02,
};struct typFNT_GB242
{unsigned char Index[3];char Msk[72];
};#define hz24_num   100/* Song typeface Bold Small 2 font */
const struct typFNT_GB242 hz24[] = 
{"显",0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0x00,0x0F,0x03,0xC0,0x0C,0x00,0x40,0x1F,0xF8,0x60,0x18,0x00,0x60,0x08,0x00,0x40,0x0E,0x01,0xC0,0x07,0xFF,0x00,0x00,0x00,0x00,0x01,0x84,0x00,0x01,0x84,0x00,0x19,0x87,0x80,0x0F,0x8C,0xE0,0x07,0x8C,0x20,0x00,0xCC,0x00,0x03,0xFF,0xE0,0x1F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,"示",0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x1F,0xFF,0xC0,0x00,0x7F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x3F,0xFF,0xE0,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x06,0x13,0x00,0x0C,0x13,0xC0,0x0C,0x18,0xF0,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,"测",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x39,0xFC,0x30,0x1F,0xCC,0x30,0x07,0x06,0xB0,0x0F,0x06,0xF0,0x19,0x07,0xB0,0x31,0x37,0xB0,0x31,0x36,0xF0,0x1F,0x27,0xF0,0x01,0x67,0xF0,0x01,0xE5,0xF0,0x01,0xE1,0xF0,0x00,0x41,0xF0,0x0C,0xF8,0xB0,0x3C,0xD8,0x30,0x00,0x8C,0x30,0x00,0x80,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,"试",0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x03,0x60,0x0C,0x03,0x70,0x0C,0x03,0x30,0x00,0x3F,0xE0,0x00,0x3F,0x80,0x08,0x01,0x00,0x3C,0x01,0x80,0x04,0x7F,0x80,0x04,0x7D,0x80,0x0C,0x00,0x80,0x0C,0x10,0xC0,0x0C,0x10,0xC0,0x0C,0x18,0x40,0x0C,0x1C,0x60,0x0F,0x7E,0x60,0x06,0x70,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};#endif /* APP_TFTLCD_FONT_H */

主函数

int main(void)
{/* Initialize lcd */lcd_init();lcd_clear(BLUE);lcd_draw_font_gbk24(20, 40, WHITE, BLUE, "GD32F427V-START");lcd_draw_font_gbk24(20, 80, WHITE, BLUE, "  aijishu.com");lcd_draw_font_gbk24(20, 120, WHITE, BLUE, " Spi TFT LCD tsst");lcd_draw_font_gbk24(20, 160, WHITE, BLUE, "     -- hehung");while (1){rt_thread_mdelay(100);}return RT_EOK;
}

实现效果

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-D1FszsK5-1676273723209)(https://pic2.zhimg.com/80/v2-0dcd9abb064a0020e487e8009e1317c5_1440w.webp)]

我发现我把Spi TFT LCD test 写成了tsst,不要在意这些细节,哈哈哈

http://www.ds6.com.cn/news/3017.html

相关文章:

  • 不用代码做网站的软件深圳英文网站推广
  • 典型网站建设实例精讲山西seo和网络推广
  • 网站建设中网站需求分析上海seo顾问推推蛙
  • 北京市公司网站制作亿速云
  • 音乐网站怎么做社交的全网网站推广
  • 网站制作电话多少宁德市市长
  • wordpress 添加账号钦州seo
  • 手机如何建免费网站自助建站系统平台
  • 免费网址注册平台西安seo网站关键词
  • 05网答案seo怎么赚钱
  • 海珠区住房和建设水务局网站品牌seo培训咨询
  • 怎么做自己的简历网站seo为什么要进行外部优化
  • 网站程序是什么?今日头条官网
  • 搜索引擎优化工作seo关键词怎么优化
  • 延边省建设局网站官网最好看免费观看高清视频了
  • ui设计外包网店产品seo如何优化
  • 天津工程网站建设自媒体推广
  • 做网站的s标的软件百度竞价推广登陆
  • php网站源码怎么在本地测试seo推广技巧
  • 做引流去那些网站好自己怎么做网址
  • 有没有专门做ppt的网站吗百度指数下载
  • 工信部网站备案变更本地免费发布信息网站
  • 北京网站建设+知乎国际新闻头条
  • b2b网站建设价格企业网站建设哪家好
  • 开源免费企业网站源码攀枝花网站seo
  • 山东建设监理协会网站无法登录长沙seo网站管理
  • 网站怎么做下载连接品牌推广经典案例
  • 有什么做衣服的网站吗关键词优化seo
  • 个人做 下载类网站软文发布平台有哪些
  • 政府机关网站制作模板怎么制作一个网站5个网页