From bd6cec3b2972fda7435c6030a88f0f97cab4c4b9 Mon Sep 17 00:00:00 2001 From: Robbe Derks Date: Fri, 30 Aug 2024 15:35:50 +0200 Subject: [PATCH] cuatro LED (#2005) * Revert "cuatro: disable LED for now" This reverts commit 866bd9c3bc44a362a64f0104b5e555a064335009. * re-enable and make sure to use open-drain * use gpio function --------- Co-authored-by: Comma Device --- board/boards/cuatro.h | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/board/boards/cuatro.h b/board/boards/cuatro.h index 0bc22da58e..49c207ebed 100644 --- a/board/boards/cuatro.h +++ b/board/boards/cuatro.h @@ -3,17 +3,15 @@ // ////////////////////////// // void cuatro_set_led(uint8_t color, bool enabled) { - // try no LED - UNUSED(enabled); switch (color) { case LED_RED: - set_gpio_output(GPIOD, 15, 1); + set_gpio_output(GPIOD, 15, !enabled); break; - case LED_GREEN: - set_gpio_output(GPIOD, 14, 1); + case LED_GREEN: + set_gpio_output(GPIOD, 14, !enabled); break; case LED_BLUE: - set_gpio_output(GPIOE, 2, 1); + set_gpio_output(GPIOE, 2, !enabled); break; default: break; @@ -72,19 +70,11 @@ void cuatro_set_bootkick(BootState state) { void cuatro_init(void) { red_chiplet_init(); - // LED init - set_gpio_pullup(GPIOD, 14, PULL_NONE); - set_gpio_mode(GPIOD, 14, MODE_OUTPUT); + // init LEDs as open drain + set_gpio_output_type(GPIOE, 2, OUTPUT_TYPE_OPEN_DRAIN); set_gpio_output_type(GPIOD, 14, OUTPUT_TYPE_OPEN_DRAIN); - - set_gpio_pullup(GPIOD, 15, PULL_NONE); - set_gpio_mode(GPIOD, 15, MODE_OUTPUT); set_gpio_output_type(GPIOD, 15, OUTPUT_TYPE_OPEN_DRAIN); - set_gpio_pullup(GPIOE, 2, PULL_NONE); - set_gpio_mode(GPIOE, 2, MODE_OUTPUT); - set_gpio_output_type(GPIOE, 2, OUTPUT_TYPE_OPEN_DRAIN); - // Power readout set_gpio_mode(GPIOC, 5, MODE_ANALOG); set_gpio_mode(GPIOA, 6, MODE_ANALOG);