Skip to content

Commit

Permalink
Replace RCC APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>
  • Loading branch information
Iker Perez del Palomar Sustatxa committed Apr 30, 2021
1 parent b2a5b82 commit e7a5d7a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stddef.h>
#include <stdint.h>

#include <libopencm3/stm32/rcc.h>
#include <drivers/clock_control.h>
#include <drivers/gpio.h>

#include "common/error.h"
Expand Down Expand Up @@ -132,9 +132,13 @@ static inline void bl_led__gpio_mode_setup(enum led_port port)
/* Exported function, documented in led.h */
void bl_led_init(void)
{
rcc_periph_clock_enable(RCC_GPIOA);
rcc_periph_clock_enable(RCC_GPIOB);
rcc_periph_clock_enable(RCC_GPIOC);
const struct device * gpio;

for (uint8_t port = 0 ; port < sizeof(led_port)/sizeof(led_port[0]); port++) {
gpio = device_get_binding(DT_LABEL(DT_NODELABEL(port)));
clock_control_subsys_t subsys = gpio -> config;
clock_control_on(gpio, subsys);
};

bl_led__gpio_mode_setup(LED_PORT_A);
bl_led__gpio_mode_setup(LED_PORT_B);
Expand Down

0 comments on commit e7a5d7a

Please sign in to comment.