您好!
我正在使用 SDK v5.10处理 cc2652R1 launchpad。
我正在使用简单的外设片上 OAD 示例、并已根据要求对其进行了修改。 我已将 launchpad 上的2个按钮配置为中断、并为这些中断设置了一个回调函数。Interruot 和回调已成功配置。 当我在获取几个 interruptson 器件后多次按按钮来生成中断时、它停止工作(它也停止广播、并且控制台上也没有可用的调试程序)。我正在将我的代码粘贴到下面。 请帮助我确定问题。
静态 PIN_Handle InterruptPinHandle;
静态 PIN_STATE 按钮 PinState;
PIN_Config AccInterruptPinTable[]={
// Board_PIN_BUTTON0 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE、// MOTION
CONFIG_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_POedge、//影响
CONFIG_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP| PIN_IRQ_POedge、//双击
PIN_TERMINATE };
InterruptPinHandle = PIN_OPEN (&buttonPinState、AccInterruptPinTable);
如果(!InterruptPinHandle)
{
volatile int i;
display_printf (dispHandle、sp_row_separator_1、0、"引脚打开失败\r\n);
/*初始化按钮针脚时出错*/
while (1){
}
}
/*设置按钮引脚的回调*/
if (PIN_registerIntCb (InterruptPinHandle、&AccelromeCallbackFxn)!= 0)
{
volatile int i;
display_printf (dispHandle、sp_row_separator_1、0、"回调寄存器失败\r\n);
/*注册按钮回调函数时出错*/
while (1){
}
}
void AccelrometerCallbackFxn (PIN_Handle handle、PIN_ID pinId)
{
display_printf (dispHandle、0、0、"Accelerometer callback %d\r\n"、pinId);
//#ifdef 调试
// Display_printf (dispHandle、2、0、"key:%d、(uint16_t) key);//添加了22/11/2019
//#endif
if (timerflag = 0)
{
Util_startClock (TapAccelClock);
}
/*去抖逻辑*/
#ifdef CPUDELAY
CPUdelay (8000 * 50);
#endif
if (!PIN_getInputValue (pinId))
{
Display_printf (dispHandle、0、0、"已输入切换用例\r\n);
开关(pinId)
{
案例 CONFIG_PIN_BTN1:
int 1status++;
timerflag = true;
if (int1status == 2)
{
PIN_setInterrupt (buttonPinState、CONFIG_PIN_BTN1 | PIN_IRQ_DIS);
}
#ifdef 调试
Display_printf (dispHandle、0、0、"\r\n 点击 INT\r\n");//未注释
#endif
中断;
案例 CONFIG_PIN_BTN2:
PIN_setInterrupt (buttonPinState、CONFIG_PIN_BTN2 | PIN_IRQ_DIS);
impactstatus = true;
#ifdef 调试
Display_printf (dispHandle、0、0、"\r\nbutton1 Impact\r\n");
#endif
抗冲击= true;
中断;
// case CONFIG_GPIO_BTN2:
//
/// GAPRole_SetParameter (GAPROLE_Adverte_enabled、sizeof (uint8_t)、
////初始化地址启用(&I);
// Util_startClock (&StandbysleepClock);
// Display_printf (dispHandle、0、0、"检测到运动\r\n);
//#ifdef 调试
// Display_printf (dispHandle、0、0、"button0");
//#endif
//中断;
默认值:
/*不执行任何操作*/
中断;
}
}
}