GlobLib
HAL and API libraries for MCUs and hardware.
|
This module contains low level functions for power configuration. More...
Files | |
file | stm32f103cb_power.h |
Header file for stm32f103cb Power. | |
Functions | |
void | POWER_reset (void) |
Resets the system. | |
void | POWER_sleep (void) |
Put the system in sleep mode. More... | |
void | POWER_noSleep (void) |
Disable sleep mode. More... | |
void | POWER_standby (void) |
Put the device into standby mode. More... | |
uint8_t | POWER_fromStandby (void) |
Check if the system is restarting from standby mode. More... | |
void | POWER_stop (void) |
Put the device into stop mode. More... | |
uint8_t | POWER_fromStop (void) |
Check if MCU was in stop mode and reset flags. More... | |
This module contains low level functions for power configuration.
There are four power modes that the MCU can operate in. Each proceeding mode has a lower power consumption but higher restart time.
This module also contains the hard fault handler. In its implementation, the handler determines if the bootloader is being used (Data register 1 of the backup domain = 1) and resets to boot mode.
If the bootloader is not being used, the system simply stalls.
This program works over USART_1. It provides four options which can be selected through terminal.
uint8_t POWER_fromStandby | ( | void | ) |
Check if the system is restarting from standby mode.
This should always be used if standby mode is used. This resets the standby wake flags. mode.
Definition at line 99 of file stm32f103cb_power.c.
uint8_t POWER_fromStop | ( | void | ) |
Check if MCU was in stop mode and reset flags.
This should always be used if stop mode is used.
Definition at line 84 of file stm32f103cb_power.c.
void POWER_noSleep | ( | void | ) |
Disable sleep mode.
This should be called inside an ISR.
Definition at line 59 of file stm32f103cb_power.c.
void POWER_sleep | ( | void | ) |
Put the system in sleep mode.
ISR are still enabled. This mode can be exited by calling Power_noSleep() inside an ISR.
Definition at line 53 of file stm32f103cb_power.c.
void POWER_standby | ( | void | ) |
Put the device into standby mode.
The RTC must be enabled with an alarm event to exit from standby mode.
Definition at line 65 of file stm32f103cb_power.c.
void POWER_stop | ( | void | ) |
Put the device into stop mode.
The device needs to be woken with an EXTI interrupt or RTC alarm event. All clocks need to be reinitialized after stop mode.
Definition at line 75 of file stm32f103cb_power.c.