第十七节 协议栈LCD显示实验
打开LCD12864的实验工程,一样的在工程配置中打开LCD,选择MT254xboard然后直接编译下载,我们可以看到LCD上已经有显示了。
这些显示来自哪里呢?
在初始化函数中可以看到图中的函数调用,这里是将字符串显示到LCD的第一行。
HalLcdWriteString是将第一个参数指向的字符串显示到第二个参数指定第几行中,例如我们需要在第5行显示系统启动信息,我们可以在启动事件中,添加如下代码。
这里我们来介绍一下Lcd驱动的实现,在Hal_lcd.h文件中申明了以下函数,这些函数的功能都有英文注释,这里我就不再累述了。
/*
* Initialize LCD Service
*/
extern void HalLcdInit(void);
/*
* Write a string to the LCD
*/
extern void HalLcdWriteString ( char *str, uint8 option);
/*
* Write a value to the LCD
*/
extern void HalLcdWriteValue ( uint32 value, const uint8 radix, uint8 option);
/*
* Write a value to the LCD
*/
extern void HalLcdWriteScreen( char *line1, char *line2 );
/*
* Write a string followed by a value to the LCD
*/
extern void HalLcdWriteStringValue( char *title, uint16 value, uint8 format, uint8 line );
/*
* Write a string followed by 2 values to the LCD
*/
extern void HalLcdWriteStringValueValue( char *title, uint16 value1, uint8 format1, uint16 value2, uint8 format2, uint8 line );
/*
* Write a percentage bar to the LCD
*/
extern void HalLcdDisplayPercentBar( char *title, uint8 value );
协议栈中很多地方都调用了这些函数,我们如果要使我们的硬件能够兼容协议栈,被协议栈使用,就需要实现这些函数的定义,当然,为了适应我们的开发板,我已经实现了这些函数,实现都在hal_lcd.c中。
本文章转载自
http://www.deyisupport.com/question_answer/wireless_connectivity/bluetooth/f/103/t/69222.aspx
请勿用于商业