沁恒蓝牙协议栈中已支持PA控制信号,
/*******************************************************************************
* @fn BLE_PAControlInit
*
* [url=home.php?mod=space&uid=247401]@brief[/url] pa control init
* Can't be called until role Init
*
* input parameters
*
* @param paControl - pa control parameters(global variable)
*
* output parameters
*
* @param None.
*
* [url=home.php?mod=space&uid=266161]@return[/url] Command Status.
*/
extern void BLE_PAControlInit( blePaControlConfig_t *paControl );
使用参考如下:
//必须全局变量
blePaControlConfig_t pa_lna_ctl;
//设置对应的IO为输出模式
GPIOA_ModeCfg(GPIO_Pin_3|GPIO_Pin_4, GPIO_ModeOut_PP_5mA);
//设置对应的GPIO为对应的拉高拉低寄存器
//对应的pin是bit
pa_lna_ctl.txEnableGPIO = (uint32_t)&R32_PA_OUT;
pa_lna_ctl.txDisableGPIO = (uint32_t)&R32_PA_CLR;
pa_lna_ctl.tx_pin = GPIO_Pin_3;
pa_lna_ctl.rxEnableGPIO = (uint32_t)&R32_PA_OUT;
pa_lna_ctl.rxDisableGPIO = (uint32_t)&R32_PA_CLR;
pa_lna_ctl.rx_pin = GPIO_Pin_4;
//下面调用要在GAPRole_PeripheralInit,GAPRole_CentralInit 之类的代码调用之后才能调用
BLE_PAControlInit( &pa_lna_ctl );
|