本帖最后由 damiaa 于 2014-11-24 09:18 编辑
先把这份资料放上来。这个是ACI的应用手册。
外部MCU通过一个基于SPI的应用程序控制器接口协议(ACI)与BLUENRG连接
外部MCU上的用户应用程序,可以发送ACI命令,通过SPI连接控制BlueNRG
ACI接口也支持HCI命令
DM00114498.pdf
(1.13 MB, 下载次数: 2)
要有这个就好了 BlueNRG USB Dongle
BlueNRG GUI included in the software package is a graphical user interface that can be
used to interact and evaluate the capabilities of the remote BlueNRG network processor
through the local BlueNRG USB Dongle.
This utility can send standard and vendor-specific HCI commands to the controller and receive
events from it. It lets the user configure each field of the HCI command packets to be sent and
analyzes all received packets. In this way BlueNRG can be easily managed at low level.
In order to use the BlueNRG GUI, make sure you have correctly set up your hardware and
这个就是那个方块转动的代码,把这个稍微改下,就可以三轴转动了。只可惜还不懂改APP。否则更好玩点
void User_Process(AxesRaw_t* p_axes)
{
if(set_connectable){ //连接设备
setConnectable();
set_connectable = FALSE;
}
/* Check if the user has pushed the button */
if(BSP_PB_GetState(BUTTON_KEY) == RESET)
{
while (BSP_PB_GetState(BUTTON_KEY) == RESET);
BSP_LED_Toggle(LED2); // FIXME: remove this
if(connected){
/* Update acceleration data */
p_axes->AXIS_X += 200;
if((p_axes->AXIS_Y>2000)&&(p_axes->AXIS_X>2000)&&(p_axes->AXIS_Z>2000))
{
p_axes->AXIS_X = 0;
p_axes->AXIS_Y = 0;
p_axes->AXIS_Z = 0;
}
if((p_axes->AXIS_Y>2000)&&(p_axes->AXIS_X>2000))
{
p_axes->AXIS_Z+=200;
}
if(p_axes->AXIS_X>2000)
{
p_axes->AXIS_Y+=200;
}
//PRINTF("ACC: X=%6d Y=%6d Z=%6d\r\n", p_axes->AXIS_X, p_axes->AXIS_Y, p_axes->AXIS_Z);
Acc_Update(p_axes);
}
}
}
typedef struct {
i16_t AXIS_X;
i16_t AXIS_Y;
i16_t AXIS_Z;
} AxesRaw_t;
这个就是三轴的数据结构。
看图:X,Y满了,Z还差点倒2000
void setConnectable(void) //让设备处于连接模式。
{
tBleStatus ret;
const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','E','E','W','O','R','D'};//'B','l','u','e','N','R','G'};//设备显示到手机的名字。可以改。显示就变
/* disable scan response */
hci_le_set_scan_resp_data(0,NULL);
PRINTF("General Discoverable Mode.\n");
ret = aci_gap_set_discoverable(ADV_IND, 0, 0, RANDOM_ADDR, NO_WHITE_LIST_USE,
8, local_name, 0, NULL, 0, 0);
PRINTF("%d\n",ret);
}
后面这几个文档是在代码的Documentation目录:建议大家认真看。否则没什么资料看了。哈哈。
STM32_Nucleo_BlueNRG_Application_Note.pdf
STM32_Nucleo_BlueNRG_Application_Note.pdf
(2.6 MB, 下载次数: 4)
STM32_Nucleo_BlueNRG_Heart_Rate_Sensor_Application_Note.pdf
STM32_Nucleo_BlueNRG_Heart_Rate_Sensor_Application_Note.pdf
(1.51 MB, 下载次数: 3)
STM32CubeL0GettingStarted.pdf
STM32CubeL0GettingStarted.pdf
(321.76 KB, 下载次数: 2)
用CC2540的CC2540 USB Dongle也可以抓它的包。