From 0851751615580d02bd6f841e13651923f05fde59 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 3 Aug 2015 00:05:16 +0100 Subject: stmhal: Factor GPIO clock enable logic into mp_hal_gpio_clock_enable. Extracted GPIO clock enable logic into mp_hal_gpio_clock_enable and called from anyplace which might need to use GPIO functions on ports other than A-D. Thanks to Dave Hylands for the patch. --- stmhal/led.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stmhal/led.c') diff --git a/stmhal/led.c b/stmhal/led.c index 11a2ec431..e3dbdb594 100644 --- a/stmhal/led.c +++ b/stmhal/led.c @@ -33,6 +33,7 @@ #include "led.h" #include "pin.h" #include "genhdr/pins.h" +#include "mphal.h" #if defined(MICROPY_HW_LED1) @@ -78,6 +79,7 @@ void led_init(void) { /* Turn off LEDs and initialize */ for (int led = 0; led < NUM_LEDS; led++) { const pin_obj_t *led_pin = pyb_led_obj[led].led_pin; + mp_hal_gpio_clock_enable(led_pin->gpio); MICROPY_HW_LED_OFF(led_pin); GPIO_InitStructure.Pin = led_pin->pin_mask; HAL_GPIO_Init(led_pin->gpio, &GPIO_InitStructure); -- cgit v1.2.3