Functions
Low power mode configuration
Peripheral Driver » LL Driver » PWR » Functions » PWR Exported Functions

## Functions
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_set_wakeup_condition (uint32_t condition)
| Set the DeepSleep WakeUp Condition. More...
SECTION_RAM_CODE __STATIC_INLINE uint32_t | ll_pwr_get_wakeup_condition (void)
| Get the Selected DeepSleep WakeUp Condition. More...
SECTION_RAM_CODE __STATIC_INLINE uint32_t | ll_pwr_get_wakeup_event (void)
| Get the Event that triggered the DeepSleep WakeUp. More...
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_enable_ext_wakeup_pin (uint32_t wakeup_pin)
| Enable the External WakeUp PINx functionality. More...
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_disable_ext_wakeup_pin (uint32_t wakeup_pin)
| Disable the External WakeUp PINx functionality. More...
SECTION_RAM_CODE __STATIC_INLINE uint32_t | ll_pwr_is_enabled_ext_wakeup_pin (uint32_t wakeup_pin)
| Check if the External WakeUp PINx functionality is enabled. More...
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_set_ext_wakeup_type (uint32_t wakeup_pin, uint32_t wakeup_type)
| Set the WakeUp Type of External WakeUp PINx. More...
SECTION_RAM_CODE __STATIC_INLINE uint32_t | ll_pwr_get_ext_wakeup_type (uint32_t wakeup_pin)
| Get the WakeUp Type of External WakeUp PINx. More...
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_set_sleep_timer_value (uint32_t value)
| Set the 32 bits AON Sleep Timer Value to WakeUp the MCU from DeepSleep Mode. More...
SECTION_RAM_CODE __STATIC_INLINE uint32_t | ll_pwr_get_sleep_timer_value (void)
| Get the 32 bit AON Sleep Timer Value to WakeUp the MCU from DeepSleep Mode. More...
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_enable_smc_wakeup_req (void)
| Enable the SMC WakeUp Request. More...
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_disable_smc_wakeup_req (void)
| Disable the SMC WakeUp Request. More...
SECTION_RAM_CODE __STATIC_INLINE uint32_t | ll_pwr_is_enabled_smc_wakeup_req (void)
| Check if the SMC WakeUp Request was enabled or disabled. More...
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_set_dpad_le_value (uint32_t sleep, uint32_t wakeup)
| Set the DPAD LE value during sleep and after wake up. More...
SECTION_RAM_CODE __STATIC_INLINE void | ll_pwr_req_excute_psc_command (uint32_t command)
| Request to excute the Power State Controller Command. More...

## Detailed Description

## Function Documentation

## ◆ ll_pwr_disable_ext_wakeup_pin()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_disable_ext_wakeup_pin | ( | uint32_t | wakeup_pin | ) |

Disable the External WakeUp PINx functionality.

Register | BitsName
--- | ---
EXT_WKUP_CTL | MASK

Parameters

  wakeup_pin | This parameter can be a combination of the following values: LL_PWR_EXTWKUP_PIN0 LL_PWR_EXTWKUP_PIN1 LL_PWR_EXTWKUP_PIN2 LL_PWR_EXTWKUP_PIN3 LL_PWR_EXTWKUP_PIN4 LL_PWR_EXTWKUP_PIN5 LL_PWR_EXTWKUP_PIN_ALL

Return values

  None |

## ◆ ll_pwr_disable_smc_wakeup_req()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_disable_smc_wakeup_req | ( | void |  | ) |

Disable the SMC WakeUp Request.

Note
  This function is used to clear SMC WakeUp Request.

Register | BitsName
--- | ---
PWR_RET01 | SMC_WAKEUP_REQ

Return values

  None |

## ◆ ll_pwr_enable_ext_wakeup_pin()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_enable_ext_wakeup_pin | ( | uint32_t | wakeup_pin | ) |

Enable the External WakeUp PINx functionality.

Register | BitsName
--- | ---
EXT_WKUP_CTL | MASK

Parameters

  wakeup_pin | This parameter can be a combination of the following values: LL_PWR_EXTWKUP_PIN0 LL_PWR_EXTWKUP_PIN1 LL_PWR_EXTWKUP_PIN2 LL_PWR_EXTWKUP_PIN3 LL_PWR_EXTWKUP_PIN4 LL_PWR_EXTWKUP_PIN5 LL_PWR_EXTWKUP_PIN_ALL

Return values

  None |

## ◆ ll_pwr_enable_smc_wakeup_req()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_enable_smc_wakeup_req | ( | void |  | ) |

Enable the SMC WakeUp Request.

Note
  Once this is set up, MCU will wake up SMC, and this bit need to be cleared by MCU.

Register | BitsName
--- | ---
PWR_RET01 | SMC_WAKEUP_REQ

Return values

  None |

## ◆ ll_pwr_get_ext_wakeup_type()

SECTION_RAM_CODE __STATIC_INLINE uint32_t ll_pwr_get_ext_wakeup_type | ( | uint32_t | wakeup_pin | ) |

Get the WakeUp Type of External WakeUp PINx.

Note
  Warning: only one pin can be passed as parameter.

Register | BitsName
--- | ---
EXT_WKUP_CTL | INVERT
EXT_WKUP_CTL | TYPE

Parameters

  wakeup_pin | This parameter can be one of the following values: LL_PWR_EXTWKUP_PIN0 LL_PWR_EXTWKUP_PIN1 LL_PWR_EXTWKUP_PIN2 LL_PWR_EXTWKUP_PIN3 LL_PWR_EXTWKUP_PIN4 LL_PWR_EXTWKUP_PIN5 LL_PWR_EXTWKUP_PIN_ALL

Return values

  Returned | value can be one of the following values: LL_PWR_EXTWKUP_TYPE_LOW LL_PWR_EXTWKUP_TYPE_HIGH LL_PWR_EXTWKUP_TYPE_RISING LL_PWR_EXTWKUP_TYPE_FALLING

## ◆ ll_pwr_get_sleep_timer_value()

SECTION_RAM_CODE __STATIC_INLINE uint32_t ll_pwr_get_sleep_timer_value | ( | void |  | ) |

Get the 32 bit AON Sleep Timer Value to WakeUp the MCU from DeepSleep Mode.

Register | BitsName
--- | ---
TIMER_VALUE | PWR_CTL_TIMER_32B

Return values

  32 | bit AON Timer Count Value

## ◆ ll_pwr_get_wakeup_condition()

SECTION_RAM_CODE __STATIC_INLINE uint32_t ll_pwr_get_wakeup_condition | ( | void |  | ) |

Get the Selected DeepSleep WakeUp Condition.

Register | BitsName
--- | ---
EXT_WKUP_CTL | WAKE_UP_SEL

Return values

  Returned | value can be one of the following values: LL_PWR_WKUP_COND_EXT LL_PWR_WKUP_COND_TIMER LL_PWR_WKUP_COND_BLE LL_PWR_WKUP_COND_CALENDAR LL_PWR_WKUP_COND_BOD_FEDGE LL_PWR_WKUP_COND_MSIO_COMP LL_PWR_WKUP_COND_ALL

## ◆ ll_pwr_get_wakeup_event()

SECTION_RAM_CODE __STATIC_INLINE uint32_t ll_pwr_get_wakeup_event | ( | void |  | ) |

Get the Event that triggered the DeepSleep WakeUp.

Note
  Only available on GR5515_C and later version

Register | BitsName
--- | ---
SLP_EVENT | SMCOSCEN_EVENT
SLP_EVENT | TIMER_EVENT
SLP_EVENT | EXT_WKUP_EVENT
SLP_EVENT | WATCHDOG_EVENT

Return values

  Returned | value can be combination of the following values: LL_PWR_WKUP_EVENT_BLE LL_PWR_WKUP_EVENT_TIMER LL_PWR_WKUP_EVENT_EXT LL_PWR_WKUP_EVENT_BOD_FEDGE LL_PWR_WKUP_EVENT_MSIO_COMP LL_PWR_WKUP_EVENT_WDT LL_PWR_WKUP_EVENT_CALENDAR

## ◆ ll_pwr_is_enabled_ext_wakeup_pin()

SECTION_RAM_CODE __STATIC_INLINE uint32_t ll_pwr_is_enabled_ext_wakeup_pin | ( | uint32_t | wakeup_pin | ) |

Check if the External WakeUp PINx functionality is enabled.

Register | BitsName
--- | ---
EXT_WKUP_CTL | MASK

Parameters

  wakeup_pin | This parameter can be a combination of the following values: LL_PWR_EXTWKUP_PIN0 LL_PWR_EXTWKUP_PIN1 LL_PWR_EXTWKUP_PIN2 LL_PWR_EXTWKUP_PIN3 LL_PWR_EXTWKUP_PIN4 LL_PWR_EXTWKUP_PIN5 LL_PWR_EXTWKUP_PIN_ALL

Return values

  State | of bit (1 or 0).

## ◆ ll_pwr_is_enabled_smc_wakeup_req()

SECTION_RAM_CODE __STATIC_INLINE uint32_t ll_pwr_is_enabled_smc_wakeup_req | ( | void |  | ) |

Check if the SMC WakeUp Request was enabled or disabled.

Register | BitsName
--- | ---
PWR_RET01 | SMC_WAKEUP_REQ

Return values

  State | of bit (1 or 0).

## ◆ ll_pwr_req_excute_psc_command()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_req_excute_psc_command | ( | uint32_t | command | ) |

Request to excute the Power State Controller Command.

Note
  The PSC command can only be excuted when Power State Controller is not in busy state. Use ll_pwr_is_active_flag_psc_cmd_busy() to check the busy status, and make sure the last command has been finished.

Register | BitsName
--- | ---
PSC_CMD_OPC | OPCODE
PSC_CMD | MCU_PWR_REQ

Parameters

  command | This parameter can be one of the following values: LL_PWR_CMD_LOOPBACK LL_PWR_CMD_EF_DIR_ON LL_PWR_CMD_32_TIMER_LD LL_PWR_CMD_DEEP_SLEEP LL_PWR_CMD_EF_DIR_OFF LL_PWR_CMD_EXT_CLK LL_PWR_CMD_RNG_CLK LL_PWR_CMD_RTC_CLK LL_PWR_CMD_LD_MEM_SLP_CFG LL_PWR_CMD_LD_MEM_WKUP_CFG LL_PWR_CMD_DPAD_LE_HI (*) LL_PWR_CMD_DPAD_LE_LO (*) LL_PWR_CMD_SLP_TIMER_MODE_NORMAL (*) LL_PWR_CMD_SLP_TIMER_MODE_SINGLE (*) LL_PWR_CMD_SLP_TIMER_MODE_RELOAD (*) LL_PWR_CMD_SLP_TIMER_MODE_DISABLE (*) (*) Not available in A0 and B0

Return values

  None |

## ◆ ll_pwr_set_dpad_le_value()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_set_dpad_le_value | ( | uint32_t | sleep,
|  | uint32_t | wakeup
| ) |  |

Set the DPAD LE value during sleep and after wake up.

Register | BitsName
--- | ---
MEM_N_SLP_CTL | DPAD_LE_SLP_VAL
MEM_N_SLP_CTL | DPAD_LE_WKUP_VAL

Parameters

  sleep | This parameter can be one of the following values: LL_PWR_DPAD_LE_OFF LL_PWR_DPAD_LE_ON
  wakeup | This parameter can be one of the following values: LL_PWR_DPAD_LE_OFF LL_PWR_DPAD_LE_ON

Return values

  None |

## ◆ ll_pwr_set_ext_wakeup_type()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_set_ext_wakeup_type | ( | uint32_t | wakeup_pin,
|  | uint32_t | wakeup_type
| ) |  |

Set the WakeUp Type of External WakeUp PINx.

Register | BitsName
--- | ---
EXT_WKUP_CTL | INVERT
EXT_WKUP_CTL | TYPE

Parameters

  wakeup_pin | This parameter can be a combination of the following values: LL_PWR_EXTWKUP_PIN0 LL_PWR_EXTWKUP_PIN1 LL_PWR_EXTWKUP_PIN2 LL_PWR_EXTWKUP_PIN3 LL_PWR_EXTWKUP_PIN4 LL_PWR_EXTWKUP_PIN5 LL_PWR_EXTWKUP_PIN_ALL
  wakeup_type | This parameter can be one of the following values: LL_PWR_EXTWKUP_TYPE_LOW LL_PWR_EXTWKUP_TYPE_HIGH LL_PWR_EXTWKUP_TYPE_RISING LL_PWR_EXTWKUP_TYPE_FALLING

Return values

  None |

## ◆ ll_pwr_set_sleep_timer_value()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_set_sleep_timer_value | ( | uint32_t | value | ) |

Set the 32 bits AON Sleep Timer Value to WakeUp the MCU from DeepSleep Mode.

Note
  After the value was set, use
  - LL_PWR_CMD_32_TIMER_LD command to load the configuration into Power State Controller.

  Register | BitsName
  --- | ---
  TIMER_VALUE | PWR_CTL_TIMER_32B

Parameters

  value | 32 bits count value loaded into the t32bit_timer

Return values

  None |

## ◆ ll_pwr_set_wakeup_condition()

SECTION_RAM_CODE __STATIC_INLINE void ll_pwr_set_wakeup_condition | ( | uint32_t | condition | ) |

Set the DeepSleep WakeUp Condition.

Register | BitsName
--- | ---
EXT_WKUP_CTL | WAKE_UP_SEL

Parameters

  condition | This parameter can be one of the following values: LL_PWR_WKUP_COND_EXT LL_PWR_WKUP_COND_TIMER LL_PWR_WKUP_COND_BLE LL_PWR_WKUP_COND_CALENDAR LL_PWR_WKUP_COND_BOD_FEDGE LL_PWR_WKUP_COND_MSIO_COMP LL_PWR_WKUP_COND_ALL

Return values

  None |