1.35.14 Supply Controller (SUPC)
The Supply Controller (SUPC) controls the supply voltages of the system. The SUPC also generates the slow
clock by selecting either the low-power RC oscillator or the low-power crystal oscillator.
Using The Library
SUPC Peripheral library provides API's and they can be used to perform below functionalities.
-
To put the device either in Sleep, Backup or Wait mode.
-
To read and write the General Purpose Backup Register (GPBR).
-
Generate supply monitor callback to save critical data to prepare the system for a power down. Supply monitor can generate interrupt or Reset the device when supply voltage crosses below the specified threshold level.
The examples shows the code to enter sleep, backup and wait mode.
while(1)
{
switch(cmd)
{
case SLEEP_MODE:
{
SUPC_SleepModeEnter();
break;
}
case WAIT_MODE:
{
SUPC_WaitModeEnter(PMC_FSMR_FLPM_FLASH_DEEP_POWERDOWN, WAITMODE_WKUP_WKUP7);
break;
}
case BACKUP_MODE:
{
SUPC_BackupModeEnter();
break;
}
}
}
Library Interface
Supply Controller peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
SUPC_Initialize | Initializes SUPC x module of the device |
SUPC_SleepModeEnter | Puts the device into Sleep mode |
SUPC_WaitModeEnter | Puts the device into Wait mode |
SUPC_BackupModeEnter | Puts the device into Backup mode |
SUPC_GPBRRead | Reads the data from General Purpose Backup Register(GPBR) |
SUPC_GPBRWrite | Writes data to the General Purpose Backup Register(GPBR) |
SUPC_CallbackRegister | Allows application to register callback with PLIB |
Data types and constants
Name | Type | Description |
---|---|---|
WAITMODE_WKUP_SOURCE | Enum | Identifies the wakeup input source |
WAITMODE_FLASH_STATE | Enum | Identifies Flash Low-power mode |
SUPC_CALLBACK | Typedef | Pointer to a SUPC callback function |