Small macro update for debugging the Sony NEWS
This commit is contained in:
parent
ea2654b662
commit
6bf2607872
@ -64,7 +64,8 @@ set( SRCS
|
|||||||
#| "atmega32u4" # Teensy 2.0
|
#| "atmega32u4" # Teensy 2.0
|
||||||
#| "at90usb646" # Teensy++ 1.0
|
#| "at90usb646" # Teensy++ 1.0
|
||||||
#| "at90usb1286" # Teensy++ 2.0
|
#| "at90usb1286" # Teensy++ 2.0
|
||||||
set( MCU "at90usb1286" )
|
set( MCU "atmega32u4" )
|
||||||
|
#set( MCU "at90usb1286" )
|
||||||
|
|
||||||
|
|
||||||
#| Compiler flag to set the C Standard level.
|
#| Compiler flag to set the C Standard level.
|
||||||
|
@ -174,6 +174,61 @@ inline void keyPressDetection( uint8_t *keys, uint8_t numberOfKeys, uint8_t *mod
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Scancode Macro Detection
|
||||||
|
int scancodeMacro( uint8_t scanCode )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
if ( scanCode == 0x7A )
|
||||||
|
{
|
||||||
|
scan_resetKeyboard();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scan_sendData( scanCode );
|
||||||
|
_delay_ms( 200 );
|
||||||
|
scan_sendData( 0x80 | scanCode );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t sendCode = 0;
|
||||||
|
|
||||||
|
// USBCode Macro Detection
|
||||||
|
int usbcodeMacro( uint8_t usbCode )
|
||||||
|
{
|
||||||
|
// Keyboard Input Test Macro
|
||||||
|
switch ( usbCode )
|
||||||
|
{
|
||||||
|
case KEY_F1:
|
||||||
|
sendCode--;
|
||||||
|
scan_sendData( 0x90 );
|
||||||
|
scan_sendData( sendCode );
|
||||||
|
_delay_ms( 200 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_F2:
|
||||||
|
scan_sendData( 0x90 );
|
||||||
|
scan_sendData( sendCode );
|
||||||
|
_delay_ms( 200 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_F3:
|
||||||
|
sendCode++;
|
||||||
|
scan_sendData( 0x90 );
|
||||||
|
scan_sendData( sendCode );
|
||||||
|
_delay_ms( 200 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Given a list of keypresses, translate into the USB key codes
|
// Given a list of keypresses, translate into the USB key codes
|
||||||
// The buffer is cleared after running
|
// The buffer is cleared after running
|
||||||
// If the buffer doesn't fit into the USB send array, the extra keys are dropped
|
// If the buffer doesn't fit into the USB send array, the extra keys are dropped
|
||||||
@ -185,6 +240,16 @@ void keyPressBufferRead( uint8_t *modifiers, uint8_t numberOfModifiers, uint8_t
|
|||||||
// Get the keycode from the buffer
|
// Get the keycode from the buffer
|
||||||
uint8_t key = KeyIndex_Buffer[index];
|
uint8_t key = KeyIndex_Buffer[index];
|
||||||
|
|
||||||
|
// Check key for special usages using the scancode
|
||||||
|
// If non-zero return, ignore normal processing of the scancode
|
||||||
|
if ( scancodeMacro( key ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Check key for special usages using the usbcode
|
||||||
|
// If non-zero return, ignore normal processing of the usbcode
|
||||||
|
if ( usbcodeMacro( map[key] ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
// Determine if the key is a modifier
|
// Determine if the key is a modifier
|
||||||
uint8_t modFound = 0;
|
uint8_t modFound = 0;
|
||||||
for ( uint8_t mod = 0; mod < numberOfModifiers; mod++ ) {
|
for ( uint8_t mod = 0; mod < numberOfModifiers; mod++ ) {
|
||||||
|
@ -177,6 +177,7 @@ ISR(USART1_RX_vect)
|
|||||||
dPrintStrs( tmpStr, " " );
|
dPrintStrs( tmpStr, " " );
|
||||||
|
|
||||||
// Process the scancode
|
// Process the scancode
|
||||||
|
if ( keyValue != 0x00 )
|
||||||
processKeyValue( keyValue );
|
processKeyValue( keyValue );
|
||||||
|
|
||||||
sei(); // Re-enable Interrupts
|
sei(); // Re-enable Interrupts
|
||||||
@ -193,6 +194,11 @@ ISR(USART1_RX_vect)
|
|||||||
// 0x8C Acks the keyboard and gets 0x70 sent back (delayed)
|
// 0x8C Acks the keyboard and gets 0x70 sent back (delayed)
|
||||||
uint8_t scan_sendData( uint8_t dataPayload )
|
uint8_t scan_sendData( uint8_t dataPayload )
|
||||||
{
|
{
|
||||||
|
// Debug
|
||||||
|
char tmpStr[6];
|
||||||
|
hexToStr( dataPayload, tmpStr );
|
||||||
|
info_dPrint( tmpStr, " " );
|
||||||
|
|
||||||
UDR1 = dataPayload;
|
UDR1 = dataPayload;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user