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_RESET_PERIPHERAL(bus, peripheral) \
23 RCC->##bus##RSTR |= (RCC_##bus##RSTR_##peripheral##RST); \
24 __ASM("NOP"); \
25 __ASM("NOP"); \
26 RCC->##bus##RSTR &= ~(RCC_##bus##RSTR_##peripheral##RST);
27
28#endif