2024-11-18 08:05 AM
I want to use the SPC582B-DIS Discovery board to write a way to put the CPU into STANDBY0 mode! Then press the button to wake up the CPU and turn on the LED light, and then return to STANDBY0 status! How can I modify the following code? Hope to receive a reply. Thank you!
#include "components.h"
#include "wkpu_lld_cfg.h"
void int31_irq_cb(WKPUDriver *wkpup)
{
(void)wkpup;
/* Wait the SIUL2 is ready after
the exit from the SPOP0 mode.*/
while (MC_ME.PS0.B.S_SIUL == 0U) {
;
}
pal_lld_setpad(PORT_A, LED_3);
}
/*
* Application entry point.
*/
int main(void) {
uint8_t i;
/* Initialization of all the imported components in the order specified in
the application wizard. The function is generated automatically.*/
componentsInit();
/* Switch-off all LED's.*/
pal_lld_clearpad(PORT_E, LED_4);
pal_lld_clearpad(PORT_D, LED_5);
pal_lld_clearpad(PORT_A, LED_3);
/* Enable Interrupts */
irqIsrEnable();
/* Configure WKPU.*/
wkpu_lld_start(&WKPUD1, &wkpu_config_wkpu_cfg);
/* Wait 1,5 seconds.*/
for (i = 0 ; i < 3U; i++) {
pal_lld_togglepad(PORT_E, LED_4);
osalThreadDelayMilliseconds(250);
pal_lld_togglepad(PORT_D, LED_5);
osalThreadDelayMilliseconds(250);
}
/* Move the core in STOP0 mode.*/
if (SPCSetRunMode(SPC5_RUNMODE_STOP0) == CLOCK_FAILED) {
SPC5_CLOCK_FAILURE_HOOK();
}
/* Application main loop.*/
for ( ; ; ) {
pal_lld_togglepad(PORT_E, LED_4);
osalThreadDelayMilliseconds(250);
pal_lld_togglepad(PORT_D, LED_5);
osalThreadDelayMilliseconds(250);
}
}