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

@ -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
)
###