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

【GD32F427开发板试用】5. SPI驱动TFTLCD屏幕

本篇文章来自极术社区与兆易创新组织的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,不要在意这些细节,哈哈哈

相关文章:

【GD32F427开发板试用】5. SPI驱动TFTLCD屏幕

本篇文章来自极术社区与兆易创新组织的GD32F427开发板评测活动&#xff0c;更多开发板试用活动请关注极术社区网站。作者&#xff1a;hehung 之前发帖 【GD32F427开发板试用】1. 串口实现scanf输入控制LED 【GD32F427开发板试用】2. RT-Thread标准版移植 【GD32F427开发板试用…...

测试2年还拿实习生的薪资打发我,你后悔去吧····

20年7月大学毕业&#xff0c;学的计算机科学专业。因为考研之后&#xff0c;秋招结束了。没什么更多的岗位选择&#xff0c;就想找个工作先干着&#xff0c;然后亲戚在一家大厂公司上班说要招测试&#xff0c;所以就来做测试了。 虽然都是属于计算机大类&#xff0c;但自己专业…...

面向对象程序(C++)设计基础

一、类&对象C 在 C 语言的基础上增加了面向对象编程&#xff0c;C 支持面向对象程序设计。类是 C 的核心特性&#xff0c;通常被称为用户定义的类型。类提供了对象的蓝图&#xff0c;所以基本上&#xff0c;对象是根据类来创建的。声明类的对象&#xff0c;就像声明基本类型…...

conda安装nodejs版本过低解决方法

conda命令直接安装nodejs时&#xff0c;可能会由于镜像源中nodejs版本过低导致没法安装高本版的nodejs&#xff0c;导致无法jupyterlab使用一些扩展插件。 解决方法如下&#xff1a;&#xff08;windows环境下直接按提示下载版本安装就行&#xff0c;此处只介绍linux环境的解决…...

前端工程师leetcode算法面试必备-二分搜索算法(下)索算法(下)

一、287. 寻找重复数 给定一个包含 n 1 个整数的数组 nums&#xff0c;其数字都在 1 到 n 之间&#xff08;包括 1 和 n&#xff09;&#xff0c;可知至少存在一个重复的整数。假设只有一个重复的整数&#xff0c;找出这个重复的数。 1、HashMap 在没有其它附加条件的情况下&…...

使用Autowired为什么会被IDEA警告,应该怎么修改最佳

问题原因 关于这个问题&#xff0c;其实答案相对统一&#xff0c;实际上用大白话说起来也容易理解。 初始化问题 先看一下Java初始化类的顺序&#xff1a;父类的静态字段 > 父类静态代码块 > 子类静态字段 > 子类静态代码块 > 父类成员变量 > 父类构造代码块 &…...

面向对象(中)

面向对象&#xff08;中&#xff09; 一、 面向对象之继承性 继承性的好处 减少代码的冗余&#xff0c;提高了代码的复用性。 便于功能的扩展。 为多态性的使用&#xff0c;提供了前提。 继承性的格式 class A extends B{} A&#xff1a;子类、派生类、subclass B&#xff1a…...

【云原生】promehtheus整合grafana实现可视化监控实战

文章目录前言一. 实验环境二. 安装grafana2.1 grafana的介绍2.2 为什么选择grafana&#xff1f;2.3 grafana下载及安装三. 网页端配置grafana3.1 浏览器访问grafana网页3.2 使用grafana 获取prometheus的数据源3.3 grafana导入prometheus模板总结前言 大家好&#xff0c;又见面…...

Linux 内核定时器实验

目录 一、内核时间管理简介 二、内核定时器简介 三、驱动编写 1、修改makefile 2、添加定义 3、初始化led函数 4、添加调用 5、初始化定时器与定时器处理函数 这部分代码如下 四、ioctl函数 五、内核添加unlocked_ioctl 函数 1、添加设备操作集unlocked_ioctl成员 2…...

喜欢大屏电视?那就选择酷开系统,实现智能生活享受

随着科技的发展和我们生活水平的提高&#xff0c;越来越多的消费者开始认可并习惯使用各种高质量的科技产品&#xff0c;比如喜欢玩游戏的消费者&#xff0c;他们往往会追求流畅性更强、刷新率更快的大显示屏&#xff0c;以此获得更真实刺激的游戏体验&#xff0c;而喜欢追剧的…...

PMP应该如何备考?

备考之初的我们&#xff0c;总会四处搜索PMP备考经验&#xff0c;希望能拿到那些高分通关前辈的备考经验和方法。众所周知PMP考试因为有35个学时培训的基本要求&#xff0c;所以肯定是要通过培训机构报名的。 一&#xff0c;首先我们需要了解到新的考纲 1.PMP模块划分发生变化…...

AcWing《蓝桥杯集训·每日一题》—— 3956.截断数组

AcWing《蓝桥杯集训每日一题》—— 3956. 截断数组 文章目录AcWing《蓝桥杯集训每日一题》—— 3956. 截断数组一、题目二、解题思路三、代码实现本次博客我是通过Notion软件写的&#xff0c;转md文件可能不太美观&#xff0c;大家可以去我的博客中查看&#xff1a;北天的 BLOG…...

Docker的数据管理

一、管理docker容器中数据 管理Docker 容器中数据主要有两种方式:数据卷(Data Volumes)和数据卷容器( DataVolumes Containers) 。 1、 数据卷 数据卷是一个供容器使用的特殊目录&#xff0c;位于容器中。可将宿主机的目录挂载到数据卷上&#xff0c;对数据卷的修改操作立刻…...

RxJS处理异步数据流

什么是异步? 异步&#xff08;Asynchronous&#xff09;指的是不同步发生的事件或操作。通常&#xff0c;同步操作是指一系列代码按照顺序依次执行&#xff0c;直到当前代码块执行完毕后才继续执行下一个代码块&#xff1b;而异步操作则是指某些代码会被提交到后台执行&#…...

IP地址与用户行为

IP地址能够解决网络风险和提高网络安全的原因是&#xff1a;所有的网络请求都会带有IP信息&#xff0c;是访问者的独立标识&#xff0c;另外ip地址的分配和管理比较严格&#xff0c;难以造假。另外ip属于网络层&#xff0c;可以轻松的对其进行阻断。现有的各种网络安全、负载均…...

底层逻辑2

有些创业者&#xff0c;在3D打印⽕爆的时候做3D打印&#xff0c;在VR&#xff08;虚拟现 实&#xff09;蓬勃发展的时候转⾏做VR&#xff0c;在区块链成为热⻔话题的时候摇身⼀ 变成了区块链专家&#xff0c;⽽⼈⼯智能⽕了以后&#xff0c;他们⼜全身⼼投⼊⼈⼯智 能这⼀⾏。再…...

TCP报头详解及TCP十种核心机制(一)

目录 前言&#xff1a; TCP报头 TCP核心机制 一、确认应答 二、超时重传 小结&#xff1a; 前言&#xff1a; 这篇文章详细介绍了TCP报头中的一些核心数据&#xff0c;及两种TCP核心机制。其他的一些机制会在后面文章中详细介绍。 TCP报头 解释&#xff1a; 1&#xff…...

Linux用户的添加、修改和删除以及相关配置文件:useradd、passwd、usermod、userdel、相关配置文件

目录 账户的创建&#xff08;useradd&#xff09; 第一步&#xff1a;创建账号 第二步&#xff1a;创建密码 useradd参考文件 CROUP100 HOME/home INACTIVE-1 EXPIRE SHELL/bin/bash SKEL/etc/skel UID/GID密码参数参考&#xff1a;/etc/login.defs 密码参数显示命…...

进程地址空间

目录 回顾C/C语言的程序地址空间 感性认识虚拟地址空间 虚拟地址空间与物理空间如何建立映射关系 为什么要虚拟地址空间&#xff1f; 回顾C/C语言的程序地址空间 在学习C/C语言时我们知道了一个概念叫程序地址空间。通俗来说就是如下一张表&#xff0c;从中可以得知系统的几…...

数楼梯(加强版)

数楼梯(加强版) 题目背景: 小明一天放学回家,看到从1楼到2楼共有n个台阶,因为好奇,他想尝试一下总共有几种方案到二楼?他可以1步,2步,3步的跳,不能跳3步以上. 他试了很多次都没有解决这个问题,于是请求聪明的你帮忙解决这个问题. 题目描述: 1楼到2楼楼梯有n级台阶。小明每…...

ESP32读取DHT11温湿度数据

芯片&#xff1a;ESP32 环境&#xff1a;Arduino 一、安装DHT11传感器库 红框的库&#xff0c;别安装错了 二、代码 注意&#xff0c;DATA口要连接在D15上 #include "DHT.h" // 包含DHT库#define DHTPIN 15 // 定义DHT11数据引脚连接到ESP32的GPIO15 #define D…...

屋顶变身“发电站” ,中天合创屋面分布式光伏发电项目顺利并网!

5月28日&#xff0c;中天合创屋面分布式光伏发电项目顺利并网发电&#xff0c;该项目位于内蒙古自治区鄂尔多斯市乌审旗&#xff0c;项目利用中天合创聚乙烯、聚丙烯仓库屋面作为场地建设光伏电站&#xff0c;总装机容量为9.96MWp。 项目投运后&#xff0c;每年可节约标煤3670…...

相机从app启动流程

一、流程框架图 二、具体流程分析 1、得到cameralist和对应的静态信息 目录如下: 重点代码分析: 启动相机前,先要通过getCameraIdList获取camera的个数以及id,然后可以通过getCameraCharacteristics获取对应id camera的capabilities(静态信息)进行一些openCamera前的…...

论文浅尝 | 基于判别指令微调生成式大语言模型的知识图谱补全方法(ISWC2024)

笔记整理&#xff1a;刘治强&#xff0c;浙江大学硕士生&#xff0c;研究方向为知识图谱表示学习&#xff0c;大语言模型 论文链接&#xff1a;http://arxiv.org/abs/2407.16127 发表会议&#xff1a;ISWC 2024 1. 动机 传统的知识图谱补全&#xff08;KGC&#xff09;模型通过…...

OpenLayers 分屏对比(地图联动)

注&#xff1a;当前使用的是 ol 5.3.0 版本&#xff0c;天地图使用的key请到天地图官网申请&#xff0c;并替换为自己的key 地图分屏对比在WebGIS开发中是很常见的功能&#xff0c;和卷帘图层不一样的是&#xff0c;分屏对比是在各个地图中添加相同或者不同的图层进行对比查看。…...

无人机侦测与反制技术的进展与应用

国家电网无人机侦测与反制技术的进展与应用 引言 随着无人机&#xff08;无人驾驶飞行器&#xff0c;UAV&#xff09;技术的快速发展&#xff0c;其在商业、娱乐和军事领域的广泛应用带来了新的安全挑战。特别是对于关键基础设施如电力系统&#xff0c;无人机的“黑飞”&…...

android RelativeLayout布局

<?xml version"1.0" encoding"utf-8"?> <RelativeLayout xmlns:android"http://schemas.android.com/apk/res/android"android:layout_width"match_parent"android:layout_height"match_parent"android:gravity&…...

WEB3全栈开发——面试专业技能点P7前端与链上集成

一、Next.js技术栈 ✅ 概念介绍 Next.js 是一个基于 React 的 服务端渲染&#xff08;SSR&#xff09;与静态网站生成&#xff08;SSG&#xff09; 框架&#xff0c;由 Vercel 开发。它简化了构建生产级 React 应用的过程&#xff0c;并内置了很多特性&#xff1a; ✅ 文件系…...

aardio 自动识别验证码输入

技术尝试 上周在发学习日志时有网友提议“在网页上识别验证码”&#xff0c;于是尝试整合图像识别与网页自动化技术&#xff0c;完成了这套模拟登录流程。核心思路是&#xff1a;截图验证码→OCR识别→自动填充表单→提交并验证结果。 代码在这里 import soImage; import we…...

【免费数据】2005-2019年我国272个地级市的旅游竞争力多指标数据(33个指标)

旅游业是一个城市的重要产业构成。旅游竞争力是一个城市竞争力的重要构成部分。一个城市的旅游竞争力反映了其在旅游市场竞争中的比较优势。 今日我们分享的是2005-2019年我国272个地级市的旅游竞争力多指标数据&#xff01;该数据集源自2025年4月发表于《地理学报》的论文成果…...