X-Git-Url: https://git.donarmstrong.com/?p=kiibohd-controller.git;a=blobdiff_plain;f=Scan%2FISSILed%2Fled_scan.c;fp=Scan%2FISSILed%2Fled_scan.c;h=609f2d713b1f1c503529907d05f45b41ff333392;hp=8a92b768c67122b4b3e69b5dd037cb550a1f48d7;hb=46765e85c57e19b89754f4f9c26c8f18b35148e5;hpb=e761960acaa5c83b8b68f0deae9232c9f4bcf11c diff --git a/Scan/ISSILed/led_scan.c b/Scan/ISSILed/led_scan.c index 8a92b76..609f2d7 100644 --- a/Scan/ISSILed/led_scan.c +++ b/Scan/ISSILed/led_scan.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2014-2015 by Jacob Alexander +/* Copyright (C) 2014-2016 by Jacob Alexander * * This file is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -406,8 +406,14 @@ inline void LED_setup() // Set default brightness LED_sendPage( (uint8_t*)LED_defaultBrightness1, sizeof( LED_defaultBrightness1 ), 0 ); - // Disable Software shutdown of ISSI chip - LED_writeReg( 0x0A, 0x01, 0x0B ); + // Do not disable software shutdown of ISSI chip unless current is high enough + // Require at least 150 mA + // May be enabled/disabled at a later time + if ( Output_current_available() >= 150 ) + { + // Disable Software shutdown of ISSI chip + LED_writeReg( 0x0A, 0x01, 0x0B ); + } } @@ -644,6 +650,24 @@ inline uint8_t LED_scan() } +// Called by parent Scan Module whenver the available current has changed +// current - mA +void LED_currentChange( unsigned int current ) +{ + // TODO dim LEDs in low power mode instead of shutting off + if ( current < 150 ) + { + // Enabled Software shutdown of ISSI chip + LED_writeReg( 0x0A, 0x00, 0x0B ); + } + else + { + // Disable Software shutdown of ISSI chip + LED_writeReg( 0x0A, 0x01, 0x0B ); + } +} + + // ----- Capabilities -----