libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.

Defined Constants and Types for the STM32G0xx PWR Control More...

Collaboration diagram for PWR Defines:

Modules

 PWR Registers
 
 VOS
 Voltage scaling range selection.
 
 LPMS
 Low-power mode selection.
 
 PVDRT
 Power voltage detector rising threshold selection.
 
 PVDFT
 Power voltage detector falling threshold selection.
 

Macros

#define PWR_CR1_LPR   (1 << 14)
 
#define PWR_CR1_VOS_SHIFT   9
 
#define PWR_CR1_VOS_MASK   0x3
 
#define PWR_CR1_DBP   (1 << 8)
 
#define PWR_CR1_FPD_LPSLP   (1 << 5)
 
#define PWR_CR1_FPD_LPRUN   (1 << 4)
 
#define PWR_CR1_FPD_STOP   (1 << 3)
 
#define PWR_CR1_LPMS_SHIFT   0
 
#define PWR_CR1_LPMS_MASK   0x07
 
#define PWR_CR2_PVDRT_SHIFT   4
 
#define PWR_CR2_PVDRT_MASK   0x07
 
#define PWR_CR2_PVDFT_SHIFT   1
 
#define PWR_CR2_PVDFT_MASK   0x07
 
#define PWR_CR2_PVDE   (1 << 0)
 
#define PWR_CR3_EIWUL   (1 << 15)
 
#define PWR_CR3_APC   (1 << 10)
 
#define PWR_CR3_ULPEN   (1 << 9)
 
#define PWR_CR3_RRS   (1 << 8)
 
#define PWR_CR3_EWUP6   (1 << 5)
 
#define PWR_CR3_EWUP5   (1 << 4)
 
#define PWR_CR3_EWUP4   (1 << 3)
 
#define PWR_CR3_EWUP2   (1 << 1)
 
#define PWR_CR3_EWUP1   (1 << 0)
 
#define PWR_CR4_VBRS   (1 << 9)
 
#define PWR_CR4_VBE   (1 << 8)
 
#define PWR_CR4_WP6   (1 << 5)
 
#define PWR_CR4_WP5   (1 << 4)
 
#define PWR_CR4_WP4   (1 << 3)
 
#define PWR_CR4_WP2   (1 << 1)
 
#define PWR_CR4_WP1   (1 << 0)
 
#define PWR_SR1_WUFI   (1 << 15)
 
#define PWR_SR1_SBF   (1 << 8)
 
#define PWR_SR1_WUF6   (1 << 5)
 
#define PWR_SR1_WUF5   (1 << 4)
 
#define PWR_SR1_WUF4   (1 << 3)
 
#define PWR_SR1_WUF2   (1 << 1)
 
#define PWR_SR1_WUF1   (1 << 0)
 
#define PWR_SR2_PVDO   (1 << 11)
 
#define PWR_SR2_VOSF   (1 << 10)
 
#define PWR_SR2_REGLPF   (1 << 9)
 
#define PWR_SR2_REGLPS   (1 << 8)
 
#define PWR_SR2_FLASHRDY   (1 << 8)
 
#define PWR_SCR_CSBF   (1 << 8)
 
#define PWR_SCR_CWUF6   (1 << 5)
 
#define PWR_SCR_CWUF5   (1 << 4)
 
#define PWR_SCR_CWUF4   (1 << 3)
 
#define PWR_SCR_CWUF2   (1 << 1)
 
#define PWR_SCR_CWUF1   (1 << 0)
 

Enumerations

enum  pwr_vos_scale { PWR_SCALE1 = PWR_CR1_VOS_RANGE_1 , PWR_SCALE2 = PWR_CR1_VOS_RANGE_2 }
 

Functions

void pwr_set_vos_scale (enum pwr_vos_scale scale)
 Setup voltage scaling range. More...
 
void pwr_disable_backup_domain_write_protect (void)
 Disable RTC domain write protect. More...
 
void pwr_enable_backup_domain_write_protect (void)
 Enable RTC domain write protect. More...
 
void pwr_set_low_power_mode_selection (uint32_t lpms)
 Select the low power mode used in deep sleep. More...
 
void pwr_enable_power_voltage_detect (uint32_t pvdr_level, uint32_t pvdf_level)
 Enable Power Voltage Detector. More...
 
void pwr_disable_power_voltage_detect (void)
 Disable Power Voltage Detector. More...
 

Detailed Description

Defined Constants and Types for the STM32G0xx PWR Control

Version
1.0.0

LGPL License Terms libopencm3 License

Macro Definition Documentation

◆ PWR_CR1_DBP

#define PWR_CR1_DBP   (1 << 8)

Definition at line 79 of file g0/pwr.h.

◆ PWR_CR1_FPD_LPRUN

#define PWR_CR1_FPD_LPRUN   (1 << 4)

Definition at line 82 of file g0/pwr.h.

◆ PWR_CR1_FPD_LPSLP

#define PWR_CR1_FPD_LPSLP   (1 << 5)

Definition at line 81 of file g0/pwr.h.

◆ PWR_CR1_FPD_STOP

#define PWR_CR1_FPD_STOP   (1 << 3)

Definition at line 83 of file g0/pwr.h.

◆ PWR_CR1_LPMS_MASK

#define PWR_CR1_LPMS_MASK   0x07

Definition at line 86 of file g0/pwr.h.

◆ PWR_CR1_LPMS_SHIFT

#define PWR_CR1_LPMS_SHIFT   0

Definition at line 85 of file g0/pwr.h.

◆ PWR_CR1_LPR

#define PWR_CR1_LPR   (1 << 14)

Definition at line 68 of file g0/pwr.h.

◆ PWR_CR1_VOS_MASK

#define PWR_CR1_VOS_MASK   0x3

Definition at line 71 of file g0/pwr.h.

◆ PWR_CR1_VOS_SHIFT

#define PWR_CR1_VOS_SHIFT   9

Definition at line 70 of file g0/pwr.h.

◆ PWR_CR2_PVDE

#define PWR_CR2_PVDE   (1 << 0)

Definition at line 128 of file g0/pwr.h.

◆ PWR_CR2_PVDFT_MASK

#define PWR_CR2_PVDFT_MASK   0x07

Definition at line 115 of file g0/pwr.h.

◆ PWR_CR2_PVDFT_SHIFT

#define PWR_CR2_PVDFT_SHIFT   1

Definition at line 114 of file g0/pwr.h.

◆ PWR_CR2_PVDRT_MASK

#define PWR_CR2_PVDRT_MASK   0x07

Definition at line 100 of file g0/pwr.h.

◆ PWR_CR2_PVDRT_SHIFT

#define PWR_CR2_PVDRT_SHIFT   4

Definition at line 99 of file g0/pwr.h.

◆ PWR_CR3_APC

#define PWR_CR3_APC   (1 << 10)

Definition at line 133 of file g0/pwr.h.

◆ PWR_CR3_EIWUL

#define PWR_CR3_EIWUL   (1 << 15)

Definition at line 132 of file g0/pwr.h.

◆ PWR_CR3_EWUP1

#define PWR_CR3_EWUP1   (1 << 0)

Definition at line 140 of file g0/pwr.h.

◆ PWR_CR3_EWUP2

#define PWR_CR3_EWUP2   (1 << 1)

Definition at line 139 of file g0/pwr.h.

◆ PWR_CR3_EWUP4

#define PWR_CR3_EWUP4   (1 << 3)

Definition at line 138 of file g0/pwr.h.

◆ PWR_CR3_EWUP5

#define PWR_CR3_EWUP5   (1 << 4)

Definition at line 137 of file g0/pwr.h.

◆ PWR_CR3_EWUP6

#define PWR_CR3_EWUP6   (1 << 5)

Definition at line 136 of file g0/pwr.h.

◆ PWR_CR3_RRS

#define PWR_CR3_RRS   (1 << 8)

Definition at line 135 of file g0/pwr.h.

◆ PWR_CR3_ULPEN

#define PWR_CR3_ULPEN   (1 << 9)

Definition at line 134 of file g0/pwr.h.

◆ PWR_CR4_VBE

#define PWR_CR4_VBE   (1 << 8)

Definition at line 145 of file g0/pwr.h.

◆ PWR_CR4_VBRS

#define PWR_CR4_VBRS   (1 << 9)

Definition at line 144 of file g0/pwr.h.

◆ PWR_CR4_WP1

#define PWR_CR4_WP1   (1 << 0)

Definition at line 150 of file g0/pwr.h.

◆ PWR_CR4_WP2

#define PWR_CR4_WP2   (1 << 1)

Definition at line 149 of file g0/pwr.h.

◆ PWR_CR4_WP4

#define PWR_CR4_WP4   (1 << 3)

Definition at line 148 of file g0/pwr.h.

◆ PWR_CR4_WP5

#define PWR_CR4_WP5   (1 << 4)

Definition at line 147 of file g0/pwr.h.

◆ PWR_CR4_WP6

#define PWR_CR4_WP6   (1 << 5)

Definition at line 146 of file g0/pwr.h.

◆ PWR_SCR_CSBF

#define PWR_SCR_CSBF   (1 << 8)

Definition at line 172 of file g0/pwr.h.

◆ PWR_SCR_CWUF1

#define PWR_SCR_CWUF1   (1 << 0)

Definition at line 177 of file g0/pwr.h.

◆ PWR_SCR_CWUF2

#define PWR_SCR_CWUF2   (1 << 1)

Definition at line 176 of file g0/pwr.h.

◆ PWR_SCR_CWUF4

#define PWR_SCR_CWUF4   (1 << 3)

Definition at line 175 of file g0/pwr.h.

◆ PWR_SCR_CWUF5

#define PWR_SCR_CWUF5   (1 << 4)

Definition at line 174 of file g0/pwr.h.

◆ PWR_SCR_CWUF6

#define PWR_SCR_CWUF6   (1 << 5)

Definition at line 173 of file g0/pwr.h.

◆ PWR_SR1_SBF

#define PWR_SR1_SBF   (1 << 8)

Definition at line 155 of file g0/pwr.h.

◆ PWR_SR1_WUF1

#define PWR_SR1_WUF1   (1 << 0)

Definition at line 160 of file g0/pwr.h.

◆ PWR_SR1_WUF2

#define PWR_SR1_WUF2   (1 << 1)

Definition at line 159 of file g0/pwr.h.

◆ PWR_SR1_WUF4

#define PWR_SR1_WUF4   (1 << 3)

Definition at line 158 of file g0/pwr.h.

◆ PWR_SR1_WUF5

#define PWR_SR1_WUF5   (1 << 4)

Definition at line 157 of file g0/pwr.h.

◆ PWR_SR1_WUF6

#define PWR_SR1_WUF6   (1 << 5)

Definition at line 156 of file g0/pwr.h.

◆ PWR_SR1_WUFI

#define PWR_SR1_WUFI   (1 << 15)

Definition at line 154 of file g0/pwr.h.

◆ PWR_SR2_FLASHRDY

#define PWR_SR2_FLASHRDY   (1 << 8)

Definition at line 168 of file g0/pwr.h.

◆ PWR_SR2_PVDO

#define PWR_SR2_PVDO   (1 << 11)

Definition at line 164 of file g0/pwr.h.

◆ PWR_SR2_REGLPF

#define PWR_SR2_REGLPF   (1 << 9)

Definition at line 166 of file g0/pwr.h.

◆ PWR_SR2_REGLPS

#define PWR_SR2_REGLPS   (1 << 8)

Definition at line 167 of file g0/pwr.h.

◆ PWR_SR2_VOSF

#define PWR_SR2_VOSF   (1 << 10)

Definition at line 165 of file g0/pwr.h.

Enumeration Type Documentation

◆ pwr_vos_scale

Enumerator
PWR_SCALE1 
PWR_SCALE2 

Definition at line 181 of file g0/pwr.h.

Function Documentation

◆ pwr_disable_backup_domain_write_protect()

void pwr_disable_backup_domain_write_protect ( void  )

Disable RTC domain write protect.

Definition at line 49 of file pwr.c.

References PWR_CR1, and PWR_CR1_DBP.

◆ pwr_disable_power_voltage_detect()

void pwr_disable_power_voltage_detect ( void  )

Disable Power Voltage Detector.

Definition at line 93 of file pwr.c.

References PWR_CR2.

◆ pwr_enable_backup_domain_write_protect()

void pwr_enable_backup_domain_write_protect ( void  )

Enable RTC domain write protect.

Definition at line 57 of file pwr.c.

References PWR_CR1.

◆ pwr_enable_power_voltage_detect()

void pwr_enable_power_voltage_detect ( uint32_t  pvdr_level,
uint32_t  pvdf_level 
)

Enable Power Voltage Detector.

Parameters
[in]pvdr_levelPower Voltage Detector Rising Threshold voltage PVDRT.
[in]pvdf_levelPower Voltage Detector Falling Threshold voltage PVDFT.

Definition at line 80 of file pwr.c.

References PWR_CR2, PWR_CR2_PVDE, PWR_CR2_PVDFT_MASK, PWR_CR2_PVDFT_SHIFT, PWR_CR2_PVDRT_MASK, and PWR_CR2_PVDRT_SHIFT.

◆ pwr_set_low_power_mode_selection()

void pwr_set_low_power_mode_selection ( uint32_t  lpms)

Select the low power mode used in deep sleep.

Parameters
lpmslow power mode LPMS

Definition at line 66 of file pwr.c.

References PWR_CR1, PWR_CR1_LPMS_MASK, and PWR_CR1_LPMS_SHIFT.

◆ pwr_set_vos_scale()

void pwr_set_vos_scale ( enum pwr_vos_scale  scale)

Setup voltage scaling range.

Definition at line 37 of file pwr.c.

References PWR_CR1, PWR_CR1_VOS_MASK, and PWR_CR1_VOS_SHIFT.

Referenced by rcc_clock_setup().

Here is the caller graph for this function: