Loading...
Searching...
No Matches
rcc.h
1
8
9// ALLOW FORMATTING
10#ifndef RCC_H
11#define RCC_H
12
13// Enable clock and reset peripheral
14#define RCC_START_PERIPHERAL(bus, peripheral) \
15 RCC->bus##ENR |= (RCC_##bus##ENR_##peripheral##EN); \
16 RCC->bus##RSTR |= (RCC_##bus##RSTR_##peripheral##RST); \
17 __ASM("NOP"); \
18 __ASM("NOP"); \
19 RCC->bus##RSTR &= ~(RCC_##bus##RSTR_##peripheral##RST);
20
21// Reset peripheral and registers
22#define RCC_ENABLE_PERIPHERAL(bus, peripheral) \
23 RCC->bus##ENR |= (RCC_##bus##ENR_##peripheral##EN);
24
25// Reset peripheral and registers
26#define RCC_RESET_PERIPHERAL(bus, peripheral) \
27 RCC->bus##RSTR |= (RCC_##bus##RSTR_##peripheral##RST); \
28 __ASM("NOP"); \
29 __ASM("NOP"); \
30 RCC->bus##RSTR &= ~(RCC_##bus##RSTR_##peripheral##RST);
31
32#endif