// ----- Variables -----
-// Buffer used to inform the macro processing module which keys have been detected as pressed
-volatile uint8_t KeyIndex_Buffer[KEYBOARD_BUFFER];
-volatile uint8_t KeyIndex_BufferUsed;
-
-
// Scan Module command dictionary
-const char scanCLIDictName[] = "DPH Module Commands";
-const CLIDictItem scanCLIDict[] = {
- { "echo", "Example command, echos the arguments.", cliFunc_echo },
- { "avgDebug", "Enables/Disables averaging results." NL "\t\tDisplays each average, starting from Key 0x00, ignoring 0 valued averages.", cliFunc_avgDebug },
- { "keyDebug", "Enables/Disables long debug for each keypress." NL "\t\tkeycode - [strobe:mux] : sense val : threshold+delta=total : margin", cliFunc_keyDebug },
- { "pressDebug", "Enables/Disables short debug for each keypress.", cliFunc_pressDebug },
- { "problemKeys", "Display current list of problem keys,", cliFunc_problemKeys },
- { "senseDebug", "Prints out the current sense table N times." NL "\t\tsense:max sense:delta", cliFunc_senseDebug },
+CLIDict_Entry( echo, "Example command, echos the arguments." );
+CLIDict_Entry( avgDebug, "Enables/Disables averaging results." NL "\t\tDisplays each average, starting from Key 0x00, ignoring 0 valued averages." );
+CLIDict_Entry( keyDebug, "Enables/Disables long debug for each keypress." NL "\t\tkeycode - [strobe:mux] : sense val : threshold+delta=total : margin" );
+CLIDict_Entry( pressDebug, "Enables/Disables short debug for each keypress." );
+CLIDict_Entry( problemKeys, "Display current list of problem keys," );
+CLIDict_Entry( senseDebug, "Prints out the current sense table N times." NL "\t\tsense:max sense:delta" );
+
+CLIDict_Def( scanCLIDict, "DPH Module Commands" ) = {
+ CLIDict_Item( echo ),
+ CLIDict_Item( avgDebug ),
+ CLIDict_Item( keyDebug ),
+ CLIDict_Item( pressDebug ),
+ CLIDict_Item( problemKeys ),
+ CLIDict_Item( senseDebug ),
{ 0, 0, 0 } // Null entry for dictionary end
};
+
// CLI Control Variables
uint8_t enableAvgDebug = 0;
uint8_t enableKeyDebug = 0;
-uint8_t enablePressDebug = 1;
+uint8_t enablePressDebug = 0;
uint8_t senseDebugCount = 3; // In order to get boot-time oddities
}
-// Signal KeyIndex_Buffer that it has been properly read
+// Signal from macro module that keys have been processed
// NOTE: Only really required for implementing "tricks" in converters for odd protocols
-void Scan_finishedWithBuffer( uint8_t sentKeys )
+void Scan_finishedWithMacro( uint8_t sentKeys )
{
return;
}
-// Signal KeyIndex_Buffer that it has been properly read and sent out by the USB module
+// Signal from output module that keys have been processed/sent
// NOTE: Only really required for implementing "tricks" in converters for odd protocols
-void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
+void Scan_finishedWithOutput( uint8_t sentKeys )
{
return;
}
PORTD &= ~D_MASK;
PORTE &= ~E_MASK;
- DDRB |= (1 << RECOVERY_SINK); // SINK pull
+ DDRB |= (1 << RECOVERY_SINK); // SINK pull
PORTB |= (1 << RECOVERY_CONTROL);
PORTB |= (1 << RECOVERY_SOURCE); // SOURCE high
DDRB |= (1 << RECOVERY_SOURCE);
PORTB &= ~(1 << RECOVERY_CONTROL);
DDRB &= ~(1 << RECOVERY_SOURCE);
PORTB &= ~(1 << RECOVERY_SOURCE); // SOURCE low
- DDRB &= ~(1 << RECOVERY_SINK); // SINK high-imp
+ DDRB &= ~(1 << RECOVERY_SINK); // SINK high-imp
}
}
// Initial Keypress
Macro_keyState( key, 0x01 );
}
- else if ( keys_debounce[key] >= DEBOUNCE_THRESHOLD )
- {
- // Held Key
- Macro_keyState( key, 0x02 );
- }
keys_debounce[key]++;
}
+ else if ( keys_debounce[key] >= DEBOUNCE_THRESHOLD )
+ {
+ // Held Key
+ Macro_keyState( key, 0x02 );
+ }
// Long form key debugging
if ( enableKeyDebug )
{
// Debug message
// <key> [<strobe>:<mux>] : <sense val> : <delta + threshold> : <margin>
- dbug_msg("0x");
+ dbug_msg("");
printHex_op( key, 1 );
print(" [");
printInt8( strobe );
else
{
// Release Key
- if ( KeyIndex_BufferUsed > 0 && keys_debounce[key] >= DEBOUNCE_THRESHOLD )
+ if ( keys_debounce[key] >= DEBOUNCE_THRESHOLD )
{
Macro_keyState( key, 0x03 );
}
// If there was an argument, use that instead
if ( *arg1Ptr != '\0' )
{
- senseDebugCount = decToInt( arg1Ptr );
+ senseDebugCount = numToInt( arg1Ptr );
}
}