Functions
Functions
SYSTEM » Power Manager
Collaboration diagram for Functions:

## Functions
pwr_mgmt_mode_t | pwr_mgmt_shutdown (void)
| This function allows ARM to enter deep sleep mode, but users should not use this function directly. More...
boot_mode_t | pwr_mgmt_get_wakeup_flag (void)
| Get the current boot mode. More...
void | pwr_mgmt_set_wakeup_flag (boot_mode_t boot_mode)
| Mark the mode of next boot, cold boot or warm boot. More...
void | pwr_mgmt_mode_set (pwr_mgmt_mode_t pm_mode)
| Set the specified sleep mode. More...
pwr_mgmt_mode_t | pwr_mgmt_mode_get (void)
| Get the specified sleep mode. More...
pwr_mgmt_mode_t | pwr_mgmt_baseband_state_get (void)
| Get the power state of baseband. More...
pwr_mgmt_mode_t | pwr_mgmt_check_ext_timer (void)
| Get the state of extenal timer. More...
void | pwr_mgmt_schedule (void)
| Sleep Policy Scheduling Function. More...
bool | pwr_mgmt_ble_wakeup (void)
| Wake the BLE core via an external request. More...
void | pwr_mgmt_check_ble_event (void)
| Check whether there are ble events in the queue, and if so, handle them immediately. More...
void | pwr_mgmt_notify_timer_event (notify_timer_event_t timer_event)
| This function is used to push startup information in app timer. More...
pwr_mgmt_mode_t | pwr_mgmt_get_sleep_mode (void)
| Query the sleep mode that the current system can access. More...
void | pwr_mgmt_update_wkup_param (void)
| Update wakeup param. More...
void | pwr_mgmt_wfe_sleep (void)
| Execution of this function allows ARM to enter the WFE state and exit the WFE state when an event or interrupt occurs. More...
void | pwr_mgmt_ultra_sleep (uint32_t time_ms)
| Execution of this function allows ARM to enter the ultra sleep state and wakeup the chip when an event occurs. More...
void | pwr_mgmt_init (pwr_table_t *p_pwr_table, mcu_clock_type_t sys_clk)
| PMU Initialization Function. More...
void | pwr_mgmt_dev_init (periph_func_t p_periph_init)
| Peripheral Controller Initialization Register interface. More...
void | pwr_mgmt_dev_resume (void)
| Device config resume interface. More...
pwr_mgmt_dev_state_t | pwr_mgmt_dev_suspend (void)
| Device config suspend interface. More...
void | pwr_mgmt_mem_ctl_set (uint32_t mem_sleep_state, uint32_t mem_work_state)
| Mem state control under deep sleep & work state. More...
void | pwr_mgmt_set_callback (pwr_dev_check_func_t dev_check_fun, pwr_before_sleep_func_t before_sleep_fun)
| Set PMU callback function. More...
void | pwr_mgmt_wakeup_source_setup (uint32_t wakeup_source)
| Set the wakeup source. More...
void | pwr_mgmt_wakeup_source_clear (uint32_t wakeup_source)
| Clear the wakeup source. More...
void | pwr_mgmt_save_context (void)
| Save context function. More...
void | pwr_mgmt_load_context (void)
| Load context function. More...
void | pwr_mgmt_disable_nvic_irq (void)
| Disable nvic irq. More...
void | pwr_mgmt_enable_nvic_irq (void)
| Enable nvic irq. More...
bool | pwr_mgmt_check_pend_irq (void)
| Check nvic irq. More...
void | pwr_mgmt_register_trace_func (trace_func_t trace_func)
| Trace function register. More...
void | pwr_mgmt_register_io_dump_func (io_dump_func_t dump_func)
| function registered to dump io configuration. More...

## Detailed Description

## Function Documentation

## ◆ pwr_mgmt_baseband_state_get()

pwr_mgmt_mode_t pwr_mgmt_baseband_state_get | ( | void |  | ) |

Get the power state of baseband.

Returns
  Power Management Mode :: pwr_mgmt_mode_t

## ◆ pwr_mgmt_ble_wakeup()

bool pwr_mgmt_ble_wakeup | ( | void |  | ) |

Wake the BLE core via an external request.

Returns
  The status of the requested operation.

Return values

  False | The BLE core is not sleeping.
  True | The BLE core was woken up successfully.

## ◆ pwr_mgmt_check_ble_event()

void pwr_mgmt_check_ble_event | ( | void |  | ) |

Check whether there are ble events in the queue, and if so, handle them immediately.

## ◆ pwr_mgmt_check_ext_timer()

pwr_mgmt_mode_t pwr_mgmt_check_ext_timer | ( | void |  | ) |

Get the state of extenal timer.

Returns
  Power Management Mode :: pwr_mgmt_mode_t

## ◆ pwr_mgmt_check_pend_irq()

bool pwr_mgmt_check_pend_irq | ( | void |  | ) |

Check nvic irq.

## ◆ pwr_mgmt_dev_init()

void pwr_mgmt_dev_init | ( | periph_func_t | p_periph_init | ) |

Peripheral Controller Initialization Register interface.

Parameters

  p_periph_init | : the pointer of device init function.

## ◆ pwr_mgmt_dev_resume()

void pwr_mgmt_dev_resume | ( | void |  | ) |

Device config resume interface.

## ◆ pwr_mgmt_dev_suspend()

pwr_mgmt_dev_state_t pwr_mgmt_dev_suspend | ( | void |  | ) |

Device config suspend interface.

Returns
  Power Management Device state pwr_mgmt_dev_state_t

## ◆ pwr_mgmt_disable_nvic_irq()

void pwr_mgmt_disable_nvic_irq | ( | void |  | ) |

Disable nvic irq.

## ◆ pwr_mgmt_enable_nvic_irq()

void pwr_mgmt_enable_nvic_irq | ( | void |  | ) |

Enable nvic irq.

## ◆ pwr_mgmt_get_sleep_mode()

pwr_mgmt_mode_t pwr_mgmt_get_sleep_mode | ( | void |  | ) |

Query the sleep mode that the current system can access.

Returns
  Power Management Mode :: pwr_mgmt_mode_t

## ◆ pwr_mgmt_get_wakeup_flag()

boot_mode_t pwr_mgmt_get_wakeup_flag | ( | void |  | ) |

Get the current boot mode.

Returns
  Boot Mode boot_mode_t

## ◆ pwr_mgmt_init()

void pwr_mgmt_init | ( | pwr_table_t * | p_pwr_table,
|  | mcu_clock_type_t | sys_clk
| ) |  |

PMU Initialization Function.

Parameters

  p_pwr_table | : PMU parameter configuration table.
  sys_clk | : the clock of system

## ◆ pwr_mgmt_load_context()

void pwr_mgmt_load_context | ( | void |  | ) |

Load context function.

## ◆ pwr_mgmt_mem_ctl_set()

void pwr_mgmt_mem_ctl_set | ( | uint32_t | mem_sleep_state,
|  | uint32_t | mem_work_state
| ) |  |

Mem state control under deep sleep & work state.

Parameters

  mem_sleep_state | : control in deep sleep.
  mem_work_state | : control in work state.

## ◆ pwr_mgmt_mode_get()

pwr_mgmt_mode_t pwr_mgmt_mode_get | ( | void |  | ) |

Get the specified sleep mode.

Returns
  Power Management Mode :: pwr_mgmt_mode_t

## ◆ pwr_mgmt_mode_set()

void pwr_mgmt_mode_set | ( | pwr_mgmt_mode_t | pm_mode | ) |

Set the specified sleep mode.

When the setting is completed, the system will automatically enter the specified sleep mode through the strategy.

Parameters

  [in] | pm_mode | : sleep level

## ◆ pwr_mgmt_notify_timer_event()

void pwr_mgmt_notify_timer_event | ( | notify_timer_event_t | timer_event | ) |

This function is used to push startup information in app timer.

This information will optimize power management strategy. Note that this function is an advanced API and users should not use it directly.

Parameters

  [in] | timer_event | : EVENT_APP_TIMER_START or EVENT_APP_TIMER_STOP

## ◆ pwr_mgmt_register_io_dump_func()

void pwr_mgmt_register_io_dump_func | ( | io_dump_func_t | dump_func | ) |

function registered to dump io configuration.

Parameters

  [in] | dump_func | Pointer to IO configuration dump function

## ◆ pwr_mgmt_register_trace_func()

void pwr_mgmt_register_trace_func | ( | trace_func_t | trace_func | ) |

Trace function register.

Parameters

  [in] | trace_func | Trace function.

## ◆ pwr_mgmt_save_context()

void pwr_mgmt_save_context | ( | void |  | ) |

Save context function.

## ◆ pwr_mgmt_schedule()

void pwr_mgmt_schedule | ( | void |  | ) |

Sleep Policy Scheduling Function.

Note that:

1. This function shall only be used in non-RTOS environments;
2. This function shall only be used in main function;
3. Local variables shall not be used in main function when this api used.

## ◆ pwr_mgmt_set_callback()

void pwr_mgmt_set_callback | ( | pwr_dev_check_func_t | dev_check_fun,
|  | pwr_before_sleep_func_t | before_sleep_fun
| ) |  |

Set PMU callback function.

Parameters

  dev_check_fun | : Device check callback function.
  before_sleep_fun | : Pre-execution callback function for deep sleep.

## ◆ pwr_mgmt_set_wakeup_flag()

void pwr_mgmt_set_wakeup_flag | ( | boot_mode_t | boot_mode | ) |

Mark the mode of next boot, cold boot or warm boot.

Parameters

  [in] | boot_mode | : cold boot or warm boot.

## ◆ pwr_mgmt_shutdown()

pwr_mgmt_mode_t pwr_mgmt_shutdown | ( | void |  | ) |

This function allows ARM to enter deep sleep mode, but users should not use this function directly.

Note that this function is only available in environments where non-RTOS is used, and that users can only execute it while in main.c.

Returns
  Power Management Mode :: pwr_mgmt_mode_t

## ◆ pwr_mgmt_ultra_sleep()

void pwr_mgmt_ultra_sleep | ( | uint32_t | time_ms | ) |

Execution of this function allows ARM to enter the ultra sleep state and wakeup the chip when an event occurs.

Parameters

  time_ms | : Specifies the wake-up time during ultra sleep. If time_ms is equal to 0, then sleep timer will not be enabled. This parameter must be a number between min_value = 0 and max_value = 131071999, if time_ms bigger than 131071999, then 131071999 will be used.

## ◆ pwr_mgmt_update_wkup_param()

void pwr_mgmt_update_wkup_param | ( | void |  | ) |

Update wakeup param.

## ◆ pwr_mgmt_wakeup_source_clear()

void pwr_mgmt_wakeup_source_clear | ( | uint32_t | wakeup_source | ) |

Clear the wakeup source.

Parameters

  [in] | wakeup_source | : PWR_WKUP_COND_EXT PWR_WKUP_COND_TIMER PWR_WKUP_COND_BLE PWR_WKUP_COND_CALENDAR PWR_WKUP_COND_BOD_FEDGE PWR_WKUP_COND_MSIO_COMP

## ◆ pwr_mgmt_wakeup_source_setup()

void pwr_mgmt_wakeup_source_setup | ( | uint32_t | wakeup_source | ) |

Set the wakeup source.

Parameters

  [in] | wakeup_source | : PWR_WKUP_COND_EXT PWR_WKUP_COND_TIMER PWR_WKUP_COND_BLE PWR_WKUP_COND_CALENDAR PWR_WKUP_COND_BOD_FEDGE PWR_WKUP_COND_MSIO_COMP

## ◆ pwr_mgmt_wfe_sleep()

void pwr_mgmt_wfe_sleep | ( | void |  | ) |

Execution of this function allows ARM to enter the WFE state and exit the WFE state when an event or interrupt occurs.