Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| stm32:peripherals:pwr_sleep [2016/10/13 11:59] – feur | stm32:peripherals:pwr_sleep [2019/09/16 07:19] (current) – [Programming Example] kjaz | ||
|---|---|---|---|
| Line 21: | Line 21: | ||
| #include " | #include " | ||
| - | RCC->AHBENR[0] | + | RCC->AHB1ENR | 
| - | RCC->APBENR[1] | + | RCC->APB2ENR | 
| /* Configure wake up pin (PA.0). */ | /* Configure wake up pin (PA.0). */ | ||
| Line 31: | Line 31: | ||
| /* Configure interrupt. */ | /* Configure interrupt. */ | ||
| - | SYSCFG->EXTICR[0] | + | SYSCFG->EXTICR1 | 
| EXTI-> | EXTI-> | ||
| EXTI-> | EXTI-> | ||
| - | NVIC->ISER[0] | + | NVIC->ISER0 |= (0x1 << 6u); /* Enable EXTI0 interrupt. */ | 
| /* Disable SLEEPDEEP (STOP or STANDBY mode). */ | /* Disable SLEEPDEEP (STOP or STANDBY mode). */ | ||
| SCB->SCR &= ~(0x1 << 2u); | SCB->SCR &= ~(0x1 << 2u); | ||
| - | /* Enter sleep mode */ | + | |
| + | /* -------------------- | ||
| __asm volatile (" | __asm volatile (" | ||
| + | |||
| + | |||
| + | /* -------------------- Exit SLEEP mode --------------------- */ | ||
| + | |||
| + | /* Since all registers and the SRAM are untouched by the SLEEP mode, | ||
| + | * the program continues after the WFI instruction. | ||
| + | * No further steps required. | ||
| + | */ | ||
| + | |||
| </ | </ | ||
| \\ | \\ | ||