Moving defaultMap.kll to scancode_map.kll (less confusing)
- Changing default name from defaultMap.kll to scancode_map.kll - Old name of defaultMap.kll will still work (and is the final fallback) - Updated all the main projects to use the new name - Updated BETKB (not entirely finished, but mostly complete) - Added sub-use of interconnect scancode cache for converters - Added infinity_led.bash No behaviour changes, just restructuring.
This commit is contained in:
parent
ed19e92ead
commit
a07ccdd608
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This is a build script template
|
# This is a build script template
|
||||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
||||||
# Jacob Alexander 2015
|
# Jacob Alexander 2015-2016
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ BuildPath="ICED-L"
|
|||||||
## KLL Configuration ##
|
## KLL Configuration ##
|
||||||
|
|
||||||
# Generally shouldn't be changed, this will affect every layer
|
# Generally shouldn't be changed, this will affect every layer
|
||||||
BaseMap="defaultMap leftHand slave1 rightHand"
|
BaseMap="scancode_map leftHand slave1 rightHand"
|
||||||
|
|
||||||
# This is the default layer of the keyboard
|
# This is the default layer of the keyboard
|
||||||
# NOTE: To combine kll files into a single layout, separate them by spaces
|
# NOTE: To combine kll files into a single layout, separate them by spaces
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This is a build script template
|
# This is a build script template
|
||||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
||||||
# Jacob Alexander 2015
|
# Jacob Alexander 2015-2016
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ BuildPath="IC60"
|
|||||||
## KLL Configuration ##
|
## KLL Configuration ##
|
||||||
|
|
||||||
# Generally shouldn't be changed, this will affect every layer
|
# Generally shouldn't be changed, this will affect every layer
|
||||||
BaseMap="defaultMap"
|
BaseMap="scancode_map"
|
||||||
|
|
||||||
# This is the default layer of the keyboard
|
# This is the default layer of the keyboard
|
||||||
# NOTE: To combine kll files into a single layout, separate them by spaces
|
# NOTE: To combine kll files into a single layout, separate them by spaces
|
||||||
|
72
Keyboards/infinity_led.bash
Executable file
72
Keyboards/infinity_led.bash
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# This is a build script template
|
||||||
|
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
||||||
|
# Jacob Alexander 2016
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#################
|
||||||
|
# Configuration #
|
||||||
|
#################
|
||||||
|
|
||||||
|
# Feel free to change the variables in this section to configure your keyboard
|
||||||
|
|
||||||
|
BuildPath="IC60"
|
||||||
|
|
||||||
|
## KLL Configuration ##
|
||||||
|
|
||||||
|
# Generally shouldn't be changed, this will affect every layer
|
||||||
|
BaseMap="scancode_map"
|
||||||
|
|
||||||
|
# This is the default layer of the keyboard
|
||||||
|
# NOTE: To combine kll files into a single layout, separate them by spaces
|
||||||
|
# e.g. DefaultMap="mylayout mylayoutmod"
|
||||||
|
DefaultMap="md1Overlay stdFuncMap"
|
||||||
|
|
||||||
|
# This is where you set the additional layers
|
||||||
|
# NOTE: Indexing starts at 1
|
||||||
|
# NOTE: Each new layer is another array entry
|
||||||
|
# e.g. PartialMaps[1]="layer1 layer1mod"
|
||||||
|
# PartialMaps[2]="layer2"
|
||||||
|
# PartialMaps[3]="layer3"
|
||||||
|
PartialMaps[1]="hhkbpro2"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# Advanced Configuration #
|
||||||
|
##########################
|
||||||
|
|
||||||
|
# Don't change the variables in this section unless you know what you're doing
|
||||||
|
# These are useful for completely custom keyboards
|
||||||
|
# NOTE: Changing any of these variables will require a force build to compile correctly
|
||||||
|
|
||||||
|
# Keyboard Module Configuration
|
||||||
|
ScanModule="MD1.1"
|
||||||
|
MacroModule="PartialMap"
|
||||||
|
OutputModule="pjrcUSB"
|
||||||
|
DebugModule="full"
|
||||||
|
|
||||||
|
# Microcontroller
|
||||||
|
Chip="mk20dx128vlf5"
|
||||||
|
|
||||||
|
# Compiler Selection
|
||||||
|
Compiler="gcc"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
########################
|
||||||
|
# Bash Library Include #
|
||||||
|
########################
|
||||||
|
|
||||||
|
# Shouldn't need to touch this section
|
||||||
|
|
||||||
|
# Check if the library can be found
|
||||||
|
if [ ! -f cmake.bash ]; then
|
||||||
|
echo "ERROR: Cannot find 'cmake.bash'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load the library
|
||||||
|
source cmake.bash
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This is a build script template
|
# This is a build script template
|
||||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
||||||
# Jacob Alexander 2015
|
# Jacob Alexander 2015-2016
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ BuildPath="template"
|
|||||||
## KLL Configuration ##
|
## KLL Configuration ##
|
||||||
|
|
||||||
# Generally shouldn't be changed, this will affect every layer
|
# Generally shouldn't be changed, this will affect every layer
|
||||||
BaseMap="defaultMap"
|
BaseMap="scancode_map"
|
||||||
|
|
||||||
# This is the default layer of the keyboard
|
# This is the default layer of the keyboard
|
||||||
# NOTE: To combine kll files into a single layout, separate them by spaces
|
# NOTE: To combine kll files into a single layout, separate them by spaces
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This is a build script template
|
# This is a build script template
|
||||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
|
||||||
# Jacob Alexander 2015
|
# Jacob Alexander 2015-2016
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ BuildPath="WhiteFox"
|
|||||||
## KLL Configuration ##
|
## KLL Configuration ##
|
||||||
|
|
||||||
# Generally shouldn't be changed, this will affect every layer
|
# Generally shouldn't be changed, this will affect every layer
|
||||||
BaseMap="defaultMap"
|
BaseMap="scancode_map"
|
||||||
|
|
||||||
# This is the default layer of the keyboard
|
# This is the default layer of the keyboard
|
||||||
# NOTE: To combine kll files into a single layout, separate them by spaces
|
# NOTE: To combine kll files into a single layout, separate them by spaces
|
||||||
|
@ -57,10 +57,15 @@ set ( pathname "${PROJECT_SOURCE_DIR}/${ScanModulePath}" )
|
|||||||
|
|
||||||
string ( REPLACE " " ";" MAP_LIST ${BaseMap} ) # Change spaces to semicolons
|
string ( REPLACE " " ";" MAP_LIST ${BaseMap} ) # Change spaces to semicolons
|
||||||
foreach ( MAP ${MAP_LIST} )
|
foreach ( MAP ${MAP_LIST} )
|
||||||
# Only check the Scan Module for BaseMap .kll files, default to defaultMap.kll
|
# Only check the Scan Module for BaseMap .kll files, default to scancode_map.kll or defaultMap.kll
|
||||||
if ( NOT EXISTS ${pathname}/${MAP}.kll )
|
if ( NOT EXISTS ${pathname}/${MAP}.kll )
|
||||||
|
if ( EXISTS ${pathname}/scancode_map.kll )
|
||||||
|
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/scancode_map.kll )
|
||||||
|
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/scancode_map.kll )
|
||||||
|
else ()
|
||||||
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/defaultMap.kll )
|
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/defaultMap.kll )
|
||||||
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/defaultMap.kll )
|
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/defaultMap.kll )
|
||||||
|
endif ()
|
||||||
elseif ( EXISTS "${pathname}/${MAP}.kll" )
|
elseif ( EXISTS "${pathname}/${MAP}.kll" )
|
||||||
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/${MAP}.kll )
|
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/${MAP}.kll )
|
||||||
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/${MAP}.kll )
|
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/${MAP}.kll )
|
||||||
|
@ -125,7 +125,7 @@ extern index_uint_t macroTriggerMacroPendingList[];
|
|||||||
extern index_uint_t macroTriggerMacroPendingListSize;
|
extern index_uint_t macroTriggerMacroPendingListSize;
|
||||||
|
|
||||||
// Interconnect ScanCode Cache
|
// Interconnect ScanCode Cache
|
||||||
#if defined(ConnectEnabled_define)
|
#if defined(ConnectEnabled_define) || defined(PressReleaseCache_define)
|
||||||
// TODO This can be shrunk by the size of the max node 0 ScanCode
|
// TODO This can be shrunk by the size of the max node 0 ScanCode
|
||||||
TriggerGuide macroInterconnectCache[ MaxScanCode ];
|
TriggerGuide macroInterconnectCache[ MaxScanCode ];
|
||||||
uint8_t macroInterconnectCacheSize = 0;
|
uint8_t macroInterconnectCacheSize = 0;
|
||||||
@ -473,8 +473,8 @@ nat_ptr_t *Macro_layerLookup( TriggerGuide *guide, uint8_t latch_expire )
|
|||||||
|
|
||||||
// Add an interconnect ScanCode
|
// Add an interconnect ScanCode
|
||||||
// These are handled differently (less information is sent, hold/off states must be assumed)
|
// These are handled differently (less information is sent, hold/off states must be assumed)
|
||||||
#if defined(ConnectEnabled_define)
|
#if defined(ConnectEnabled_define) || defined(PressReleaseCache_define)
|
||||||
inline void Macro_interconnectAdd( void *trigger_ptr )
|
void Macro_pressReleaseAdd( void *trigger_ptr )
|
||||||
{
|
{
|
||||||
TriggerGuide *trigger = (TriggerGuide*)trigger_ptr;
|
TriggerGuide *trigger = (TriggerGuide*)trigger_ptr;
|
||||||
|
|
||||||
@ -703,9 +703,11 @@ inline void Macro_process()
|
|||||||
if ( USBKeys_Sent != 0 )
|
if ( USBKeys_Sent != 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if defined(ConnectEnabled_define) || defined(PressReleaseCache_define)
|
||||||
#if defined(ConnectEnabled_define)
|
#if defined(ConnectEnabled_define)
|
||||||
// Check if there are any ScanCodes in the interconnect cache to process
|
// Check if there are any ScanCodes in the interconnect cache to process
|
||||||
if ( Connect_master && macroInterconnectCacheSize > 0 )
|
if ( Connect_master && macroInterconnectCacheSize > 0 )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// Iterate over all the cache ScanCodes
|
// Iterate over all the cache ScanCodes
|
||||||
uint8_t currentInterconnectCacheSize = macroInterconnectCacheSize;
|
uint8_t currentInterconnectCacheSize = macroInterconnectCacheSize;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
void Macro_analogState( uint8_t scanCode, uint8_t state );
|
void Macro_analogState( uint8_t scanCode, uint8_t state );
|
||||||
void Macro_keyState( uint8_t scanCode, uint8_t state );
|
void Macro_keyState( uint8_t scanCode, uint8_t state );
|
||||||
void Macro_ledState( uint8_t ledCode, uint8_t state );
|
void Macro_ledState( uint8_t ledCode, uint8_t state );
|
||||||
void Macro_interconnectAdd( void *trigger ); // triggers is of type TriggerGuide, void* for circular dependencies
|
void Macro_pressReleaseAdd( void *trigger ); // triggers is of type TriggerGuide, void* for circular dependencies
|
||||||
void Macro_process();
|
void Macro_process();
|
||||||
void Macro_setup();
|
void Macro_setup();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2012,2014 by Jacob Alexander
|
/* Copyright (C) 2012,2014,2016 by Jacob Alexander
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -25,7 +25,10 @@
|
|||||||
#include <Lib/ScanLib.h>
|
#include <Lib/ScanLib.h>
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
|
#include <kll.h>
|
||||||
|
#include <kll_defs.h>
|
||||||
#include <led.h>
|
#include <led.h>
|
||||||
|
#include <macro.h>
|
||||||
#include <print.h>
|
#include <print.h>
|
||||||
|
|
||||||
// Local Includes
|
// Local Includes
|
||||||
@ -45,6 +48,19 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ----- Enums -----
|
||||||
|
|
||||||
|
// Keypress States
|
||||||
|
typedef enum KeyPosition {
|
||||||
|
KeyState_Off = 0,
|
||||||
|
KeyState_Press = 1,
|
||||||
|
KeyState_Hold = 2,
|
||||||
|
KeyState_Release = 3,
|
||||||
|
KeyState_Invalid,
|
||||||
|
} KeyPosition;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----- Variables -----
|
// ----- Variables -----
|
||||||
|
|
||||||
// Buffer used to inform the macro processing module which keys have been detected as pressed
|
// Buffer used to inform the macro processing module which keys have been detected as pressed
|
||||||
@ -68,18 +84,31 @@ void removeKeyValue( uint8_t keyValue );
|
|||||||
// ----- Interrupt Functions -----
|
// ----- Interrupt Functions -----
|
||||||
|
|
||||||
// USART Receive Buffer Full Interrupt
|
// USART Receive Buffer Full Interrupt
|
||||||
|
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
|
||||||
ISR(USART1_RX_vect)
|
ISR(USART1_RX_vect)
|
||||||
|
#elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM
|
||||||
|
void uart0_status_isr()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
cli(); // Disable Interrupts
|
cli(); // Disable Interrupts
|
||||||
|
|
||||||
uint8_t keyValue = 0x00;
|
uint8_t keyValue = 0x00;
|
||||||
uint8_t keyState = 0x00;
|
uint8_t keyState = 0x00;
|
||||||
|
|
||||||
|
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
|
||||||
// Read the scancode packet from the USART (1st to 8th bits)
|
// Read the scancode packet from the USART (1st to 8th bits)
|
||||||
keyValue = UDR1;
|
keyValue = UDR1;
|
||||||
|
|
||||||
// Read the release/press bit (9th bit) XXX Unnecessary, and wrong it seems, parity bit? or something else?
|
// Read the release/press bit (9th bit) XXX Unnecessary, and wrong it seems, parity bit? or something else?
|
||||||
keyState = UCSR1B & 0x02;
|
keyState = UCSR1B & 0x02;
|
||||||
|
#elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM
|
||||||
|
// UART0_S1 must be read for the interrupt to be cleared
|
||||||
|
if ( UART0_S1 & UART_S1_RDRF )
|
||||||
|
{
|
||||||
|
// Only doing single byte FIFO here
|
||||||
|
keyValue = UART0_D;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// High bit of keyValue, also represents press/release
|
// High bit of keyValue, also represents press/release
|
||||||
keyState = keyValue & 0x80 ? 0x00 : 0x02;
|
keyState = keyValue & 0x80 ? 0x00 : 0x02;
|
||||||
@ -93,19 +122,21 @@ ISR(USART1_RX_vect)
|
|||||||
{
|
{
|
||||||
case 0x00: // Released
|
case 0x00: // Released
|
||||||
dPrintStrs( tmpStr, "R " ); // Debug
|
dPrintStrs( tmpStr, "R " ); // Debug
|
||||||
|
|
||||||
// Remove key from press buffer
|
|
||||||
removeKeyValue( keyValue & 0x7F );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x02: // Pressed
|
case 0x02: // Pressed
|
||||||
dPrintStrs( tmpStr, "P " ); // Debug
|
dPrintStrs( tmpStr, "P " ); // Debug
|
||||||
|
|
||||||
// New key to process
|
|
||||||
processKeyValue( keyValue & 0x7F );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add key event to macro key buffer
|
||||||
|
TriggerGuide guide = {
|
||||||
|
.type = 0x00,
|
||||||
|
.state = keyState == 0x02 ? 0x01 : 0x03,
|
||||||
|
.scanCode = keyValue & 0x7F,
|
||||||
|
};
|
||||||
|
Macro_pressReleaseAdd( &guide );
|
||||||
|
|
||||||
sei(); // Re-enable Interrupts
|
sei(); // Re-enable Interrupts
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +145,8 @@ ISR(USART1_RX_vect)
|
|||||||
// ----- Functions -----
|
// ----- Functions -----
|
||||||
|
|
||||||
// Setup
|
// 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
|
// 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
|
// NOTE: The input data signal needs to be inverted for the Teensy USART to properly work
|
||||||
@ -148,122 +180,133 @@ inline void scan_setup()
|
|||||||
// Reset the keyboard before scanning, we might be in a wierd state
|
// Reset the keyboard before scanning, we might be in a wierd state
|
||||||
scan_resetKeyboard();
|
scan_resetKeyboard();
|
||||||
}
|
}
|
||||||
|
#elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM
|
||||||
|
{
|
||||||
|
// Setup the the UART interface for keyboard data input
|
||||||
|
SIM_SCGC4 |= SIM_SCGC4_UART0; // Disable clock gating
|
||||||
|
|
||||||
|
// Pin Setup for UART0
|
||||||
|
PORTB_PCR16 = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_PFE | PORT_PCR_MUX(3); // RX Pin
|
||||||
|
PORTB_PCR17 = PORT_PCR_DSE | PORT_PCR_SRE | PORT_PCR_MUX(3); // TX Pin
|
||||||
|
|
||||||
|
// Setup baud rate - 1205 Baud
|
||||||
|
// 48 MHz / ( 16 * Baud ) = BDH/L
|
||||||
|
// Baud: 1215 -> 48 MHz / ( 16 * 1215 ) = 2469.1358
|
||||||
|
// Thus baud setting = 2469
|
||||||
|
// NOTE: If finer baud adjustment is needed see UARTx_C4 -> BRFA in the datasheet
|
||||||
|
uint16_t baud = 2469; // Max setting of 8191
|
||||||
|
UART0_BDH = (uint8_t)(baud >> 8);
|
||||||
|
UART0_BDL = (uint8_t)baud;
|
||||||
|
|
||||||
|
// 8 bit, Even Parity, Idle Character bit after stop
|
||||||
|
// NOTE: For 8 bit with Parity you must enable 9 bit transmission (pg. 1065)
|
||||||
|
// You only need to use UART0_D for 8 bit reading/writing though
|
||||||
|
// UART_C1_M UART_C1_PE UART_C1_PT UART_C1_ILT
|
||||||
|
UART0_C1 = UART_C1_M | UART_C1_PE | UART_C1_ILT;
|
||||||
|
|
||||||
|
// Number of bytes in FIFO before TX Interrupt
|
||||||
|
UART0_TWFIFO = 1;
|
||||||
|
|
||||||
|
// Number of bytes in FIFO before RX Interrupt
|
||||||
|
UART0_RWFIFO = 1;
|
||||||
|
|
||||||
|
// TX FIFO Disabled, TX FIFO Size 1 (Max 8 datawords), RX FIFO Enabled, RX FIFO Size 1 (Max 8 datawords)
|
||||||
|
// TX/RX FIFO Size:
|
||||||
|
// 0x0 - 1 dataword
|
||||||
|
// 0x1 - 4 dataword
|
||||||
|
// 0x2 - 8 dataword
|
||||||
|
//UART0_PFIFO = UART_PFIFO_TXFE | /*TXFIFOSIZE*/ (0x0 << 4) | UART_PFIFO_RXFE | /*RXFIFOSIZE*/ (0x0);
|
||||||
|
|
||||||
|
// Reciever Inversion Disabled, LSBF
|
||||||
|
// UART_S2_RXINV UART_S2_MSBF
|
||||||
|
UART0_S2 |= 0x00;
|
||||||
|
|
||||||
|
// Transmit Inversion Disabled
|
||||||
|
// UART_C3_TXINV
|
||||||
|
UART0_C3 |= 0x00;
|
||||||
|
|
||||||
|
// TX Disabled, RX Enabled, RX Interrupt Enabled
|
||||||
|
// UART_C2_TE UART_C2_RE UART_C2_RIE
|
||||||
|
UART0_C2 = UART_C2_RE | UART_C2_RIE | UART_C2_TE;
|
||||||
|
|
||||||
|
// Add interrupt to the vector table
|
||||||
|
NVIC_ENABLE_IRQ( IRQ_UART0_STATUS );
|
||||||
|
|
||||||
|
// Reset the keyboard before scanning, we might be in a wierd state
|
||||||
|
Scan_resetKeyboard();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Main Detection Loop
|
// Main Detection Loop
|
||||||
// Not needed for the BETKB, this is just a busy loop
|
// Not needed for the BETKB, this is just a busy loop
|
||||||
inline uint8_t scan_loop()
|
inline uint8_t Scan_loop()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void processKeyValue( uint8_t keyValue )
|
|
||||||
{
|
|
||||||
// Interpret scan code
|
|
||||||
switch ( keyValue )
|
|
||||||
{
|
|
||||||
case 0x00: // Break code from input?
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Make sure the key isn't already in the buffer
|
|
||||||
for ( uint8_t c = 0; c < KeyIndex_BufferUsed + 1; c++ )
|
|
||||||
{
|
|
||||||
// Key isn't in the buffer yet
|
|
||||||
if ( c == KeyIndex_BufferUsed )
|
|
||||||
{
|
|
||||||
Macro_bufferAdd( keyValue );
|
|
||||||
|
|
||||||
// Only send data if enabled
|
|
||||||
if ( KeyIndex_Add_InputSignal )
|
|
||||||
scan_sendData( KeyIndex_Add_InputSignal );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Key already in the buffer
|
|
||||||
if ( KeyIndex_Buffer[c] == keyValue )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeKeyValue( uint8_t keyValue )
|
|
||||||
{
|
|
||||||
// Check for the released key, and shift the other keys lower on the buffer
|
|
||||||
uint8_t c;
|
|
||||||
for ( c = 0; c < KeyIndex_BufferUsed; c++ )
|
|
||||||
{
|
|
||||||
// Key to release found
|
|
||||||
if ( KeyIndex_Buffer[c] == keyValue )
|
|
||||||
{
|
|
||||||
// Shift keys from c position
|
|
||||||
for ( uint8_t k = c; k < KeyIndex_BufferUsed - 1; k++ )
|
|
||||||
KeyIndex_Buffer[k] = KeyIndex_Buffer[k + 1];
|
|
||||||
|
|
||||||
// Decrement Buffer
|
|
||||||
KeyIndex_BufferUsed--;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error case (no key to release)
|
|
||||||
if ( c == KeyIndex_BufferUsed + 1 )
|
|
||||||
{
|
|
||||||
errorLED( 1 );
|
|
||||||
char tmpStr[6];
|
|
||||||
hexToStr( keyValue, tmpStr );
|
|
||||||
erro_dPrint( "Could not find key to release: ", tmpStr );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send data
|
// Send data
|
||||||
uint8_t scan_sendData( uint8_t dataPayload )
|
uint8_t scan_sendData( uint8_t dataPayload )
|
||||||
{
|
{
|
||||||
|
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
|
||||||
// Enable the USART Transmitter
|
// Enable the USART Transmitter
|
||||||
UCSR1B |= (1 << 3);
|
UCSR1B |= (1 << 3);
|
||||||
|
#elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM
|
||||||
|
#endif
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
char tmpStr[6];
|
char tmpStr[6];
|
||||||
hexToStr( dataPayload, tmpStr );
|
hexToStr( dataPayload, tmpStr );
|
||||||
info_dPrint( "Sending - ", tmpStr );
|
info_dPrint( "Sending - ", tmpStr );
|
||||||
|
|
||||||
|
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
|
||||||
UDR1 = dataPayload;
|
UDR1 = dataPayload;
|
||||||
|
#elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM
|
||||||
|
UART0_D = dataPayload;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Wait for the payload
|
// Wait for the payload
|
||||||
_delay_us( 800 );
|
_delay_us( 800 );
|
||||||
|
|
||||||
|
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
|
||||||
// Disable the USART Transmitter
|
// Disable the USART Transmitter
|
||||||
UCSR1B &= ~(1 << 3);
|
UCSR1B &= ~(1 << 3);
|
||||||
|
#elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal KeyIndex_Buffer that it has been properly read
|
// Signal KeyIndex_Buffer that it has been properly read
|
||||||
void Scan_finishedWithBuffer( uint8_t sentKeys )
|
void Scan_finishedWithMacro( uint8_t sentKeys )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal that the keys have been properly sent over USB
|
// Signal that the keys have been properly sent over USB
|
||||||
void Scan_finishedWithUSBBuffer( uint8_t sentKeys )
|
void Scan_finishedWithOutput( uint8_t sentKeys )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset/Hold keyboard
|
// Reset/Hold keyboard
|
||||||
// NOTE: Does nothing with the BETKB
|
// NOTE: Does nothing with the BETKB
|
||||||
void scan_lockKeyboard( void )
|
void Scan_lockKeyboard()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Does nothing with the BETKB
|
// NOTE: Does nothing with the BETKB
|
||||||
void scan_unlockKeyboard( void )
|
void Scan_unlockKeyboard()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset Keyboard
|
// Reset Keyboard
|
||||||
void scan_resetKeyboard( void )
|
void Scan_resetKeyboard()
|
||||||
{
|
{
|
||||||
// Not a calculated valued...
|
// Not a calculated valued...
|
||||||
_delay_ms( 50 );
|
_delay_ms( 50 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Does nothing with the BETKB
|
||||||
|
void Scan_currentChange( unsigned int current )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2012,2014-2015 by Jacob Alexander
|
/* Copyright (C) 2012,2014-2016 by Jacob Alexander
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -48,16 +48,17 @@ extern volatile uint8_t KeyIndex_Add_InputSignal;
|
|||||||
// ----- Functions -----
|
// ----- Functions -----
|
||||||
|
|
||||||
// Functions used by main.c
|
// Functions used by main.c
|
||||||
void Scan_setup( void );
|
void Scan_setup();
|
||||||
uint8_t Scan_loop( void );
|
uint8_t Scan_loop();
|
||||||
|
|
||||||
|
|
||||||
// Functions available to macro.c
|
// 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_finishedWithMacro( uint8_t sentKeys );
|
||||||
void Scan_finishedWithUSBBuffer( uint8_t sentKeys );
|
void Scan_finishedWithOutput( uint8_t sentKeys );
|
||||||
void Scan_lockKeyboard( void );
|
void Scan_lockKeyboard();
|
||||||
void Scan_unlockKeyboard( void );
|
void Scan_unlockKeyboard();
|
||||||
void Scan_resetKeyboard( void );
|
void Scan_resetKeyboard();
|
||||||
|
void Scan_currentChange( unsigned int current );
|
||||||
|
|
||||||
|
99
Scan/BETKB/scancode_map.kll
Normal file
99
Scan/BETKB/scancode_map.kll
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
Name = BETKB;
|
||||||
|
Version = 0.1;
|
||||||
|
Author = "HaaTa (Jacob Alexander) 2016";
|
||||||
|
KLL = 0.3d;
|
||||||
|
|
||||||
|
# Modified Date
|
||||||
|
Date = 2016-07-06;
|
||||||
|
|
||||||
|
# Options
|
||||||
|
|
||||||
|
# Press/Release Cache
|
||||||
|
PressReleaseCache => PressReleaseCache_define;
|
||||||
|
PressReleaseCache = 1;
|
||||||
|
|
||||||
|
# TODO - Not finished
|
||||||
|
S0x08 : U"Backspace";
|
||||||
|
S0x09 : U"Tab";
|
||||||
|
|
||||||
|
S0x1B : U"Esc";
|
||||||
|
|
||||||
|
S0x20 : U"Space";
|
||||||
|
|
||||||
|
S0x27 : U"Quote";
|
||||||
|
|
||||||
|
S0x2C : U"Comma";
|
||||||
|
S0x2D : U"Minus";
|
||||||
|
S0x2E : U"Period";
|
||||||
|
S0x2F : U"Slash";
|
||||||
|
S0x30 : U"0";
|
||||||
|
S0x31 : U"1";
|
||||||
|
S0x32 : U"2";
|
||||||
|
S0x33 : U"3";
|
||||||
|
S0x34 : U"4";
|
||||||
|
S0x35 : U"5";
|
||||||
|
S0x36 : U"6";
|
||||||
|
S0x37 : U"7";
|
||||||
|
S0x38 : U"8";
|
||||||
|
S0x39 : U"9";
|
||||||
|
S0x3B : U"Semicolon";
|
||||||
|
S0x3D : U"Equal";
|
||||||
|
S0x5B : U"LBracket";
|
||||||
|
S0x5C : U"Backslash";
|
||||||
|
S0x5D : U"RBracket";
|
||||||
|
|
||||||
|
S0x60 : U"Backtick";
|
||||||
|
S0x61 : U"A";
|
||||||
|
S0x62 : U"B";
|
||||||
|
S0x63 : U"C";
|
||||||
|
S0x64 : U"D";
|
||||||
|
S0x65 : U"E";
|
||||||
|
S0x66 : U"F";
|
||||||
|
S0x67 : U"G";
|
||||||
|
S0x68 : U"H";
|
||||||
|
S0x69 : U"I";
|
||||||
|
S0x6A : U"J";
|
||||||
|
S0x6B : U"K";
|
||||||
|
S0x6C : U"L";
|
||||||
|
S0x6D : U"M";
|
||||||
|
S0x6E : U"N";
|
||||||
|
S0x6F : U"O";
|
||||||
|
S0x70 : U"P";
|
||||||
|
S0x71 : U"Q";
|
||||||
|
S0x72 : U"R";
|
||||||
|
S0x73 : U"S";
|
||||||
|
S0x74 : U"T";
|
||||||
|
S0x75 : U"U";
|
||||||
|
S0x76 : U"V";
|
||||||
|
S0x77 : U"W";
|
||||||
|
S0x78 : U"X";
|
||||||
|
S0x79 : U"Y";
|
||||||
|
S0x7A : U"Z";
|
||||||
|
|
||||||
|
S0x7F : U"Delete";
|
||||||
|
|
||||||
|
S0xB1 : U"P0";
|
||||||
|
S0xB2 : U"P.";
|
||||||
|
|
||||||
|
S0xC0 : U"P1";
|
||||||
|
S0xC1 : U"P2";
|
||||||
|
S0xC2 : U"P3";
|
||||||
|
S0xC3 : U"PEnter";
|
||||||
|
|
||||||
|
S0xD0 : U"P4";
|
||||||
|
S0xD1 : U"P5";
|
||||||
|
S0xD2 : U"P6";
|
||||||
|
S0xD3 : U"P,";
|
||||||
|
|
||||||
|
S0xE1 : U"P7";
|
||||||
|
S0xE2 : U"P8";
|
||||||
|
S0xE3 : U"P9";
|
||||||
|
S0xE4 : U"P-";
|
||||||
|
|
||||||
|
S0xF1 : U"Up";
|
||||||
|
S0xF2 : U"Down";
|
||||||
|
S0xF3 : U"Left";
|
||||||
|
S0xF4 : U"Right";
|
||||||
|
S0xF5 : U"LShift";
|
||||||
|
S0xF6 : U"Ctrl";
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
###| CMake Kiibohd Controller Scan Module |###
|
###| CMake Kiibohd Controller Scan Module |###
|
||||||
#
|
#
|
||||||
# Written by Jacob Alexander in 2011,2014 for the Kiibohd Controller
|
# Written by Jacob Alexander in 2011,2014,2016 for the Kiibohd Controller
|
||||||
#
|
#
|
||||||
# Released into the Public Domain
|
# Released into the Public Domain
|
||||||
#
|
#
|
||||||
@ -13,7 +13,7 @@
|
|||||||
# Module C files
|
# Module C files
|
||||||
#
|
#
|
||||||
|
|
||||||
set( SCAN_SRCS
|
set( Module_SRCS
|
||||||
scan_loop.c
|
scan_loop.c
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,7 +26,8 @@ set( SCAN_SRCS
|
|||||||
###
|
###
|
||||||
# Compiler Family Compatibility
|
# Compiler Family Compatibility
|
||||||
#
|
#
|
||||||
set( ScanModuleCompatibility
|
set( ModuleCompatibility
|
||||||
|
arm
|
||||||
avr
|
avr
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ uint8_t Connect_receive_ScanCode( uint8_t byte, uint16_t *pending_bytes, uint8_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send ScanCode to macro module
|
// Send ScanCode to macro module
|
||||||
Macro_interconnectAdd( &Connect_receive_ScanCodeBuffer );
|
Macro_pressReleaseAdd( &Connect_receive_ScanCodeBuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user