协议栈LED实验
使用ti的示例程序SimpleBLEPeripheral示例的代码,
新建工程目录 BLE-CC2540
将 C:\Texas Instruments\BLE-CC254x-1.4.0下的components和projects文件复制到工程目录下
需要注意是的是ti_51ew_cc2540b,可能会出现编译错误
将-Z(DATA)VREG+_NR_OF_VIRTUAL_REGISTERS=08-7F
修改为-Z(DATA)VREG=08-7F
修改SimpleBLEPeripheral_ProcessEvent.c文件,添加如下内容
//led闪,所用变量定义在hal/include/hal_led.h文件中
HalLedSet((HAL_LED_1 | HAL_LED_2),HAL_LED_MODE_FLASH);
编译下载到开发板
协议栈LCD实验
在hal_lcd.h文件中定义了,所有lcd的操作
示例代码如下
/*
* Initialize LCD Service
* LCD初始化
*/
extern void HalLcdInit(void);
/*
* Write a string to the LCD
* 写一个字符到LCD
*/
extern void HalLcdWriteString ( char *str, uint8 option);
/*
* Write a value to the LCD
* 写一个值到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
* 格式化输出字符串到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 );