mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 17:23:52 +08:00
cuatro LED (#2005)
* Revert "cuatro: disable LED for now"
This reverts commit 866bd9c3bc.
* re-enable and make sure to use open-drain
* use gpio function
---------
Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -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,18 +70,10 @@ 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);
|
||||
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);
|
||||
// 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_output_type(GPIOD, 15, OUTPUT_TYPE_OPEN_DRAIN);
|
||||
|
||||
// Power readout
|
||||
set_gpio_mode(GPIOC, 5, MODE_ANALOG);
|
||||
|
||||
Reference in New Issue
Block a user