mimxrt/led: Fix LED init call from main, and simplify led_init.

led_init() was not called, and therefore the machine.LED class seemed not
to work.  led_init() now uses mp_hal_pin_output() to configure the pin.

Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
robert-hh 2023-10-07 12:10:19 +02:00 committed by Damien George
parent 3fb1bb131f
commit a06f4c8df4
2 changed files with 2 additions and 14 deletions

View File

@ -52,19 +52,7 @@ void led_init(void) {
// Turn off LEDs and initialize
for (mp_int_t led = 0; led < NUM_LEDS; led++) {
const machine_pin_obj_t *led_pin = machine_led_obj[led].led_pin;
gpio_pin_config_t pin_config = {
.outputLogic = 1U,
.direction = kGPIO_DigitalOutput,
.interruptMode = kGPIO_NoIntmode,
};
GPIO_PinInit(led_pin->gpio, led_pin->pin, &pin_config);
// ALT mode for GPIO is always 5
IOMUXC_SetPinMux(led_pin->muxRegister, 5U, 0, 0, led_pin->configRegister,
1U); // Software Input On Field: Input Path is determined by functionality
IOMUXC_SetPinConfig(led_pin->muxRegister, 5U, 0, 0, led_pin->configRegister, 0x10B0U);
mp_hal_pin_output(led_pin);
MICROPY_HW_LED_OFF(led_pin);
}
}

View File

@ -93,7 +93,7 @@ int main(void) {
#endif
for (;;) {
#if defined(MICROPY_HW_LED1)
#if defined(MICROPY_HW_LED1_PIN)
led_init();
#endif