From 2fc408e8e21aeac5c57d8aa8b8e8e4a91856c1ec Mon Sep 17 00:00:00 2001 From: schneider <schneider@blinkenlichts.net> Date: Sat, 27 Jul 2019 12:45:58 +0200 Subject: [PATCH] fix(leds): Use new portexpander API --- lib/card10/leds.c | 9 +++++++++ lib/card10/portexpander.c | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/card10/leds.c b/lib/card10/leds.c index 2ad3cbe30..8d7d21fe9 100644 --- a/lib/card10/leds.c +++ b/lib/card10/leds.c @@ -1,4 +1,5 @@ #include "gpio.h" +#include "portexpander.h" #include <stdint.h> #include <string.h> @@ -204,6 +205,14 @@ void leds_init(void) leds[i][3] = 8; } + if(portexpander_detected()) { + // Turn on LEDs + // TODO: only turn on LEDs if value != 0,0,0 && dim > 0 + portexpander_set(0, 0); + portexpander_set(1, 0); + portexpander_set(2, 0); + } + leds_update(); } diff --git a/lib/card10/portexpander.c b/lib/card10/portexpander.c index e372e71fe..920d8dfa9 100644 --- a/lib/card10/portexpander.c +++ b/lib/card10/portexpander.c @@ -41,12 +41,6 @@ void portexpander_init(void) command[0] = 0x01; command[1] = output_state; I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0); - - // Turn on LEDs - // TODO: only turn on LEDs if value != 0,0,0 && dim > 0 - command[0] = 0x01; - command[1] = 0x90; - I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0); } uint8_t portexpander_get(void) -- GitLab