Archived
1
0

Fixing potential WF LED issue

- Added fix for USB Current Change
  * If called during interrupt, could hang the I2C bus
  * Delaying I2C writes till scan loop
This commit is contained in:
Jacob Alexander 2016-03-01 19:35:21 -08:00
parent f57e069bb9
commit 074134c474
2 changed files with 21 additions and 16 deletions

View File

@ -639,12 +639,26 @@ uint8_t I2C_Send( uint8_t *data, uint8_t sendLen, uint8_t recvLen )
// LED State processing loop // LED State processing loop
unsigned int LED_currentEvent = 0;
inline uint8_t LED_scan() inline uint8_t LED_scan()
{ {
// Check for current change event
if ( LED_currentEvent )
{
// TODO dim LEDs in low power mode instead of shutting off
if ( LED_currentEvent < 150 )
{
// Enable Software shutdown of ISSI chip
LED_writeReg( 0x0A, 0x00, 0x0B );
}
else
{
// Disable Software shutdown of ISSI chip
LED_writeReg( 0x0A, 0x01, 0x0B );
}
// I2C Busy LED_currentEvent = 0;
// S & I2C_S_BUSY }
//I2C_S_BUSY
return 0; return 0;
} }
@ -654,17 +668,8 @@ inline uint8_t LED_scan()
// current - mA // current - mA
void LED_currentChange( unsigned int current ) void LED_currentChange( unsigned int current )
{ {
// TODO dim LEDs in low power mode instead of shutting off // Delay action till next LED scan loop (as this callback sometimes occurs during interrupt requests)
if ( current < 150 ) LED_currentEvent = current;
{
// Enabled Software shutdown of ISSI chip
LED_writeReg( 0x0A, 0x00, 0x0B );
}
else
{
// Disable Software shutdown of ISSI chip
LED_writeReg( 0x0A, 0x01, 0x0B );
}
} }

View File

@ -95,7 +95,7 @@ ISSILedMask1 = "
0xFF, 0x00, /* C6-1 -> C6-16 */ 0xFF, 0x00, /* C6-1 -> C6-16 */
0xFF, 0x00, /* C7-1 -> C7-16 */ 0xFF, 0x00, /* C7-1 -> C7-16 */
0xFF, 0x00, /* C8-1 -> C8-16 */ 0xFF, 0x00, /* C8-1 -> C8-16 */
0xFE, 0x00, /* C9-1 -> C9-16 */ 0xFF, 0x00, /* C9-1 -> C9-16 */
"; ";
# LED Brightness Override # LED Brightness Override
@ -124,6 +124,6 @@ ISSILedBrightness1 = "
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C6-1 -> C6-16 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C6-1 -> C6-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */
"; ";