summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2023-10-07 12:10:19 +0200
committerDamien George <damien@micropython.org>2023-10-09 17:10:45 +1100
commita06f4c8df499164721b2132859bef19da48d52d1 (patch)
tree26a03ecfe84372c11af8d0e7dc11a7541092a545
parent3fb1bb131f43207e2201a61139cd3f6e82d6513f (diff)
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>
-rw-r--r--ports/mimxrt/led.c14
-rw-r--r--ports/mimxrt/main.c2
2 files changed, 2 insertions, 14 deletions
diff --git a/ports/mimxrt/led.c b/ports/mimxrt/led.c
index 216affa22..99876a5d9 100644
--- a/ports/mimxrt/led.c
+++ b/ports/mimxrt/led.c
@@ -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);
}
}
diff --git a/ports/mimxrt/main.c b/ports/mimxrt/main.c
index 993e59818..f5d57d530 100644
--- a/ports/mimxrt/main.c
+++ b/ports/mimxrt/main.c
@@ -93,7 +93,7 @@ int main(void) {
#endif
for (;;) {
- #if defined(MICROPY_HW_LED1)
+ #if defined(MICROPY_HW_LED1_PIN)
led_init();
#endif