Core
Loading...
Searching...
No Matches
clock.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "stm32g4xx_hal.h"
14#include <stdbool.h>
15#include <stdint.h>
16
21
26
33void core_clock_FDCAN_init(FDCAN_GlobalTypeDef *can);
34
41bool core_clock_USART_init(USART_TypeDef *usart);
42
49bool core_clock_timer_init(TIM_TypeDef *timer);
50
57bool core_clock_I2C_init(I2C_TypeDef *i2c);
58
64
69void core_clock_port_init(GPIO_TypeDef *port);
70
85uint8_t core_clock_generate_params(uint32_t src_freq, uint32_t target_freq, uint8_t *n, uint8_t *m, uint8_t *r);
86
97bool core_clock_init();
void core_clock_FDCAN_init(FDCAN_GlobalTypeDef *can)
Set FDCAN clock to PCLK1 and enable it.
Definition clock.c:19
bool core_clock_USART_init(USART_TypeDef *usart)
Set a USART clock to PCLK1 and enable it.
Definition clock.c:37
void core_clock_ADC345_init()
Set the clocks for ADC3, ADC4, and ADC5 to SYSCLK and enable them.
Definition clock.c:14
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 ou...
Definition clock.c:114
bool core_clock_timer_init(TIM_TypeDef *timer)
Enable a timer clock.
Definition clock.c:62
void core_clock_port_init(GPIO_TypeDef *port)
Initializes port clock for selected port.
Definition clock.c:104
bool core_clock_I2C_init(I2C_TypeDef *i2c)
Set an I2C clock to PCLK1 and enable it.
Definition clock.c:73
bool core_clock_RTC_init()
Enable the external 32.768kHz oscillator and set the RTC clock to it.
Definition clock.c:94
void core_clock_ADC12_init()
Set the clocks for ADC1 and ADC2 to SYSCLK and enable them.
Definition clock.c:9
bool core_clock_init()
Initialize the STM32G4's core clocks.
Definition clock.c:177