diff --git a/lib/card10/leds.c b/lib/card10/leds.c index 2ad3cbe30bda019ac306f31092390afce6c1ffce..8d7d21fe961f2e8b2c8a9e0b85b53f74befd86c1 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 e372e71fe3c389c617c3934f355bfc58d548bb10..920d8dfa9d365e15e48ee3d956a106816e28bfa0 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)