diff options
Diffstat (limited to 'stmhal/led.c')
-rw-r--r-- | stmhal/led.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/stmhal/led.c b/stmhal/led.c index 310efdcda9..357aed4074 100644 --- a/stmhal/led.c +++ b/stmhal/led.c @@ -133,13 +133,7 @@ STATIC void led_pwm_init(int led) { const led_pwm_config_t *pwm_cfg = &led_pwm_config[led - 1]; // GPIO configuration - GPIO_InitTypeDef gpio_init; - gpio_init.Pin = led_pin->pin_mask; - gpio_init.Mode = GPIO_MODE_AF_PP; - gpio_init.Speed = GPIO_SPEED_FAST; - gpio_init.Pull = GPIO_NOPULL; - gpio_init.Alternate = pwm_cfg->alt_func; - HAL_GPIO_Init(led_pin->gpio, &gpio_init); + mp_hal_pin_config(led_pin, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_NONE, pwm_cfg->alt_func); // TIM configuration switch (pwm_cfg->tim_id) { @@ -148,7 +142,7 @@ STATIC void led_pwm_init(int led) { case 3: __TIM3_CLK_ENABLE(); break; default: assert(0); } - TIM_HandleTypeDef tim; + TIM_HandleTypeDef tim = {0}; tim.Instance = pwm_cfg->tim; tim.Init.Period = LED_PWM_TIM_PERIOD - 1; tim.Init.Prescaler = timer_get_source_freq(pwm_cfg->tim_id) / 1000000 - 1; // TIM runs at 1MHz @@ -296,7 +290,7 @@ void led_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t ki /// Create an LED object associated with the given LED: /// /// - `id` is the LED number, 1-4. -STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) { +STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { // check arguments mp_arg_check_num(n_args, n_kw, 1, 1, false); |