ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
Loading...
Searching...
No Matches
ACDC_CLOCK.c File Reference

Implentation of clock configuration functions for STM32F103xB MCU. More...

#include "ACDC_CLOCK.h"
#include "ACDC_TIMER.h"
#include "ACDC_GPIO.h"

Macros

#define MAX_MCO_CLK_SPEED   50000000
 

Functions

void CLOCK_SetSystemClockSpeed (SystemClockSpeed SCS_x)
 Sets the SYSCLK speed, and sets the perepherals to their fastest speed available.
 
SystemClockSpeed CLOCK_GetSystemClockSpeed (void)
 Retrieves the current SYSCLK.
 
SystemClockSpeed CLOCK_GetAPB1ClockSpeed (void)
 Retrieves the clock speed of the APB1 Clock.
 
SystemClockSpeed CLOCK_GetAPB2ClockSpeed (void)
 Retrieves the clock speed of the APB2 Clock.
 
SystemClockSpeed CLOCK_GetAPB1TimerClockSpeed (void)
 Retrieves the clock speed of the APB2 Timer Clock.
 
void CLOCK_SetMcoOutput (MicroClockOutput MCO_x)
 Enables the MCO output on Pin PA8 using MCO_x as the clock source.
 
void CLOCK_SetADCPrescaler (ADC_Prescaler ADC_DIV_x)
 Sets the ADC's Prescaler to either 2, 4, 6, 8.
 
void CLOCK_SetAPB1Prescaler (APB_Prescaler APB_DIV_x)
 Sets the Advanced Peripheral Bus 1 Prescaler to either 1, 2, 4, 8, 16.
 
void CLOCK_SetAPB2Prescaler (APB_Prescaler APB_DIV_x)
 Sets the Advanced Peripheral Bus 2 Prescaler to either 1, 2, 4, 8, 16.
 

Detailed Description

Implentation of clock configuration functions for STM32F103xB MCU.

Author
Devin Marx
Version
0.1
Date
2023-11-3

Macro Definition Documentation

◆ MAX_MCO_CLK_SPEED

#define MAX_MCO_CLK_SPEED   50000000

Function Documentation

◆ CLOCK_GetAPB1ClockSpeed()

SystemClockSpeed CLOCK_GetAPB1ClockSpeed ( void )

Retrieves the clock speed of the APB1 Clock.

Returns
System Clock Speed (Ex. SCS_72Mhz, SCS_36Mhz, ...)

◆ CLOCK_GetAPB1TimerClockSpeed()

SystemClockSpeed CLOCK_GetAPB1TimerClockSpeed ( void )

Retrieves the clock speed of the APB2 Timer Clock.

Returns
System Clock Speed (Ex. SCS_72Mhz, SCS_36Mhz, ...)

◆ CLOCK_GetAPB2ClockSpeed()

SystemClockSpeed CLOCK_GetAPB2ClockSpeed ( void )

Retrieves the clock speed of the APB2 Clock.

Returns
System Clock Speed (Ex. SCS_72Mhz, SCS_36Mhz, ...)

◆ CLOCK_GetSystemClockSpeed()

SystemClockSpeed CLOCK_GetSystemClockSpeed ( void )

Retrieves the current SYSCLK.

Returns
System Clock Speed (Ex. SCS_72Mhz, SCS_36Mhz, ...)

◆ CLOCK_SetADCPrescaler()

void CLOCK_SetADCPrescaler ( ADC_Prescaler ADC_DIV_x)

Sets the ADC's Prescaler to either 2, 4, 6, 8.

Parameters
PRE_DIV_xADC Prescaler (Ex. ADC_DIV_2, ADC_DIV_4, ...)

◆ CLOCK_SetAPB1Prescaler()

void CLOCK_SetAPB1Prescaler ( APB_Prescaler APB_DIV_x)

Sets the Advanced Peripheral Bus 1 Prescaler to either 1, 2, 4, 8, 16.

Parameters
APB_DIV_xAPB1 Prescaler Divider (Ex. APB_DIV_1, APB_DIV_2, ...)

◆ CLOCK_SetAPB2Prescaler()

void CLOCK_SetAPB2Prescaler ( APB_Prescaler APB_DIV_x)

Sets the Advanced Peripheral Bus 2 Prescaler to either 1, 2, 4, 8, 16.

Parameters
APB_DIV_xAPB2 Prescaler Divider (Ex. APB_DIV_1, APB_DIV_2, ...)

◆ CLOCK_SetMcoOutput()

void CLOCK_SetMcoOutput ( MicroClockOutput MCO_x)

Enables the MCO output on Pin PA8 using MCO_x as the clock source.

Parameters
MCO_xClock output source (Ex. MCO_NO_CLK, MCO_SYSCLK, ...)

◆ CLOCK_SetSystemClockSpeed()

void CLOCK_SetSystemClockSpeed ( SystemClockSpeed SCS_x)

Sets the SYSCLK speed, and sets the perepherals to their fastest speed available.

Parameters
SCS_xSystem Clock Speed (Ex. SCS_72Mhz, SCS_36Mhz, ...)