|
Core
|
Core clock library. More...
Functions | |
| void | core_clock_ADC12_init () |
| Set the clocks for ADC1 and ADC2 to SYSCLK and enable them. | |
| void | core_clock_ADC345_init () |
| Set the clocks for ADC3, ADC4, and ADC5 to SYSCLK and enable them. | |
| void | core_clock_FDCAN_init (FDCAN_GlobalTypeDef *can) |
| Set FDCAN clock to PCLK1 and enable it. | |
| bool | core_clock_USART_init (USART_TypeDef *usart) |
| Set a USART clock to PCLK1 and enable it. | |
| bool | core_clock_timer_init (TIM_TypeDef *timer) |
| Enable a timer clock. | |
| bool | core_clock_I2C_init (I2C_TypeDef *i2c) |
| Set an I2C clock to PCLK1 and enable it. | |
| bool | core_clock_RTC_init () |
| Enable the external 32.768kHz oscillator and set the RTC clock to it. | |
| void | core_clock_port_init (GPIO_TypeDef *port) |
| Initializes port clock for selected port. | |
| uint8_t | core_clock_generate_params (uint32_t src_freq, uint32_t target_freq, uint8_t *n, uint8_t *m, uint8_t *r) |
| Generate the settings for the N, M, and R dividers from the clock source frequency and the desired output frequency. | |
| bool | core_clock_init () |
| Initialize the STM32G4's core clocks. | |
Core clock library.
This core library component is used to initialize peripheral clocks. Generally, it is only necessary to call core_clock_init() from user code. Other clock initialization functions are called by the respective core module init function.
| void core_clock_FDCAN_init | ( | FDCAN_GlobalTypeDef * | can | ) |
Set FDCAN clock to PCLK1 and enable it.
Initialize GPIO port clocks corresponding to CAN bus selected
| can | FDCAN module to initialize |
| uint8_t core_clock_generate_params | ( | uint32_t | src_freq, |
| uint32_t | target_freq, | ||
| uint8_t * | n, | ||
| uint8_t * | m, | ||
| uint8_t * | r ) |
Generate the settings for the N, M, and R dividers from the clock source frequency and the desired output frequency.
| src_freq | Frequency of the clock source of the PLL, in kilohertz |
| target_freq | Desired frequency of the R output of the PLL, in kilohertz |
| n | Location where the setting of the N divider is stored |
| m | Location where the setting of the M divider is stored |
| r | Location where the setting of the R divider is stored |
| 0 | if the desired setting is outside of the frequency range of the VCO |
| 1 | otherwise |
| bool core_clock_I2C_init | ( | I2C_TypeDef * | i2c | ) |
Set an I2C clock to PCLK1 and enable it.
| i2c | I2C module to initialize |
| 1 | if i2c_num is a valid I2C module |
| 0 | otherwise |
| bool core_clock_init | ( | ) |
Initialize the STM32G4's core clocks.
The SYSCLK frequency will be set to CORE_CLOCK_SYSCLK_FREQ, which is given in kilohertz and defined in core_config.h. This function is generally called immediately after HAL_Init() in the user code.
| 1 | on success |
| 0 | otherwise |
| void core_clock_port_init | ( | GPIO_TypeDef * | port | ) |
Initializes port clock for selected port.
| port | Port to initialize clock for |
| bool core_clock_RTC_init | ( | ) |
Enable the external 32.768kHz oscillator and set the RTC clock to it.
| 1 |
| bool core_clock_timer_init | ( | TIM_TypeDef * | timer | ) |
Enable a timer clock.
| timer | Timer to initialize (TIM2 through TIM7) |
| 1 | if timer is a supported timer module |
| 0 | otherwise |
| bool core_clock_USART_init | ( | USART_TypeDef * | usart | ) |
Set a USART clock to PCLK1 and enable it.
| usart | USART module to initialize |
| 1 | if usart_num is a valid USART module |
| 0 | otherwise |