Major code cleanup and preparation for PartialMap Macro Module

- Code should be working, but much is untested
- All of the old modules will need to update and use the new DefaultMap keymap
- There might still be some naming conflicts with some Scan Modules
This commit is contained in:
Jacob Alexander 2014-04-06 11:49:27 -07:00
parent f3e22fb242
commit 9d423a64a8
81 changed files with 1373 additions and 904 deletions

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2012 by Jacob Alexander
*
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -43,11 +43,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -176,7 +171,7 @@ void processKeyValue( uint8_t keyValue )
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
// Only send data if enabled
if ( KeyIndex_Add_InputSignal )
@ -222,7 +217,7 @@ void removeKeyValue( uint8_t keyValue )
}
}
// Send data
// Send data
uint8_t scan_sendData( uint8_t dataPayload )
{
// Enable the USART Transmitter
@ -245,12 +240,12 @@ uint8_t scan_sendData( uint8_t dataPayload )
}
// Signal KeyIndex_Buffer that it has been properly read
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
}
// Signal that the keys have been properly sent over USB
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
}

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2012 by Jacob Alexander
*
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,18 +49,18 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -18,33 +18,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h microswitch8304.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=betkb_ModifierMask
-DKEYINDEX_MASK=betkb_ColemakMap
#-DKEYINDEX_MASK=betkb_DefaultMap
)
###

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -21,16 +21,8 @@ set( SCAN_SRCS
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
add_definitions(
-I${HEAD_DIR}/Scan/matrix
)
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=budkeypad_ModifierMask
#-DKEYINDEX_MASK=budkeypad_TheProfosistMap
-DKEYINDEX_MASK=budkeypad_DefaultMap
)

View file

@ -114,11 +114,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// Select mux
#define SET_FULL_MUX(X) ((ADMUX) = (((ADMUX) & ~(FULL_MUX_MASK)) | ((X) & (FULL_MUX_MASK))))
@ -198,7 +193,7 @@ uint8_t testColumn( uint8_t strobe );
// ----- Functions -----
// Initial setup for cap sense controller
inline void scan_setup()
inline void Scan_setup()
{
// TODO dfj code...needs cleanup + commenting...
setup_ADC();
@ -282,7 +277,7 @@ inline void scan_setup()
// TODO
#endif
// TODO all this code should probably be in scan_resetKeyboard
// TODO all this code should probably be in Scan_resetKeyboard
for ( int i = 0; i < total_strobes; ++i)
{
cur_keymap[i] = 0;
@ -309,7 +304,7 @@ inline void scan_setup()
// Main Detection Loop
// This is where the important stuff happens
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
capsense_scan();
@ -342,43 +337,15 @@ inline uint8_t scan_loop()
// Return non-zero if macro and USB processing should be delayed
// Macro processing will always run if returning 0
// USB processing only happens once the USB send timer expires, if it has not, scan_loop will be called
// USB processing only happens once the USB send timer expires, if it has not, Scan_loop will be called
// after the macro processing has been completed
return 0;
}
// Reset Keyboard
void scan_resetKeyboard( void )
{
// Empty buffer, now that keyboard has been reset
KeyIndex_BufferUsed = 0;
}
// Send data to keyboard
// NOTE: Only used for converters, since the scan module shouldn't handle sending data in a controller
uint8_t scan_sendData( uint8_t dataPayload )
{
return 0;
}
// Reset/Hold keyboard
// NOTE: Only used for converters, not needed for full controllers
void scan_lockKeyboard( void )
{
}
// NOTE: Only used for converters, not needed for full controllers
void scan_unlockKeyboard( void )
{
}
// Signal KeyIndex_Buffer that it has been properly read
// NOTE: Only really required for implementing "tricks" in converters for odd protocols
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
// Convenient place to clear the KeyIndex_Buffer
KeyIndex_BufferUsed = 0;
@ -388,7 +355,7 @@ void scan_finishedWithBuffer( uint8_t sentKeys )
// Signal KeyIndex_Buffer that it has been properly read and sent out by the USB module
// NOTE: Only really required for implementing "tricks" in converters for odd protocols
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
return;
}
@ -864,7 +831,7 @@ uint8_t testColumn( uint8_t strobe )
// Only add the key to the buffer once
// NOTE: Buffer can easily handle multiple adds, just more efficient
// and nicer debug messages :P
//bufferAdd( key );
//Macro_bufferAdd( key );
}
keys_debounce[key]++;

View file

@ -1,5 +1,5 @@
/* Copyright (C) 2013 by Jacob Alexander
*
/* Copyright (C) 2013-2014 by Jacob Alexander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@ -46,18 +46,18 @@ extern volatile uint8_t KeyIndex_BufferUsed;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -16,33 +16,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h avrcapsense.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=avrcapsense_ModifierMask
#-DKEYINDEX_MASK=avrcapsense_ColemakMap
-DKEYINDEX_MASK=avrcapsense_DefaultMap
)
###

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011 by Jacob Alexander
*
/* Copyright (C) 2011,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -43,11 +43,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
#define setLED(id, status) \
status = status ? 0 : 1; \
scan_setLED( id, status )
@ -72,16 +67,16 @@ volatile uint8_t drawLED = 0;
// ----- Function Declarations -----
void scan_diagnostics( void );
void Scan_diagnostics( void );
void processKeyValue( uint8_t keyValue );
void scan_diagnostics( void );
void scan_setRepeatStart( uint8_t n );
void scan_readSwitchStatus( void );
void scan_repeatControl( uint8_t on );
void scan_enableKeyboard( uint8_t enable );
void scan_setRepeatRate( uint8_t n );
void scan_setLED( uint8_t ledNumber, uint8_t on );
void scan_readLED( void );
void Scan_diagnostics( void );
void Scan_setRepeatStart( uint8_t n );
void Scan_readSwitchStatus( void );
void Scan_repeatControl( uint8_t on );
void Scan_enableKeyboard( uint8_t enable );
void Scan_setRepeatRate( uint8_t n );
void Scan_setLED( uint8_t ledNumber, uint8_t on );
void Scan_readLED( void );
@ -129,7 +124,7 @@ ISR(USART1_RX_vect)
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
{
// Setup Timer Pulse (16 bit)
// 16 MHz / (2 * Prescaler * (1 + OCR1A)) = 1204.8 baud (820 us)
@ -183,7 +178,7 @@ inline void scan_setup()
// Main Detection Loop
// Nothing is required here with the Epson QX-10 Keyboards as the interrupts take care of the inputs
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
return 0;
}
@ -241,7 +236,7 @@ void processKeyValue( uint8_t keyValue )
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
break;
}
@ -293,14 +288,14 @@ void processKeyValue( uint8_t keyValue )
// - Last 4 bits corresond to the KSC signals (P13, P12, P11, P10 respectively)
// Or, that can be read as, each key has it's own keycode (with NO release code)
// Modifiers are treated differently
// Add the key to the buffer, if it isn't already in the current Key Buffer
for ( uint8_t c = 0; c < KeyIndex_BufferUsed + 1; c++ )
{
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
break;
}
@ -368,7 +363,7 @@ void processKeyValue( uint8_t keyValue )
// Send data
// See below functions for the input sequences for the Epson QX-10 Keyboard
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
// Debug
char tmpStr[6];
@ -380,7 +375,7 @@ uint8_t scan_sendData( uint8_t dataPayload )
}
// Signal KeyIndex_Buffer that it has been properly read
inline void scan_finishedWithBuffer( uint8_t sentKeys )
inline void Scan_finishedWithBuffer( uint8_t sentKeys )
{
return;
}
@ -392,7 +387,7 @@ inline void scan_finishedWithBuffer( uint8_t sentKeys )
//
// However, this differentiation causes complications on how the key signals are discarded and used
// The single keypresses must be discarded immediately, while the modifiers must be kept
inline void scan_finishedWithUSBBuffer( uint8_t sentKeys )
inline void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
uint8_t foundModifiers = 0;
@ -423,12 +418,12 @@ inline void scan_finishedWithUSBBuffer( uint8_t sentKeys )
// Reset/Hold keyboard
// Warning! This will cause the keyboard to not send any data, so you can't disable with a keypress
// The Epson QX-10 Keyboards have a command used to lock the keyboard output
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
scan_enableKeyboard( 0x00 );
}
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
scan_enableKeyboard( 0x01 );
}
@ -440,7 +435,7 @@ void scan_unlockKeyboard( void )
// - Sets repeat start time (500 ms)
// - Sets repeat interval (50 ms)
// - Turns off all LEDs
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
// Reset command for the QX-10 Keyboard
scan_sendData( 0xE0 );
@ -451,11 +446,11 @@ void scan_resetKeyboard( void )
// TODO Check
// Runs Diagnostics on the keyboard
// - First does a reset (see scan_resetKeyboard)
// - First does a reset (see Scan_resetKeyboard)
// - Blinks all of the LEDs one after another
// - Outputs 0x00 if no keys are pressed
// - Outputs 0xFF if any keys are being pressed
void scan_diagnostics( void )
void Scan_diagnostics( void )
{
// Send reset command with diagnositics
scan_sendData( 0xE7 );
@ -465,7 +460,7 @@ void scan_diagnostics( void )
// Set Repeat Interval Start
// 300 ms + n * 25 ms
// Interval after which to start the repeated keys
void scan_setRepeatStart( uint8_t n )
void Scan_setRepeatStart( uint8_t n )
{
// Send command
// Binary Representation: 000n nnnn
@ -483,7 +478,7 @@ void scan_setRepeatStart( uint8_t n )
// 101 - Left CTRL
// 110 - GRPH SHIFT
// 111 - Right CTRL
void scan_readSwitchStatus( void )
void Scan_readSwitchStatus( void )
{
scan_sendData( 0x80 );
}
@ -492,7 +487,7 @@ void scan_readSwitchStatus( void )
// Repeat Control
// 0x00 Stops repeat function
// 0x01 Enables repeat function
void scan_repeatControl( uint8_t on )
void Scan_repeatControl( uint8_t on )
{
// Send command
// Binary Representation: 101X XXXn
@ -504,7 +499,7 @@ void scan_repeatControl( uint8_t on )
// Enable Sending Keyboard Data
// 0x00 Stops keycode transmission
// 0x01 Enables keycode transmission
void scan_enableKeyboard( uint8_t enable )
void Scan_enableKeyboard( uint8_t enable )
{
// Send command
// Binary Representation: 110X XXXn
@ -515,7 +510,7 @@ void scan_enableKeyboard( uint8_t enable )
// Set Repeat Interval
// 30 ms + n * 5 ms
// Period between sending each repeated key after the initial interval
void scan_setRepeatRate( uint8_t n )
void Scan_setRepeatRate( uint8_t n )
{
// Send command
// Binary Representation: 001n nnnn
@ -530,7 +525,7 @@ void scan_setRepeatRate( uint8_t n )
//
// 8 LEDs max (Note: 5 connected on my board, there is 1 position empty on the PCB for a total of 6)
// 0 to 7 (0x0 to 0x7)
void scan_setLED( uint8_t ledNumber, uint8_t on )
void Scan_setLED( uint8_t ledNumber, uint8_t on )
{
// Send command
// Binary Representation: 010l llln
@ -564,7 +559,7 @@ void scan_setLED( uint8_t ledNumber, uint8_t on )
// Read LED Status
// High priority data output (may overwrite some keycode data)
void scan_readLED( void )
void Scan_readLED( void )
{
scan_sendData( 0x7F );
}

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011 by Jacob Alexander
*
/* Copyright (C) 2011,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -48,18 +48,18 @@ extern volatile uint8_t KeyIndex_BufferUsed;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -18,33 +18,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h epsonqx10.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=epsonqx10_ModifierMask
-DKEYINDEX_MASK=epsonqx10_ColemakMap
#-DKEYINDEX_MASK=epsonqx10_DefaultMap
)
###

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2013 by Jacob Alexander
*
/* Copyright (C) 2013-2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -38,11 +38,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -105,7 +100,7 @@ ISR(USART1_RX_vect)
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
{
// Setup the the USART interface for keyboard data input
@ -130,7 +125,7 @@ inline void scan_setup()
// Main Detection Loop
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
// Remove any "released keys", this is delayed due to buffer release synchronization issues
for ( uint8_t c = 0; c < KeyBufferRemoveCount; c++ )
@ -165,7 +160,7 @@ void processKeyValue( uint8_t valueType, uint8_t keyValue )
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
break;
}
@ -206,7 +201,7 @@ void removeKeyValue( uint8_t keyValue )
}
// Send data
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
// Debug
char tmpStr[6];
@ -219,7 +214,7 @@ uint8_t scan_sendData( uint8_t dataPayload )
}
// Signal KeyIndex_Buffer that it has been properly read
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
// Make sure we aren't in the middle of a receiving a new scancode
while ( KeyBufferCount != 0 );
@ -276,7 +271,7 @@ void scan_finishedWithBuffer( uint8_t sentKeys )
// Add back lost keys, so they are processed on the next USB send
for ( ; key < prevBuffer; key++ )
{
bufferAdd( KeyIndex_Buffer[key] );
Macro_bufferAdd( KeyIndex_Buffer[key] );
info_print("Re-appending lost key after USB send...");
}
@ -285,7 +280,7 @@ void scan_finishedWithBuffer( uint8_t sentKeys )
{
for ( uint8_t c = 0; c < latched; c++ )
{
bufferAdd( latchBuffer[c] );
Macro_bufferAdd( latchBuffer[c] );
}
}
@ -293,23 +288,23 @@ void scan_finishedWithBuffer( uint8_t sentKeys )
}
// Signal that the keys have been properly sent over USB
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
}
// Reset/Hold keyboard
// NOTE: Does nothing with the FACOM6684
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
}
// NOTE: Does nothing with the FACOM6684
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
}
// Reset Keyboard
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
// Not a calculated valued...
_delay_ms( 50 );

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2013 by Jacob Alexander
*
/* Copyright (C) 2013-2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,18 +49,18 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2013 for the Kiibohd Controller
# Written by Jacob Alexander in 2013,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -18,33 +18,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h facom6684.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=facom6684_ModifierMask
-DKEYINDEX_MASK=facom6684_ColemakMap
#-DKEYINDEX_MASK=facom6684_DefaultMap
)
###

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2012 by Jacob Alexander
*
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -52,11 +52,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -110,7 +105,7 @@ ISR( TIMER1_COMPA_vect )
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
{
// Setup Timer Pulse (16 bit)
@ -145,7 +140,7 @@ inline void scan_setup()
// We are looking for a start of packet
// If detected, all subsequent bits are then logged into a variable
// Once the end of the packet has been detected (always the same length), decode the pressed keys
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
// Only use as a valid signal
// Check if there was a position change
@ -181,7 +176,7 @@ inline uint8_t scan_loop()
// No duplicate keys, add it to the buffer
if ( c == KeyIndex_BufferUsed )
bufferAdd( positionCounter );
Macro_bufferAdd( positionCounter );
}
}
// Remove the key from the buffer
@ -245,34 +240,34 @@ inline uint8_t scan_loop()
}
// Send data
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
return 0;
}
// Signal KeyIndex_Buffer that it has been properly read
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
}
// Signal that the keys have been properly sent over USB
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
}
// Reset/Hold keyboard
// NOTE: Does nothing with the HP150
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
}
// NOTE: Does nothing with the HP150
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
}
// Reset Keyboard
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
info_print("Attempting to synchronize the keyboard, do not press any keys...");
errorLED( 1 );

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2012 by Jacob Alexander
*
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,18 +49,18 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -18,33 +18,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h microswitch8304.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=hp150_ModifierMask
-DKEYINDEX_MASK=hp150_ColemakMap
#-DKEYINDEX_MASK=hp150_DefaultMap
)
###

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -21,16 +21,8 @@ set( SCAN_SRCS
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
add_definitions(
-I${HEAD_DIR}/Scan/matrix
)
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=heathzenith_ModifierMask
-DKEYINDEX_MASK=heathzenith_DefaultMap
#-DKEYINDEX_MASK=heathzenith_ColemakMap
)

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2012 for the Kiibohd Controller
# Written by Jacob Alexander in 2012,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -21,16 +21,8 @@ set( SCAN_SRCS
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
add_definitions(
-I${HEAD_DIR}/Scan/matrix
)
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=ibmconv_ModifierMask
#-DKEYINDEX_MASK=ibmconv_DefaultMap
-DKEYINDEX_MASK=ibmconv_ColemakMap
)

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011-2013 by Jacob Alexander
*
/* Copyright (C) 2011-2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -39,11 +39,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -66,10 +61,10 @@ static uint8_t cmd_ACK_AA = 0x10; // Keyboard will send ack (0xAA) back to PC
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
{
// Setup the the USART interface for keyboard data input
// Setup baud rate
// 16 MHz / ( 16 * Baud ) = UBRR
// Baud <- 3.358 ms per bit, thus 1000 / 3.358 = 297.80
@ -92,7 +87,7 @@ inline void scan_setup()
// Nothing is needed here for the Kaypro, but the function is available as part of the api to be called in a polling fashion
// TODO
// - Add songs :D
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
// We *could* do extra offline processing here, but, it's not really needed for the Kaypro 1 keyboard
return 0;
@ -126,7 +121,7 @@ ISR(USART1_RX_vect)
case 0x09: // ^I
case 0x0D: // ^M
case 0x1B: // ^[
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
break;
// 0x40 Offset Keys
// Add Ctrl key and offset to the lower alphabet
@ -135,8 +130,8 @@ ISR(USART1_RX_vect)
case 0x1D: // ^]
case 0x1E: // ^^
case 0x1F: // ^_
bufferAdd( 0xF6 );
bufferAdd( keyValue + 0x40 );
Macro_bufferAdd( 0xF6 );
Macro_bufferAdd( keyValue + 0x40 );
break;
// - Add Shift key and offset to non-shifted key -
@ -145,73 +140,73 @@ ISR(USART1_RX_vect)
case 0x23: // #
case 0x24: // $
case 0x25: // %
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x10 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x10 );
break;
// 0x11 Offset Keys
case 0x26: // &
case 0x28: // (
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x11 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x11 );
break;
// 0x07 Offset Keys
case 0x29: // )
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x07 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x07 );
break;
// -0x0E Offset Keys
case 0x40: // @
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x0E );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x0E );
break;
// 0x0E Offset Keys
case 0x2A: // *
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x0E );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x0E );
break;
// 0x12 Offset Keys
case 0x2B: // +
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x12 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x12 );
break;
// 0x05 Offset Keys
case 0x22: // "
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x05 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x05 );
break;
// 0x01 Offset Keys
case 0x3A: // :
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x01 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x01 );
break;
// -0x10 Offset Keys
case 0x3C: // <
case 0x3E: // >
case 0x3F: // ?
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x10 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x10 );
break;
// -0x28 Offset Keys
case 0x5E: // ^
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x28 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x28 );
break;
// -0x32 Offset Keys
case 0x5F: // _
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x32 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x32 );
break;
// -0x20 Offset Keys
case 0x7B: // {
case 0x7C: // |
case 0x7D: // }
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x20 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x20 );
break;
// -0x1E Offset Keys
case 0x7E: // ~
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x1E );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x1E );
break;
// All other keys
default:
@ -226,8 +221,8 @@ ISR(USART1_RX_vect)
// Add Ctrl key and offset to the lower alphabet
if ( keyValue >= 0x00 && keyValue <= 0x1F )
{
bufferAdd( 0xF6 );
bufferAdd( keyValue + 0x60 );
Macro_bufferAdd( 0xF6 );
Macro_bufferAdd( keyValue + 0x60 );
}
// Shift Characters are from 0x41 to 0x59
@ -235,14 +230,14 @@ ISR(USART1_RX_vect)
// Add Shift key and offset to the lower alphabet
else if ( keyValue >= 0x41 && keyValue <= 0x5A )
{
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x20 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x20 );
}
// Everything else
else
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
}
break;
}
@ -274,35 +269,35 @@ ISR(USART1_RX_vect)
}
// Send data
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
UDR1 = dataPayload;
return 0;
}
// Signal KeyIndex_Buffer that it has been properly read
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
}
// Signal that the keys have been properly sent over USB
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
}
// Reset/Hold keyboard
// NOTE: Does nothing with the BETKB
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
}
// NOTE: Does nothing with the BETKB
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
}
// Reset Keyboard
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
}

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011-2013 by Jacob Alexander
*
/* Copyright (C) 2011-2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,18 +49,18 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -19,14 +19,6 @@ set( SCAN_SRCS
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=kaypro1_ModifierMask
#-DKEYINDEX_MASK=kaypro1_ColemakMap
-DKEYINDEX_MASK=kaypro1_DefaultMap
)
###

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2013 by Jacob Alexander
*
/* Copyright (C) 2013,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -38,11 +38,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -101,7 +96,7 @@ void uart0_status_isr(void)
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
{
// Setup the the USART interface for keyboard data input
@ -183,7 +178,7 @@ inline void scan_setup()
// Main Detection Loop
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
return 0;
}
@ -207,7 +202,7 @@ void processKeyValue( uint8_t keyValue )
case 0x09: // ^I
case 0x0D: // ^M
case 0x1B: // ^[
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
break;
// 0x40 Offset Keys
// Add Ctrl key and offset to the lower alphabet
@ -216,8 +211,8 @@ void processKeyValue( uint8_t keyValue )
case 0x1D: // ^]
case 0x1E: // ^^
case 0x1F: // ^_
bufferAdd( 0xF6 );
bufferAdd( keyValue + 0x40 );
Macro_bufferAdd( 0xF6 );
Macro_bufferAdd( keyValue + 0x40 );
break;
// - Add Shift key and offset to non-shifted key -
@ -226,73 +221,73 @@ void processKeyValue( uint8_t keyValue )
case 0x23: // #
case 0x24: // $
case 0x25: // %
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x10 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x10 );
break;
// 0x11 Offset Keys
case 0x26: // &
case 0x28: // (
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x11 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x11 );
break;
// 0x07 Offset Keys
case 0x29: // )
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x07 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x07 );
break;
// -0x0E Offset Keys
case 0x40: // @
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x0E );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x0E );
break;
// 0x0E Offset Keys
case 0x2A: // *
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x0E );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x0E );
break;
// 0x12 Offset Keys
case 0x2B: // +
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x12 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x12 );
break;
// 0x05 Offset Keys
case 0x22: // "
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x05 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x05 );
break;
// 0x01 Offset Keys
case 0x3A: // :
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x01 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x01 );
break;
// -0x10 Offset Keys
case 0x3C: // <
case 0x3E: // >
case 0x3F: // ?
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x10 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x10 );
break;
// -0x28 Offset Keys
case 0x5E: // ^
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x28 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x28 );
break;
// -0x32 Offset Keys
case 0x5F: // _
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x32 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x32 );
break;
// -0x20 Offset Keys
case 0x7B: // {
case 0x7C: // |
case 0x7D: // }
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x20 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x20 );
break;
// -0x1E Offset Keys
case 0x7E: // ~
bufferAdd( 0xF5 );
bufferAdd( keyValue - 0x1E );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue - 0x1E );
break;
// All other keys
default:
@ -307,8 +302,8 @@ void processKeyValue( uint8_t keyValue )
// Add Ctrl key and offset to the lower alphabet
if ( keyValue >= 0x00 && keyValue <= 0x1F )
{
bufferAdd( 0xF6 );
bufferAdd( keyValue + 0x60 );
Macro_bufferAdd( 0xF6 );
Macro_bufferAdd( keyValue + 0x60 );
}
// Shift Characters are from 0x41 to 0x59
@ -316,14 +311,14 @@ void processKeyValue( uint8_t keyValue )
// Add Shift key and offset to the lower alphabet
else if ( keyValue >= 0x41 && keyValue <= 0x5A )
{
bufferAdd( 0xF5 );
bufferAdd( keyValue + 0x20 );
Macro_bufferAdd( 0xF5 );
Macro_bufferAdd( keyValue + 0x20 );
}
// Everything else
else
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
}
break;
}
@ -331,7 +326,7 @@ void processKeyValue( uint8_t keyValue )
// Send data
// NOTE: Example only, MBC-55X cannot receive user data
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
// Debug
char tmpStr[6];
@ -348,12 +343,12 @@ uint8_t scan_sendData( uint8_t dataPayload )
}
// Signal KeyIndex_Buffer that it has been properly read
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
}
// Signal that the keys have been properly sent over USB
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
cli(); // Disable Interrupts
@ -365,17 +360,17 @@ void scan_finishedWithUSBBuffer( uint8_t sentKeys )
// Reset/Hold keyboard
// NOTE: Does nothing with the MBC-55x
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
}
// NOTE: Does nothing with the MBC-55x
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
}
// Reset Keyboard
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
// Not a calculated valued...
_delay_ms( 50 );

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2013 by Jacob Alexander
*
/* Copyright (C) 2013,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,18 +49,18 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2013 for the Kiibohd Controller
# Written by Jacob Alexander in 2013,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -18,33 +18,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h facom6684.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=mbc55x_ModifierMask
#-DKEYINDEX_MASK=mbc55x_ColemakMap
-DKEYINDEX_MASK=mbc55x_DefaultMap
)
###

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011 by Jacob Alexander
*
/* Copyright (C) 2011,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -43,11 +43,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
#define UNSET_RESET() RESET_DDR &= ~(1 << RESET_PIN)
#define SET_RESET() RESET_DDR |= (1 << RESET_PIN)
@ -68,11 +63,11 @@ volatile uint8_t BufferReadyToClear;
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
{
// Setup the the USART interface for keyboard data input
// NOTE: The input data signal needs to be inverted for the Teensy USART to properly work
// Setup baud rate
// 16 MHz / ( 16 * Baud ) = UBRR
// Baud <- 0.82020 ms per bit, thus 1000 / 0.82020 = 1219.2
@ -101,7 +96,7 @@ inline void scan_setup()
// Main Detection Loop
// Not needed for the Micro Switch 8304, this is just a busy loop
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
return 0;
}
@ -132,7 +127,7 @@ void processKeyValue( uint8_t keyValue )
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
break;
}
@ -194,7 +189,7 @@ ISR(USART1_RX_vect)
// 0x9E sets echo scancode mode from (0x81 to 0xFF; translates to 0x01 to 0x7F)
// Other echos: 0x15~0x19 send 0x15~0x19, 0x40 sends 0x40 (as well as 0x44,0x45, 0x80)
// 0x8C Acks the keyboard and gets 0x70 sent back (delayed)
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
UDR1 = dataPayload;
return 0;
@ -202,7 +197,7 @@ uint8_t scan_sendData( uint8_t dataPayload )
// Signal KeyIndex_Buffer that it has been properly read
// In the case of the Micro Switch 8304, we leave the buffer alone until more scancode data comes in
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
// We received a Clear code from the 8304, clear the buffer now that we've used it
if ( BufferReadyToClear )
@ -213,25 +208,25 @@ void scan_finishedWithBuffer( uint8_t sentKeys )
}
// Signal that the keys have been properly sent over USB
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
}
// Reset/Hold keyboard
// Warning! This will cause the keyboard to not send any data, so you can't disable with a keypress
// The Micro Switch 8304 has a dedicated reset line
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
UNSET_RESET();
}
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
SET_RESET();
}
// Reset Keyboard
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
// Reset command for the 8304
scan_sendData( 0x92 );

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011 by Jacob Alexander
*
/* Copyright (C) 2011,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,18 +49,18 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -18,33 +18,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h microswitch8304.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=microswitch8304_ModifierMask
-DKEYINDEX_MASK=microswitch8304_ColemakMap
#-DKEYINDEX_MASK=microswitch8304_DefaultMap
)
###

119
Scan/SKM67001/customSKM.h Normal file
View file

@ -0,0 +1,119 @@
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef __KEYMAP_H
#define __KEYMAP_H
// ----- Variables -----
// Default 1-indexed key mappings
static uint8_t DefaultMap_Lookup[] = {
0, // 0x00
KEY_1, // 0x01
KEY_Q, // 0x02
KEY_A, // 0x03
KEY_2, // 0x04
KEY_Z, // 0x05
KEY_W, // 0x06
KEY_S, // 0x07
KEY_3, // 0x08
KEY_X, // 0x09
KEY_E, // 0x0A
KEY_D, // 0x0B
KEY_4, // 0x0C
KEY_C, // 0x0D
KEY_R, // 0x0E
KEY_F, // 0x0F
KEY_5, // 0x10
KEY_V, // 0x11
KEY_T, // 0x12
KEY_G, // 0x13
KEY_6, // 0x14
KEY_B, // 0x15
KEY_Y, // 0x16
KEY_H, // 0x17
KEY_7, // 0x18
KEY_N, // 0x19
KEY_U, // 0x1A
KEY_J, // 0x1B
KEY_8, // 0x1C
KEY_M, // 0x1D
KEY_I, // 0x1E
KEY_K, // 0x1F
KEY_9, // 0x20
KEY_COMMA, // 0x21
KEY_O, // 0x22
KEY_L, // 0x23
KEY_0, // 0x24
KEY_PERIOD, // 0x25
KEY_P, // 0x26
KEY_SEMICOLON, // 0x27
KEY_MINUS, // 0x28
KEY_SLASH, // 0x29
KEY_LEFT_BRACE, // 0x2A (1/4)
KEY_QUOTE, // 0x2B
KEY_EQUAL, // 0x2C
KEY_RIGHT_BRACE, // 0x2D
0, // 0x2E
0, // 0x2F
KEY_TILDE, // 0x30
KEY_TAB, // 0x31
0, // 0x32
0, // 0x33
KEY_SHIFT, // 0x34
KEY_ENTER, // 0x35
KEY_BACKSPACE, // 0x36
KEY_DELETE, // 0x37
KEY_CTRL, // 0x38 (MAR LEFT)
KEY_SPACE, // 0x39
KEY_ALT, // 0x3A (EXPRESS / MAR RIGHT)
0, // 0x3B
0, // 0x3C
KEY_ESC, // 0x3D (MAR REL)
0, // 0x3E (STORE)
0, // 0x3F (RECALL)
KEY_GUI, // 0x40 (CODE)
0, // 0x41
0, // 0x42
0, // 0x43
0, // 0x44
0, // 0x45
0, // 0x46
0, // 0x47
0, // 0x48 (DEC TAB)
0, // 0x49 (SET TAB)
0, // 0x4A (TAB CLEAR)
0, // 0x4B (INDEX)
0, // 0x4C (RELOC)
0, // 0x4D
0, // 0x4E
0, // 0x4F
0, // 0x50 (REV INDEX)
0, // 0x51
0, // 0x52
0, // 0x53
0, // 0x54
0, // 0x55
};
#endif

121
Scan/SKM67001/defaultMap.h Normal file
View file

@ -0,0 +1,121 @@
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef __KEYMAP_H
#define __KEYMAP_H
// This file contains various key layouts for the SKM 67001 Keyboard from the Olympia Professional ES 105 Typewriter
// ----- Variables -----
// Default 1-indexed key mappings
static uint8_t DefaultMap_Lookup[] = {
0, // 0x00
KEY_1, // 0x01
KEY_Q, // 0x02
KEY_A, // 0x03
KEY_2, // 0x04
KEY_Z, // 0x05
KEY_W, // 0x06
KEY_S, // 0x07
KEY_3, // 0x08
KEY_X, // 0x09
KEY_E, // 0x0A
KEY_D, // 0x0B
KEY_4, // 0x0C
KEY_C, // 0x0D
KEY_R, // 0x0E
KEY_F, // 0x0F
KEY_5, // 0x10
KEY_V, // 0x11
KEY_T, // 0x12
KEY_G, // 0x13
KEY_6, // 0x14
KEY_B, // 0x15
KEY_Y, // 0x16
KEY_H, // 0x17
KEY_7, // 0x18
KEY_N, // 0x19
KEY_U, // 0x1A
KEY_J, // 0x1B
KEY_8, // 0x1C
KEY_M, // 0x1D
KEY_I, // 0x1E
KEY_K, // 0x1F
KEY_9, // 0x20
KEY_COMMA, // 0x21
KEY_O, // 0x22
KEY_L, // 0x23
KEY_0, // 0x24
KEY_PERIOD, // 0x25
KEY_P, // 0x26
KEY_SEMICOLON, // 0x27
KEY_MINUS, // 0x28
KEY_SLASH, // 0x29
KEY_LEFT_BRACE, // 0x2A (1/4)
KEY_QUOTE, // 0x2B
KEY_EQUAL, // 0x2C
KEY_RIGHT_BRACE, // 0x2D
0, // 0x2E
0, // 0x2F
KEY_TILDE, // 0x30
KEY_TAB, // 0x31
0, // 0x32
0, // 0x33
KEY_SHIFT, // 0x34
KEY_ENTER, // 0x35
KEY_BACKSPACE, // 0x36
KEY_DELETE, // 0x37
KEY_CTRL, // 0x38 (MAR LEFT)
KEY_SPACE, // 0x39
KEY_ALT, // 0x3A (EXPRESS / MAR RIGHT)
0, // 0x3B
0, // 0x3C
KEY_ESC, // 0x3D (MAR REL)
0, // 0x3E (STORE)
0, // 0x3F (RECALL)
KEY_GUI, // 0x40 (CODE)
0, // 0x41
0, // 0x42
0, // 0x43
0, // 0x44
0, // 0x45
0, // 0x46
0, // 0x47
0, // 0x48 (DEC TAB)
0, // 0x49 (SET TAB)
0, // 0x4A (TAB CLEAR)
0, // 0x4B (INDEX)
0, // 0x4C (RELOC)
0, // 0x4D
0, // 0x4E
0, // 0x4F
0, // 0x50 (REV INDEX)
0, // 0x51
0, // 0x52
0, // 0x53
0, // 0x54
0, // 0x55
};
#endif

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2012 for the Kiibohd Controller
# Written by Jacob Alexander in 2012,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -21,18 +21,10 @@ set( SCAN_SRCS
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
add_definitions(
-I${HEAD_DIR}/Scan/matrix
)
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=skm67001_ModifierMask
#-DKEYINDEX_MASK=skm67001_DefaultMap
-DKEYINDEX_MASK=skm67001_ColemakMap
)
###
# Compiler Family Compatibility

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011 by Jacob Alexander
*
/* Copyright (C) 2011,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -48,11 +48,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -66,10 +61,10 @@ volatile uint8_t KeyIndex_BufferUsed;
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
{
// Setup the the USART interface for keyboard data input
// Setup baud rate
// 16 MHz / ( 16 * Baud ) = UBRR
// Baud <- 0.10450 ms per bit, thus 1000 / 0.10450 = 9569.4
@ -105,7 +100,7 @@ inline void scan_setup()
// Main Detection Loop
// Not needed for the Sony NEWS, this is just a busy loop
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
return 0;
}
@ -158,7 +153,7 @@ void processKeyValue( uint8_t keyValue )
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
break;
}
@ -193,7 +188,7 @@ ISR(USART1_RX_vect)
}
// Send data to keyboard
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
// Debug
char tmpStr[6];
@ -206,29 +201,29 @@ uint8_t scan_sendData( uint8_t dataPayload )
// Signal KeyIndex_Buffer that it has been properly read
// Not needed as a signal is sent to remove key-presses
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
return;
}
// Reset/Hold keyboard TODO
// Warning! This will cause the keyboard to not send any data, so you can't disable with a keypress
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
}
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
}
// Reset Keyboard
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
// Empty buffer, now that keyboard has been reset
KeyIndex_BufferUsed = 0;
}
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
return;
}

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011 by Jacob Alexander
*
/* Copyright (C) 2011,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -48,18 +48,18 @@ extern volatile uint8_t KeyIndex_BufferUsed;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -18,33 +18,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h sonynews.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=sonynews_ModifierMask
#-DKEYINDEX_MASK=sonynews_ColemakMap
-DKEYINDEX_MASK=sonynews_DefaultMap
)
###

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2012 by Jacob Alexander
*
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -130,11 +130,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -158,7 +153,7 @@ void processKeyValue( uint8_t keyValue );
// Setup
inline void scan_setup()
inline void Scan_setup()
{
// Setup the external interrupts for
// - General keypresses (INT6/E6) -> rising edge (to detect key release)
@ -221,7 +216,7 @@ inline void scan_setup()
// Not needed for the Sony OA-S3400 as signals are interrupt based, thus this is a busy loop
// XXX Function is used for scanning troublesome keys, technically this is not needed for a pure converter
// I just want proper use of the shift and shift lock keys, without having to do major rework to attach to the entire matrix
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
// Loop through known keys
for ( uint8_t key = 0; key < MANUAL_SCAN_KEYS; key++ ) switch ( key )
@ -437,7 +432,7 @@ void processKeyValue( uint8_t keyValue )
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( keyValue );
Macro_bufferAdd( keyValue );
break;
}
@ -498,7 +493,7 @@ ISR(INT7_vect)
// Send data to keyboard
// Sony OA-S3400 has no serial/parallel dataport to send data too...
// Using this function for LED enable/disable
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
switch ( dataPayload )
{
@ -517,23 +512,23 @@ uint8_t scan_sendData( uint8_t dataPayload )
// Signal KeyIndex_Buffer that it has been properly read
// Not needed as a signal is sent to remove key-presses
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
return;
}
// Reset/Hold keyboard
// Sony OA-S3400 has no locking signals
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
}
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
}
// Reset Keyboard
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
// Empty buffer, now that keyboard has been reset
KeyIndex_BufferUsed = 0;
@ -549,7 +544,7 @@ void scan_resetKeyboard( void )
// USB module is finished with buffer
// Not needed as a signal is sent to remove key-presses
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
return;
}

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2012 by Jacob Alexander
*
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,18 +49,18 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2012 for the Kiibohd Controller
# Written by Jacob Alexander in 2012,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -18,32 +18,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=sonyoas3400_ModifierMask
-DKEYINDEX_MASK=sonyoas3400_ColemakMap
#-DKEYINDEX_MASK=sonyoas3400_DefaultMap
)
###

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011 by Jacob Alexander
*
/* Copyright (C) 2011,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -60,9 +60,6 @@
#define UNSET_INTR() INTR_DDR &= ~(1 << INTR_PIN)
#define SET_INTR() INTR_DDR |= (1 << INTR_PIN)
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -81,10 +78,10 @@ uint8_t packet_index = 0;
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
{
// Initially reset the keyboard (just in case we are in a wierd state)
scan_resetKeyboard();
Scan_resetKeyboard();
// Setup SPI for data input using the clock and data inputs
// TODO
@ -108,7 +105,7 @@ inline void scan_setup()
// Main Detection Loop
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
/*
// Packet Read
@ -223,37 +220,37 @@ inline uint8_t scan_loop()
// Send data
// XXX Not used with the Tandy1000
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
return 0;
}
// Signal KeyIndex_Buffer that it has been properly read
// TODO
void scan_finishedWithBuffer( uint8_t sentKeys )
void Scan_finishedWithBuffer( uint8_t sentKeys )
{
}
// Signal that the keys have been properly sent over USB
void scan_finishedWithUSBBuffer( uint8_t sentKeys )
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
}
// Reset/Hold keyboard
// Warning! This will cause the keyboard to not send any data, so you can't disable with a keypress
// The Tandy 1000 keyboard has a dedicated hold/processor interrupt line
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
UNSET_INTR();
}
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
SET_INTR();
}
// Reset Keyboard
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
// TODO Tandy1000 has a dedicated reset line
}

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2011 by Jacob Alexander
*
/* Copyright (C) 2011,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,18 +49,18 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -19,14 +19,6 @@ set( SCAN_SRCS
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=tandy1000_ModifierMask
-DKEYINDEX_MASK=tandy1000_ColemakMap
#-DKEYINDEX_MASK=tandy1000_DefaultMap
)
###

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2012 by Jacob Alexander
*
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -56,11 +56,6 @@
#define REQUEST_DATA() REQUEST_DDR &= ~(1 << REQUEST_PIN) // Start incoming keyboard transfer
#define STOP_DATA() REQUEST_DDR |= (1 << REQUEST_PIN) // Stop incoming keyboard data
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -90,7 +85,7 @@ void processPacketValue( uint16_t packetValue );
// To be nice, we wait a little bit after powering on, and dump any of the pending keyboard data.
// Afterwards (as long as no keys were being held), the keyboard should have a clean buffer, and be ready to go.
// (Even if keys were held down, everything should probably still work...)
inline void scan_setup()
inline void Scan_setup()
{
// Setup the DATA pin
DATA_DDR &= ~(1 << DATA_PIN); // Set to input
@ -109,7 +104,7 @@ inline void scan_setup()
// Reset the keyboard before scanning, we might be in a wierd state
_delay_ms( 50 );
//scan_resetKeyboard();
//Scan_resetKeyboard();
// Message
info_print("Keyboard Buffer Flushed");
@ -119,9 +114,9 @@ inline void scan_setup()
// Main Detection Loop
// The Univac-Sperry F3W9 has a convenient feature, an internal 8 key buffer
// This buffer is only emptied (i.e. sent over the bus) when the REQUEST line is held high
// Because of this, we can utilize the scan_loop to do all of the critical processing,
// Because of this, we can utilize the Scan_loop to do all of the critical processing,
// without having to resort to interrupts, giving the data reading 100% of the CPU.
// This is because the USB interrupts can wait until the scan_loop is finished to continue.
// This is because the USB interrupts can wait until the Scan_loop is finished to continue.
//
// Normally, this approach isn't taken, as it's easier/faster/safer to use Teensy hardware shift registers
// for serial data transfers.
@ -133,7 +128,7 @@ inline void scan_setup()
// Output and /Output (NOT'ted version).
// Not really useful here, but could be used for error checking, or eliminating an external NOT gate if
// we were using (but can't...) a hardware decoder like a USART.
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
return 0;
// Protocol Notes:
@ -308,27 +303,27 @@ void processPacketValue( uint16_t packetValue )
switch ( scanCode )
{
default:
//bufferAdd( scanCode ); TODO - Uncomment when ready for USB output
//Macro_bufferAdd( scanCode ); TODO - Uncomment when ready for USB output
break;
}
}
// Send data
// NOTE: Does nothing with the Univac-Sperry F3W9
uint8_t scan_sendData( uint8_t dataPayload )
uint8_t Scan_sendData( uint8_t dataPayload )
{
return 0;
}
// Signal KeyIndex_Buffer that it has been properly read
inline void scan_finishedWithBuffer( uint8_t sentKeys )
inline void Scan_finishedWithBuffer( uint8_t sentKeys )
{
return;
}
// Signal that the keys have been properly sent over USB
// TODO
inline void scan_finishedWithUSBBuffer( uint8_t sentKeys )
inline void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
/*
uint8_t foundModifiers = 0;
@ -352,12 +347,12 @@ inline void scan_finishedWithUSBBuffer( uint8_t sentKeys )
// Reset/Hold keyboard
// NOTE: Does nothing with the Univac-Sperry F3W9
void scan_lockKeyboard( void )
void Scan_lockKeyboard( void )
{
}
// NOTE: Does nothing with the Univac-Sperry F3W9
void scan_unlockKeyboard( void )
void Scan_unlockKeyboard( void )
{
}
@ -365,7 +360,7 @@ void scan_unlockKeyboard( void )
// - Holds the input read line high to flush the buffer
// - This does not actually reset the keyboard, but always seems brings it to a sane state
// - Won't work fully if keys are being pressed done at the same time
void scan_resetKeyboard( void )
void Scan_resetKeyboard( void )
{
// Initiate data request line, but don't read the incoming data
REQUEST_DATA();

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2012 by Jacob Alexander
*
/* Copyright (C) 2012,2014 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -48,18 +48,18 @@ extern volatile uint8_t KeyIndex_BufferUsed;
// ----- Functions -----
// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
uint8_t Scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
void Scan_lockKeyboard( void );
void Scan_unlockKeyboard( void );
void Scan_resetKeyboard( void );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2012 for the Kiibohd Controller
# Written by Jacob Alexander in 2012,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -16,33 +16,9 @@ set( SCAN_SRCS
)
###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)
###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h epsonqx10.h )
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=univacf3w9_ModifierMask
-DKEYINDEX_MASK=univacf3w9_ColemakMap
#-DKEYINDEX_MASK=univacf3w9_DefaultMap
)
###

View file

@ -26,6 +26,7 @@
// Project Includes
#include <led.h>
#include <macro.h>
#include <print.h>
// Local Includes
@ -47,11 +48,6 @@
// ----- Macros -----
// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte
// ----- Variables -----
@ -63,7 +59,7 @@ volatile uint8_t KeyIndex_Add_InputSignal; // Used to pass the (click/input valu
// Keeps track of the number of scans, so we only do a debounce assess when it would be valid (as it throws away data)
uint8_t scan_count = 0;
uint8_t Scan_count = 0;
// This is where the matrix scan data is held, as well as debouncing is evaluated to, which (depending on the read value) is handled
// by the macro module
@ -74,24 +70,24 @@ uint8_t KeyIndex_Array[KEYBOARD_KEYS + 1];
// ----- Functions -----
// Setup
inline void scan_setup()
inline void Scan_setup()
{
matrix_pinSetup( (uint8_t*)matrix_pinout, scanMode );
}
// Main Detection Loop
inline uint8_t scan_loop()
inline uint8_t Scan_loop()
{
// Check count to see if the sample threshold may have been reached, otherwise collect more data
if ( scan_count < MAX_SAMPLES )
if ( Scan_count < MAX_SAMPLES )
{
matrix_scan( (uint8_t*)matrix_pinout, KeyIndex_Array );
// scanDual requires 2 passes, and thus needs more memory per matrix_scan pass
#if scanMode == scanDual
scan_count += 2;
Scan_count += 2;
#else
scan_count++;
Scan_count++;
#endif
// Signal Main Detection Loop to continue scanning
@ -99,7 +95,7 @@ inline uint8_t scan_loop()
}
// Reset Sample Counter
scan_count = 0;
Scan_count = 0;
// Assess debouncing sample table
// Loop over all of the sampled keys of the given array
@ -108,9 +104,8 @@ inline uint8_t scan_loop()
for ( uint8_t key = 1; key < KeyIndex_Size + 1; key++ ) if ( ( KeyIndex_Array[key] & ~(1 << 7) ) > SAMPLE_THRESHOLD )
{
// Debug output (keypress detected)
char tmpStr[6];
hexToStr( key, tmpStr );
dPrintStrs( tmpStr, " " );
printHex( key );
print(" ");
// Add the key to the buffer, if it isn't already in the current Key Buffer
for ( uint8_t c = 0; c < KeyIndex_BufferUsed + 1; c++ )
@ -118,7 +113,7 @@ inline uint8_t scan_loop()
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( key );
Macro_bufferAdd( key );
break;
}
@ -160,23 +155,16 @@ inline uint8_t scan_loop()
}
// Signal that the keys have been properly sent over USB
inline void scan_finishedWithUSBBuffer( uint8_t sentKeys )
// Signal that the USB keycodes have been properly sent through the Output Module
inline void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
{
return;
}
// Signal KeyIndex_Buffer that it has been fully scanned using the macro module
inline void scan_finishedWithBuffer( uint8_t sentKeys )
// Signal KeyIndex_Buffer that it has been fully processed using the macro module
inline void Scan_finishedWithBuffer( uint8_t sentKeys )
{
return;
}
// Send data to keyboard
// Not used in this module
uint8_t scan_sendData( uint8_t dataPayload )
{
return 0;
}

View file

@ -56,18 +56,12 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
// ----- Functions -----
void scan_setup( void );
uint8_t scan_loop( void );
void Scan_setup( void );
uint8_t Scan_loop( void );
// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );
void scan_finishedWithBuffer( uint8_t sentKeys );
void scan_finishedWithUSBBuffer( uint8_t sentKeys );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );
// Callbacks from the Macro and Output modules (useful with difficult protocols)
void Scan_finishedWithBuffer( uint8_t sentKeys );
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
#endif // __SCAN_LOOP_H

View file

@ -1,6 +1,6 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
#
# Released into the Public Domain
#
@ -27,12 +27,6 @@ set( SCAN_SRCS
###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
add_definitions(
#-DMODIFIER_MASK=
#-DKEYINDEX_MASK=
)
###