diff --git a/drivers/flash.c b/drivers/flash.c index bed13ea..a49df48 100644 --- a/drivers/flash.c +++ b/drivers/flash.c @@ -20,6 +20,11 @@ static volatile struct FLASH* regs = (struct FLASH*)FLASH_BASE_ADDRESS; //--public functions------------------------------------------------------------ +/** + * Sets the correct latency to compensate the core's clock speed. Latency must + * never be too low or the system will crash due to errors when accessing the + * flash, hence the warning in the header + */ void flash_configure(enum FlashPreset preset) { //restore default configuration diff --git a/drivers/rcc.c b/drivers/rcc.c index cf99db1..4af833b 100644 --- a/drivers/rcc.c +++ b/drivers/rcc.c @@ -28,6 +28,10 @@ static volatile struct RCC* regs = (struct RCC*)RCC_BASE_ADDRESS; //--public functions------------------------------------------------------------ +/** + * Configures the clock sources, PLL, prescalers, etc. All peripherals are + * disabled prior to any modifications to avoid unwanted side effects. + */ void rcc_configure(enum RccPreset preset) { //disable all peripherals during clock configuration diff --git a/drivers/rcc.h b/drivers/rcc.h index 30455b6..b3ccc6e 100644 --- a/drivers/rcc.h +++ b/drivers/rcc.h @@ -82,51 +82,40 @@ enum RccApb2 { //--functions------------------------------------------------------------------- /** - * Configures the clocks and buses according to the given preset. - * - * @param preset the preset to use for configuration + * Configures the clocks and buses according to the given preset. Peripheral + * states are kept during the change and additional reconfiguration are + * handled automatically for peripherals that rely on a clock timings (timers, + * watchdogs, ...) */ void rcc_configure(enum RccPreset preset); /** - * Enables peripherals on the APB1 bus according to the given mask. - * - * @param mask the mask for the peripherals to enable + * Enables peripherals on the APB1 bus */ void rcc_enable_apb1(enum RccApb1 mask); /** - * Disables peripherals on the APB1 bus according to the given mask. - * - * @param mask the mask for the peripherals to disable + * Disables peripherals on the APB1 bus */ void rcc_disable_apb1(enum RccApb1 mask); /** - * Resets peripherals on the APB1 bus according to the given mask. - * - * @param mask the mask for the peripherals to reset + * Resets peripherals on the APB1 bus */ void rcc_reset_apb1(enum RccApb1 mask); /** - * Enables peripherals on the APB2 bus according to the given mask. - * - * @param mask the mask for the peripherals to enable + * Enables peripherals on the APB2 bus */ void rcc_enable_apb2(enum RccApb2 mask); /** - * Disables peripherals on the APB2 bus according to the given mask. - * - * @param mask the mask for the peripherals to disable + * Disables peripherals on the APB2 bus */ void rcc_disable_apb2(enum RccApb2 mask); /** - * Resets peripherals on the APB2 bus according to the given mask. - * - * @param mask the mask for the peripherals to reset + * Resets peripherals on the APB2 bus */ void rcc_reset_apb2(enum RccApb2 mask);