CH582 CH573 CH579 提供的BLE LIB支持PA控制,已经封装好了控制接口可以自由定义PA或者PB口。
/* BLE pa control config struct */ typedef struct tag_ble_pa_control_config { uint32_t txEnableGPIO; // tx enable gpio register uint32_t txDisableGPIO; // tx disable gpio register uint32_t tx_pin; // tx pin define uint32_t rxEnableGPIO; // rx enable gpio register uint32_t rxDisableGPIO; // rx disable gpio register uint32_t rx_pin; // tx pin define } blePaControlConfig_t; //LIB定义的PA控制结构体,主要是Tx 和Rx双向控制IO的定义
/** * @brief pa control init * * @note Can't be called until role Init * * @param paControl - pa control parameters(global variable) * * @return Command Status. */ extern void BLE_PAControlInit( blePaControlConfig_t *paControl ); //配置完控制IO后,调用该函数生效控制信号
具体使用如下,以PB14和PB15为例
R32_PB_DIR |= (1<<14)|(1<<15); //GPIO 输出使能 paConfig.txEnableGPIO = (u32)(&R32_PB_CLR); //Tx使能信号,地有效 paConfig.txDisableGPIO = (u32)(&R32_PB_OUT);//Tx禁止信号,高有效 paConfig.tx_pin = (1<<14); paConfig.rxEnableGPIO = (u32)(&R32_PB_CLR);//Rx同理 paConfig.rxDisableGPIO = (u32)(&R32_PB_OUT); paConfig.rx_pin = (1<<15); BLE_PAControlInit( &paConfig );
上述代码再库初始化后调用即可,具体如下
标签:control,CH579,pin,tx,CH573,PA,gpio,uint32 From: https://www.cnblogs.com/debugdabiaoge/p/17077007.html