Adding dynamic USB power support
- Each scan module now has a current change callback which passes the available current as a parameter - No longer attempts to use the max 500 mA immediately, starts with 100 mA then goes to 500 mA after enumeration - If enumeration fails due to bMaxPower of 500 mA, then attempt again at 100 mA (might also be possible to go even lower to 20 mA in certain cases) - Now working with the Apple Ipad (no over-power messages) - Fixed Wake-up behaviour on Apple Ipad (and likely other iOS devices) - More effecient set_feature/clear_feature handling (device handler) - Initial power handling via Interconnect (still needs work to get it more dynamic)
This commit is contained in:
parent
62ba0c558b
commit
aaae9bc0f2
29 changed files with 503 additions and 48 deletions
|
@ -383,11 +383,17 @@ void LED_reset()
|
|||
LED_writeReg( addr, 0x00, 0x08, 0x0B );
|
||||
}
|
||||
|
||||
// Disable Software shutdown of ISSI chip
|
||||
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||
// 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 )
|
||||
{
|
||||
uint8_t addr = LED_pageBuffer[ ch ].i2c_addr;
|
||||
LED_writeReg( addr, 0x0A, 0x01, 0x0B );
|
||||
// Disable Software shutdown of ISSI chip
|
||||
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||
{
|
||||
uint8_t addr = LED_pageBuffer[ ch ].i2c_addr;
|
||||
LED_writeReg( addr, 0x0A, 0x01, 0x0B );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,8 +515,35 @@ void LED_linkedSend()
|
|||
|
||||
// LED State processing loop
|
||||
uint32_t LED_timePrev = 0;
|
||||
unsigned int LED_currentEvent = 0;
|
||||
inline void 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
|
||||
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||
{
|
||||
uint8_t addr = LED_pageBuffer[ ch ].i2c_addr;
|
||||
LED_writeReg( addr, 0x0A, 0x00, 0x0B );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Disable Software shutdown of ISSI chip
|
||||
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||
{
|
||||
uint8_t addr = LED_pageBuffer[ ch ].i2c_addr;
|
||||
LED_writeReg( addr, 0x0A, 0x01, 0x0B );
|
||||
}
|
||||
}
|
||||
|
||||
LED_currentEvent = 0;
|
||||
}
|
||||
|
||||
// Check to see if frame buffers are ready to replenish
|
||||
if ( LED_FrameBufferReset )
|
||||
{
|
||||
|
@ -585,6 +618,15 @@ inline void LED_scan()
|
|||
}
|
||||
|
||||
|
||||
// Called by parent Scan Module whenver the available current has changed
|
||||
// current - mA
|
||||
void LED_currentChange( unsigned int current )
|
||||
{
|
||||
// Delay action till next LED scan loop (as this callback sometimes occurs during interrupt requests)
|
||||
LED_currentEvent = current;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----- Capabilities -----
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue