Part Number: CC1310
I implemented a code to exchange interrupts between two devices like this:
DEVICE 1 I press the button0 and the DEVICE 2 answers me with LED0 on.
Now to this code, I am implementing pin_Shutdown to have a very low consumption after I send it to the command. For the moment I have declared a button that I don't use and the shutdown works.
Can I use the buttons I use to send the command and then send it to shutdown?
I implemented this, but I have problems:
The device sends the command but does not go into shutdown.
PIN_Config ledPinTable[] = { LED_1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, LED_2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, BUTTON_0 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE, PIN_TERMINATE }; PIN_Config ButtonTableWakeUp[] = { BUTTON_0 | PIN_INPUT_EN | PIN_PULLUP | PINCC26XX_WAKEUP_NEGEDGE, PIN_TERMINATE /* Terminate list */ }; /* Shutdown Button pin table */ PIN_Config ButtonTableShutdown[] = { BUTTON_0| PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE, PIN_TERMINATE /* Terminate list */ }; static void buttonClockCb(UArg arg) { PIN_Handle buttonHandle = (PIN_State *) arg; Clock_stop(hButtonClock); if (activeButtonPinId != PIN_TERMINATE) { if (!PIN_getInputValue(activeButtonPinId)) { switch (activeButtonPinId) { case BUTTON_0: Semaphore_post(Semaphore_handle(&shutdownSem)); break; default: break; } } } PIN_setConfig(buttonHandle, PIN_BM_IRQ, activeButtonPinId | PIN_IRQ_NEGEDGE); activeButtonPinId = PIN_TERMINATE; } static void buttonCb(PIN_Handle handle, PIN_Id pinId) { activeButtonPinId = pinId; PIN_setConfig(handle, PIN_BM_IRQ, activeButtonPinId | PIN_IRQ_DIS); Clock_setTimeout(hButtonClock, (50 * (1000 / Clock_tickPeriod))); Clock_start(hButtonClock); } static void taskFxn(UArg a0, UArg a1) { Semaphore_pend(Semaphore_handle(&shutdownSem), BIOS_WAIT_FOREVER); PINCC26XX_setWakeup(ButtonTableWakeUp); Semaphore_pend(semHandle, BIOS_WAIT_FOREVER); Power_shutdown(0, 0); while (1); } void Send_Button_Command(PIN_Handle handle, PIN_Id pinId) { CPUdelay(8000*50); if (!PIN_getInputValue(pinId)) { switch(pinId){ case BUTTON_0: //SEND COMMAND TO TURN ON LED 1 ON SECOND DEVICE
Semaphore_post(semHandle); break;
} } }
Thanks