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
e761960aca
commit
46765e85c5
25 changed files with 463 additions and 41 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2015 by Jacob Alexander
|
||||
/* Copyright (C) 2014-2016 by Jacob Alexander
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -428,7 +428,7 @@ void Matrix_scan( uint16_t scanNum )
|
|||
|
||||
|
||||
// Matrix ghosting check and elimination
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
#ifdef GHOSTING_MATRIX
|
||||
// strobe = column, sense = row
|
||||
|
||||
|
@ -465,7 +465,7 @@ void Matrix_scan( uint16_t scanNum )
|
|||
row_use[row] = used;
|
||||
row_ghost[row] = 0; // clear
|
||||
}
|
||||
|
||||
|
||||
// Check if matrix has ghost
|
||||
// Happens when key is pressed and some other key is pressed in same row and another in same column
|
||||
//print(" G ");
|
||||
|
@ -494,10 +494,10 @@ void Matrix_scan( uint16_t scanNum )
|
|||
uint8_t key = Matrix_colsNum * row + col;
|
||||
KeyState *state = &Matrix_scanArray[ key ];
|
||||
KeyGhost *st = &Matrix_ghostArray[ key ];
|
||||
|
||||
|
||||
// col or row is ghosting (crossed)
|
||||
uint8_t ghost = (col_ghost[col] > 0 || row_ghost[row] > 0) ? 1 : 0;
|
||||
|
||||
|
||||
st->prev = st->cur; // previous
|
||||
// save state if no ghost or outside ghosted area
|
||||
if ( ghost == 0 )
|
||||
|
@ -505,9 +505,9 @@ void Matrix_scan( uint16_t scanNum )
|
|||
// final
|
||||
// use saved state if ghosting, or current if not
|
||||
st->cur = ghost > 0 ? st->saved : state->curState;
|
||||
|
||||
|
||||
// Send keystate to macro module
|
||||
KeyPosition k = !st->cur
|
||||
KeyPosition k = !st->cur
|
||||
? (!st->prev ? KeyState_Off : KeyState_Release)
|
||||
: ( st->prev ? KeyState_Hold : KeyState_Press);
|
||||
//if (!st->cur && !st->prev) k = KeyState_Off; else
|
||||
|
@ -518,7 +518,7 @@ void Matrix_scan( uint16_t scanNum )
|
|||
}
|
||||
}
|
||||
#endif
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
// State Table Output Debug
|
||||
|
@ -567,6 +567,15 @@ void Matrix_scan( uint16_t scanNum )
|
|||
}
|
||||
|
||||
|
||||
// Called by parent scan module whenever the available current changes
|
||||
// current - mA
|
||||
void Matrix_currentChange( unsigned int current )
|
||||
{
|
||||
// TODO - Any potential power savings?
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----- CLI Command Functions -----
|
||||
|
||||
void cliFunc_matrixDebug ( char* args )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue