Microchip® Advanced Software Framework

power.h File Reference

SAM L21/L22/R30/R34/R35 Power functionality.

Copyright (c) 2014-2020 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <clock.h>

Data Structures

struct  system_battery_backup_power_switch_config
 Battery Backup Power Switch (BBPS) Control configuration. More...
 
struct  system_standby_config
 Standby configuration. More...
 
struct  system_voltage_references_config
 Voltage References System (VREF) Control configuration. More...
 
struct  system_voltage_regulator_config
 Voltage Regulator System (VREG) Control configuration. More...
 

Enumerations

enum  system_backup_pin {
  SYSTEM_BACKUP_PIN_PSOK = (0x1 << 0),
  SYSTEM_BACKUP_PIN_OUT_0 = (0x1 << 1),
  SYSTEM_BACKUP_PIN_OUT_1 = (0x1 << 2)
}
 Backup IO enum. More...
 
enum  system_battery_power_switch {
  SYSTEM_BATTERY_POWER_SWITCH_NONE = SUPC_BBPS_CONF_NONE_Val,
  SYSTEM_BATTERY_POWER_SWITCH_AUTOMATIC = SUPC_BBPS_CONF_APWS_Val,
  SYSTEM_BATTERY_POWER_SWITCH_FORCED = SUPC_BBPS_CONF_FORCED_Val,
  SYSTEM_BATTERY_POWER_SWITCH_BOD33 = SUPC_BBPS_CONF_BOD33_Val
}
 Battery power switch configuration enum. More...
 
enum  system_performance_level {
  SYSTEM_PERFORMANCE_LEVEL_0 = PM_PLCFG_PLSEL_PL0,
  SYSTEM_PERFORMANCE_LEVEL_2 = PM_PLCFG_PLSEL_PL2
}
 Performance level. More...
 
enum  system_ram_back_bias_mode {
  SYSTEM_RAM_BACK_BIAS_RETENTION = 0,
  SYSTEM_RAM_BACK_BIAS_STANDBY,
  SYSTEM_RAM_BACK_BIAS_STANDBY_OFF,
  SYSTEM_RAM_BACK_BIAS_OFF
}
 RAM Back-biasing mode. More...
 
enum  system_sleepmode {
  SYSTEM_SLEEPMODE_IDLE = PM_SLEEPCFG_SLEEPMODE(0x2),
  SYSTEM_SLEEPMODE_STANDBY = PM_SLEEPCFG_SLEEPMODE_STANDBY,
  SYSTEM_SLEEPMODE_BACKUP = PM_SLEEPCFG_SLEEPMODE_BACKUP,
  SYSTEM_SLEEPMODE_OFF = PM_SLEEPCFG_SLEEPMODE_OFF
}
 Device sleep modes. More...
 
enum  system_voltage_reference {
  SYSTEM_VOLTAGE_REFERENCE_TEMPSENSE,
  SYSTEM_VOLTAGE_REFERENCE_OUTPUT
}
 Voltage reference. More...
 
enum  system_voltage_references_sel {
  SYSTEM_VOLTAGE_REFERENCE_1V0 = SUPC_VREF_SEL_1V0_Val,
  SYSTEM_VOLTAGE_REFERENCE_1V1 = SUPC_VREF_SEL_1V1_Val,
  SYSTEM_VOLTAGE_REFERENCE_1V2 = SUPC_VREF_SEL_1V2_Val,
  SYSTEM_VOLTAGE_REFERENCE_1V25 = SUPC_VREF_SEL_1V25_Val,
  SYSTEM_VOLTAGE_REFERENCE_2V0 = SUPC_VREF_SEL_2V0_Val,
  SYSTEM_VOLTAGE_REFERENCE_2V2 = SUPC_VREF_SEL_2V2_Val,
  SYSTEM_VOLTAGE_REFERENCE_2V4 = SUPC_VREF_SEL_2V4_Val,
  SYSTEM_VOLTAGE_REFERENCE_2V5 = SUPC_VREF_SEL_2V5_Val
}
 Voltage reference value. More...
 
enum  system_voltage_regulator_low_power_efficiency {
  SYSTEM_VOLTAGE_REGULATOR_LOW_POWER_EFFICIENCY_DEFAULT,
  SYSTEM_VOLTAGE_REGULATOR_LOW_POWER_EFFICIENCY_HIGHTEST
}
 Low power efficiency. More...
 
enum  system_voltage_regulator_sel {
  SYSTEM_VOLTAGE_REGULATOR_LDO = SUPC_VREG_SEL_LDO_Val,
  SYSTEM_VOLTAGE_REGULATOR_BUCK = SUPC_VREG_SEL_BUCK_Val
}
 Voltage regulator. More...
 

Functions

Voltage Regulator
static void system_voltage_regulator_get_config_defaults (struct system_voltage_regulator_config *const config)
 Retrieve the default configuration for voltage regulator. More...
 
static void system_voltage_regulator_set_config (struct system_voltage_regulator_config *const config)
 Configure voltage regulator. More...
 
static void system_voltage_regulator_enable (void)
 Enable the selected voltage regulator. More...
 
static void system_voltage_regulator_disable (void)
 Disable the selected voltage regulator. More...
 
Voltage References
static void system_voltage_reference_get_config_defaults (struct system_voltage_references_config *const config)
 Retrieve the default configuration for voltage reference. More...
 
static void system_voltage_reference_set_config (struct system_voltage_references_config *const config)
 Configure voltage reference. More...
 
static void system_voltage_reference_enable (const enum system_voltage_reference vref)
 Enable the selected voltage reference. More...
 
static void system_voltage_reference_disable (const enum system_voltage_reference vref)
 Disable the selected voltage reference. More...
 
Battery Backup Power Switch
static void system_battery_backup_power_switch_get_config_defaults (struct system_battery_backup_power_switch_config *const config)
 Retrieve the default configuration for battery backup power switch control. More...
 
static void system_battery_backup_power_switch_set_config (struct system_battery_backup_power_switch_config *const config)
 Configure battery backup power switch. More...
 
Output Pins in Backup Mode
static void system_backup_pin_output_enable (enum system_backup_pin pin)
 Enable the backup pin output. More...
 
static void system_backup_pin_output_disable (enum system_backup_pin pin)
 Disable the backup pin output. More...
 
static bool system_backup_pin_output_is_enabled (enum system_backup_pin pin)
 Check if backup pin output is enabled. More...
 
static void system_backup_pin_output_enable_rtc_toggle (enum system_backup_pin pin)
 Enable the backup pin toggle on RTC event. More...
 
static void system_backup_pin_output_disable_rtc_toggle (enum system_backup_pin pin)
 Disable the backup pin toggle on RTC event. More...
 
static void system_backup_pin_output_set (enum system_backup_pin pin)
 Set the backup pin. More...
 
static void system_backup_pin_output_clear (enum system_backup_pin pin)
 Clear the backup pin. More...
 
static bool system_backup_pin_output_get (enum system_backup_pin pin)
 Get the backup I/O input values. More...
 
Device Sleep Control
static void system_set_sleepmode (const enum system_sleepmode sleep_mode)
 Set the sleep mode of the device. More...
 
static void system_sleep (void)
 Put the system to sleep waiting for interrupt. More...
 
Performance Level Control
static enum status_code system_switch_performance_level (const enum system_performance_level performance_level)
 Switch performance level. More...
 
static enum
system_performance_level 
system_get_performance_level (void)
 Get performance level. More...
 
static uint8_t system_get_performance_level_status (void)
 Get performance level status. More...
 
static void system_clear_performance_level_status (void)
 Clear performance level status. More...
 
Standby Configuration
static void system_standby_get_config_defaults (struct system_standby_config *const config)
 Retrieve the default configuration for standby. More...
 
static void system_standby_set_config (struct system_standby_config *const config)
 Configure standby mode. More...
 
I/O Retention
static void system_io_retension_enable (void)
 Enable I/O retention. More...
 
static void system_io_retension_disable (void)
 Disable I/O retention. More...