ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
Loading...
Searching...
No Matches
ACDC_CLOCK.h
Go to the documentation of this file.
1
15#ifndef __ACDC_CLOCK_H
16#define __ACDC_CLOCK_H
17
18#include "stm32f1xx.h"
19#include "ACDC_stdbool.h"
20
21typedef enum{ /* System Clock Speed */
22 SCS_1MHz = 1000000,
23 SCS_2MHz = 2000000,
24 SCS_3MHz = 3000000,
25 SCS_4MHz = 4000000,
26 SCS_5MHz = 5000000,
27 SCS_6MHz = 6000000,
28 SCS_7MHz = 7000000,
29 SCS_8MHz = 8000000,
30 SCS_9MHz = 9000000,
31 SCS_10MHz = 10000000,
32 SCS_11MHz = 11000000,
33 SCS_12MHz = 12000000,
34 SCS_13MHz = 13000000,
35 SCS_14MHz = 14000000,
36 SCS_15MHz = 15000000,
37 SCS_16MHz = 16000000,
38 SCS_18MHz = 18000000,
39 SCS_20MHz = 20000000,
40 SCS_22MHz = 22000000,
41 SCS_24MHz = 24000000,
42 SCS_26MHz = 26000000,
43 SCS_28MHz = 28000000,
44 SCS_30MHz = 30000000,
45 SCS_32MHz = 32000000,
46 SCS_36MHz = 36000000,
47 SCS_40MHz = 40000000,
48 SCS_44MHz = 44000000,
49 SCS_48MHz = 48000000,
50 SCS_52MHz = 52000000,
51 SCS_56MHz = 56000000,
52 SCS_60MHz = 60000000,
53 SCS_64MHz = 64000000,
54 SCS_72MHz = 72000000
56
57typedef enum{ /* MCO Clock Output Control */
58 MCO_NO_CLK = RCC_CFGR_MCO_NOCLOCK,
59 MCO_SYSCLK = RCC_CFGR_MCO_SYSCLK,
60 MCO_HSICLK = RCC_CFGR_MCO_HSI,
61 MCO_HSECLK = RCC_CFGR_MCO_HSE,
62 MCO_PLLCLK = RCC_CFGR_MCO_PLLCLK_DIV2
64
65typedef enum{ /* ADC Clock Prescaler */
66 ADC_DIV_2 = RCC_CFGR_ADCPRE_DIV2,
67 ADC_DIV_4 = RCC_CFGR_ADCPRE_DIV4,
68 ADC_DIV_6 = RCC_CFGR_ADCPRE_DIV6,
69 ADC_DIV_8 = RCC_CFGR_ADCPRE_DIV8,
71
72typedef enum{ /* APBx Clock Prescaler */
73 APB_DIV_1 = 0b000,
74 APB_DIV_2 = 0b100,
75 APB_DIV_4 = 0b101,
76 APB_DIV_8 = 0b110,
77 APB_DIV_16 = 0b111,
79
83
87
91
95
99
103
107
111
115
116#endif
void CLOCK_SetSystemClockSpeed(SystemClockSpeed SCS_x)
Sets the SYSCLK speed, and sets the perepherals to their fastest speed available.
Definition ACDC_CLOCK.c:40
MicroClockOutput
Definition ACDC_CLOCK.h:57
@ MCO_HSECLK
Definition ACDC_CLOCK.h:61
@ MCO_HSICLK
Definition ACDC_CLOCK.h:60
@ MCO_SYSCLK
Definition ACDC_CLOCK.h:59
@ MCO_NO_CLK
Definition ACDC_CLOCK.h:58
@ MCO_PLLCLK
Definition ACDC_CLOCK.h:62
SystemClockSpeed CLOCK_GetSystemClockSpeed(void)
Retrieves the current SYSCLK.
Definition ACDC_CLOCK.c:124
void CLOCK_SetADCPrescaler(ADC_Prescaler ADC_DIV_x)
Sets the ADC's Prescaler to either 2, 4, 6, 8.
Definition ACDC_CLOCK.c:153
APB_Prescaler
Definition ACDC_CLOCK.h:72
@ APB_DIV_2
Definition ACDC_CLOCK.h:74
@ APB_DIV_1
Definition ACDC_CLOCK.h:73
@ APB_DIV_4
Definition ACDC_CLOCK.h:75
@ APB_DIV_8
Definition ACDC_CLOCK.h:76
@ APB_DIV_16
Definition ACDC_CLOCK.h:77
SystemClockSpeed CLOCK_GetAPB1ClockSpeed(void)
Retrieves the clock speed of the APB1 Clock.
Definition ACDC_CLOCK.c:128
SystemClockSpeed CLOCK_GetAPB2ClockSpeed(void)
Retrieves the clock speed of the APB2 Clock.
Definition ACDC_CLOCK.c:132
SystemClockSpeed
Definition ACDC_CLOCK.h:21
@ SCS_5MHz
Definition ACDC_CLOCK.h:26
@ SCS_8MHz
Definition ACDC_CLOCK.h:29
@ SCS_36MHz
Definition ACDC_CLOCK.h:46
@ SCS_64MHz
Definition ACDC_CLOCK.h:53
@ SCS_24MHz
Definition ACDC_CLOCK.h:41
@ SCS_15MHz
Definition ACDC_CLOCK.h:36
@ SCS_40MHz
Definition ACDC_CLOCK.h:47
@ SCS_16MHz
Definition ACDC_CLOCK.h:37
@ SCS_13MHz
Definition ACDC_CLOCK.h:34
@ SCS_14MHz
Definition ACDC_CLOCK.h:35
@ SCS_20MHz
Definition ACDC_CLOCK.h:39
@ SCS_4MHz
Definition ACDC_CLOCK.h:25
@ SCS_56MHz
Definition ACDC_CLOCK.h:51
@ SCS_2MHz
Definition ACDC_CLOCK.h:23
@ SCS_22MHz
Definition ACDC_CLOCK.h:40
@ SCS_7MHz
Definition ACDC_CLOCK.h:28
@ SCS_3MHz
Definition ACDC_CLOCK.h:24
@ SCS_48MHz
Definition ACDC_CLOCK.h:49
@ SCS_72MHz
Definition ACDC_CLOCK.h:54
@ SCS_30MHz
Definition ACDC_CLOCK.h:44
@ SCS_11MHz
Definition ACDC_CLOCK.h:32
@ SCS_6MHz
Definition ACDC_CLOCK.h:27
@ SCS_44MHz
Definition ACDC_CLOCK.h:48
@ SCS_52MHz
Definition ACDC_CLOCK.h:50
@ SCS_26MHz
Definition ACDC_CLOCK.h:42
@ SCS_28MHz
Definition ACDC_CLOCK.h:43
@ SCS_12MHz
Definition ACDC_CLOCK.h:33
@ SCS_18MHz
Definition ACDC_CLOCK.h:38
@ SCS_60MHz
Definition ACDC_CLOCK.h:52
@ SCS_10MHz
Definition ACDC_CLOCK.h:31
@ SCS_32MHz
Definition ACDC_CLOCK.h:45
@ SCS_1MHz
Definition ACDC_CLOCK.h:22
@ SCS_9MHz
Definition ACDC_CLOCK.h:30
void CLOCK_SetAPB1Prescaler(APB_Prescaler APB_DIV_x)
Sets the Advanced Peripheral Bus 1 Prescaler to either 1, 2, 4, 8, 16.
Definition ACDC_CLOCK.c:157
SystemClockSpeed CLOCK_GetAPB1TimerClockSpeed(void)
Retrieves the clock speed of the APB2 Timer Clock.
Definition ACDC_CLOCK.c:136
ADC_Prescaler
Definition ACDC_CLOCK.h:65
@ ADC_DIV_2
Definition ACDC_CLOCK.h:66
@ ADC_DIV_6
Definition ACDC_CLOCK.h:68
@ ADC_DIV_8
Definition ACDC_CLOCK.h:69
@ ADC_DIV_4
Definition ACDC_CLOCK.h:67
void CLOCK_SetMcoOutput(MicroClockOutput MCO_x)
Enables the MCO output on Pin PA8 using MCO_x as the clock source.
Definition ACDC_CLOCK.c:141
void CLOCK_SetAPB2Prescaler(APB_Prescaler APB_DIV_x)
Sets the Advanced Peripheral Bus 2 Prescaler to either 1, 2, 4, 8, 16.
Definition ACDC_CLOCK.c:163
Header file for the type bool.