Add clock frequency definitions
This commit is contained in:
parent
4774d5fbe5
commit
ab5b2c61e6
3 changed files with 11 additions and 0 deletions
6
stm32f103c8t6/src/clock.h
Normal file
6
stm32f103c8t6/src/clock.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#define CLOCK_APB1 36000000
|
||||
#define CLOCK_APB2 72000000
|
||||
#define CLOCK_SYSCLK 72000000
|
||||
#define CLOCK_AHB 72000000
|
||||
|
|
@ -24,6 +24,10 @@ static void Clock_Init(void)
|
|||
// Resulting clocks:
|
||||
// SYSCLK, AHB, APB2 72 Mhz
|
||||
// APB1, ADC 36 MHz
|
||||
#if (CLOCK_SYSCLK != 72000000) || (CLOCK_AHB != 72000000) \
|
||||
|| (CLOCK_APB1 != 36000000) || (CLOCK_APB2 != 72000000)
|
||||
#error Clock initialisation does not match definitions in clock.h.
|
||||
#endif
|
||||
|
||||
// Disable all interrupts
|
||||
RCC->CIR = 0x00000000;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "clock.h"
|
||||
#include "pinning.h"
|
||||
#include "buildid.h"
|
||||
#include "debug.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue