libopencm3/libopencm3 — pull request #163 by BuFran (2013-06-17 12:24:08+00:00)
Title: An idea for accessing clock/reset of modules through RCC

I have an idea for accessing RCC registers doing reset and clock manipulation in more readable way.

Currently only for F4 target as tested example. I can extend and test it for F1 and L1 target, for F2 i cannot test (having no discovery platform for F2)

Let's see on the current standard, shown in next example. If I would like to create the line of code, I must open the Reference Manual and search for appropriate bit and register.

```C
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
....
rcc_peripheral_reset(&RCC_APB2RSTR, RCC_APB2RSTR_USART1RST);
rcc_peripheral_clear_reset(&RCC_APB2RSTR, RCC_APB2RSTR_USART1RST);
```

After my patch, i can write more readable code, because bit and register selection can be done in the background in rcc.c

```C
rcc_periph_clock_enable(USART1);
rcc_periph_clock_enable(GPIOD);
....
rcc_periph_reset_pulse(USART1)
```

The only problem that my solution has, is performance.

Regards.

Frantisek Burian