BLE协议栈怎么处理中断
您好
我想请问下BLE协议栈中是怎么中断的,我的中断处理服务应该写在哪里?
请问是CC2541还是CC2640?
例程中有关于中断的相关代码,一般是使用HAL_ISR_FUNCTION
IO中断的话您可以参考下 http://www.deyisupport.com/question_answer/wireless_connectivity/bluetooth/f/103/t/25602.aspx
1)中断ISR可以写在代码的任意地方
2)随便打开一个BLE例子,搜HAL_ISR_FUNCTION这个函数,慢慢研究
3)记得在中断函数里面,使用HAL_ENTER_ISR()/HAL_EXIT_ISR()这两个函数
hi Susan Yang
我用的cc2541的MINI板,在SimpleBLEPeripheral例程中,按键检测采用的是中断方式,下降沿触发,我想请问下按键松开这个动作是怎么检测的。
明白了,中断后按键回调函数OnBoard_KeyCallback会查询按键状态,同时关闭中断直到按键释放。
/* If any key is currently pressed down and interrupt
is still enabled, disable interrupt and switch to polling */
if( keys != 0 )
{
if( OnboardKeyIntEnable == HAL_KEY_INTERRUPT_ENABLE )
{
OnboardKeyIntEnable = HAL_KEY_INTERRUPT_DISABLE;
HalKeyConfig( OnboardKeyIntEnable, OnBoard_KeyCallback);
}
}
/* If no key is currently pressed down and interrupt
is disabled, enable interrupt and turn off polling */
else
{
if( OnboardKeyIntEnable == HAL_KEY_INTERRUPT_DISABLE )
{
OnboardKeyIntEnable = HAL_KEY_INTERRUPT_ENABLE;
HalKeyConfig( OnboardKeyIntEnable, OnBoard_KeyCallback);
}
}