microHAL
An abstraction layer for your future F4xx projects
Loading...
Searching...
No Matches
_init.h
Go to the documentation of this file.
1
13#ifndef MCU_INIT_H
14#define MCU_INIT_H
15
16/* -- Includes -- */
17#include "defines.h"
18#include "isr.h"
19#include "rcc.h"
20
21/* -- Coprocessors -- */
22#define EN_FPU FALSE
23
24/* Clock Configuration:
25 * 8MHz (HSE) / 4 (PLLM) = 2MHz
26 * 2MHz * 180 (PLLN) = 360MHz
27 * 360MHz / 2 (PLLP) = 180MHz
28 * 180MHz / 4 (PPRE1) = 45MHz (APB1)
29 * 180MHz / 2 (PPRE2) = 90MHz (APB2)
30 */
31
32#define PLLM_VAL 4U
33#define PLLN_VAL 180U
34#define PLLP_VAL 0U // == 2
35#define PPRE1_VAL RCC_APB_PRESCALER_DIV4
36#define PPRE2_VAL RCC_APB_PRESCALER_DIV2
37#define PLLSRC_VAL 1U // Use HSE clock
38
39_Static_assert((((HSE_CLK / PLLM_VAL) * PLLN_VAL) / 2) == (SYS_CLK),
40 "System clock calculation mismatch. Did you update SYS_CLK?");
41
42_Static_assert((SYS_CLK / 4) == (APB1_CLK),
43 "APB1 clock calculation mismatch. Did you update APB1_CLK?");
44
45_Static_assert((SYS_CLK / 2) == (APB2_CLK),
46 "APB2 clock calculation mismatch. Did you update APB2_CLK?");
47
48/* Power Regulation */
49#define EN_OVERDRIVE TRUE
50
56void mcu_init(void);
57
58#endif
void mcu_init(void)
MCU initialization function.
Definition _init.c:74
Defines used commonly in most files.
Function prototypes of the interrupt handlers.
Function prototypes for the RCC driver.