QCC512x 与QCC302X基于ADK6.X 的蓝牙系列设备,在量产中需要测试LED 的功能,让LED 亮灯或闪灯判读LED 是否是好的,可以用BlueSuite3。
如果量产的话需要运用BlueSuite 库来写量产工具,可以参阅BlueSuite 安装路径下的文档,此处用TestEngine 的库运用C语言程序来修改设备信息
查的三个接口:
bccmdLedEnable :int32 bccmdLedEnable(
uint32 handle,
uint16 led,
uint16 state
);
bccmdLed0Enable:
int32 bccmdLed0Enable( uint32 handle, uint16 state);
bccmdLed1Enable:
int32 bccmdLed0Enable( uint32 handle, uint16 state);
以bccmdLedEnable 为例,做简要说明
Parameters
handle
Handle to the device.
led
A zero-indexed identifier for the LED.
state
Value to enable (1) or disable (0) the LED.
Return Values
-1 = Invalid handle |
0 = Error |
1 = Success |
2 = Unsupported function |
Remarks
This function is used to set the state of a single LED.
This function can be used with some recent BlueCore ICs, where the firmware supports the LED_CONFIG BCCMD for configuring any LED. For older BlueCore ICs (supporting only 2 LEDs), use bccmdLed0Enable or bccmdLed1Enable. For other IC types the tePio* functions can be used to drive LEDs.
1、开发环境设置
开发环境:C++(Microsoft Visual Studio)
头文件:TestEngine.h
库文件:TestEngine.lib
运行环境:Windows 系统,TestEngine.dll 相关DLL,为了使得工具能够运行,可以把TestEngine.dll 相关DLL所在文件夹路径:C:\Program Files (x86)\QTIL\BlueSuite 3.2.1,设置成Path环境变量,这样工具程序就可以动态调用DLL相关库运行了。
2、开发流程
打开Microsoft Visual Studio 集成开发环境,新建à Win32-> console application,输入Project名BT_Info_Mag,选择console application—>Empty project->Finish 确认。
添加 BT_Info_Mag.cpp,代码如下:
//BT_Info_Mag.cpp
#include "iostream"
#include "TestEngine.h"
#include"conio.h"
using namespace std;
int main()
{
std::cout << "Hello World!\n";
static const char* const CFG_DB_PARAM = "hyd.sdb:QCC512X_CONFIG";
uint32 iHandle;
iHandle = openTestEngine(TRB, "1", 0, 5000, 0);
/*iHandle = openTestEngine(USBDBG, "1", 0, 5000, 5000);*/
if (iHandle != 0)
{
int32 success= bccmdLedEnable(iHandle,0,1);
int32 success0= bccmdLed0Enable(iHandle,1);
int32 success1= bccmdLed1Enable(iHandle,1);
printf("success = %d",success);
if (success == TE_OK)
{
if (success0 == TE_OK)
{
printf("按任意键继续");
getch();
success0 = bccmdLed0Enable(iHandle,0);;
}
if (success1 == TE_OK)
{
printf("按任意键继续");
getch();
success1 = bccmdLed1Enable(iHandle,0);;
}
printf("按任意键继续");
bccmdLedEnable(iHandle,0,0);
}
if (success == TE_OK)
{
printf("OK");
}
closeTestEngine(iHandle);
getch();
}
}然后把TestEngine.lib 添加进来,就可以编译通过
3、运行结果
QCC512x 与QCC302X 系列的板子,通过 TRBI200连上PC, 运行应用工具,
LED 灯会亮起来
评论