This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1310: 1310 NORTOS模式下,中断触发后如何立即结束休眠

Part Number: CC1310

使用CC1310的NORTOS的 pininterrupt例程,对其进行如下修改:

void *mainThread(void *arg0)
{

    /* Open LED pins */
    ledPinHandle = PIN_open(&ledPinState, ledPinTable);
    if(!ledPinHandle) {
        /* Error initializing board LED pins */
       while(1);
    }

    buttonPinHandle = PIN_open(&buttonPinState, buttonPinTable);
    if(!buttonPinHandle) {
        /* Error initializing button pins */
    while(1);
    }

    /* Setup callback for button pins */
    if (PIN_registerIntCb(buttonPinHandle, &buttonCallbackFxn) != 0) {
        /* Error registering button callback function */
        while(1);
    }

    /* Loop forever */
    while(1) {

        //sleep(1000);
        sleep(5); // 休眠5秒
        PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, !PIN_getOutputValue(Board_PIN_LED1)); // DIO7电平翻转
    }
}

即将原本主循环中的sleep(1000)替换为{sleep(5)和PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, !PIN_getOutputValue(Board_PIN_LED1))

实测发现,在芯片休眠期间,中断触发之后,不会立即执行DIO7平翻转,而是等到5秒休眠时间到后才执行。

请问,有什么方法能够在中断触发后,立即结束休眠并执行sleep(5)后面的语句???