#---------------------------------------------------------------------------- | |||||
# On command line: | |||||
# | |||||
# make all = Make software. | |||||
# | |||||
# make clean = Clean out built project files. | |||||
# | |||||
# make coff = Convert ELF to AVR COFF. | |||||
# | |||||
# make extcoff = Convert ELF to AVR Extended COFF. | |||||
# | |||||
# make program = Download the hex file to the device. | |||||
# Please customize your programmer settings(PROGRAM_CMD) | |||||
# | |||||
# make teensy = Download the hex file to the device, using teensy_loader_cli. | |||||
# (must have teensy_loader_cli installed). | |||||
# | |||||
# make dfu = Download the hex file to the device, using dfu-programmer (must | |||||
# have dfu-programmer installed). | |||||
# | |||||
# make flip = Download the hex file to the device, using Atmel FLIP (must | |||||
# have Atmel FLIP installed). | |||||
# | |||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer | |||||
# (must have dfu-programmer installed). | |||||
# | |||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP | |||||
# (must have Atmel FLIP installed). | |||||
# | |||||
# make debug = Start either simulavr or avarice as specified for debugging, | |||||
# with avr-gdb or avr-insight as the front end for debugging. | |||||
# | |||||
# make filename.s = Just compile filename.c into the assembler code only. | |||||
# | |||||
# make filename.i = Create a preprocessed source file for use in submitting | |||||
# bug reports to the GCC project. | |||||
# | |||||
# To rebuild project do "make clean" then "make all". | |||||
#---------------------------------------------------------------------------- | |||||
# Target file name (without extension). | |||||
TARGET = kimera_lufa | |||||
# Directory common source filess exist | |||||
TOP_DIR = ../.. | |||||
# Directory keyboard dependent files exist | |||||
TARGET_DIR = . | |||||
# project specific files | |||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
led.c \ | |||||
backlight.c \ | |||||
kimera.c | |||||
ifdef KEYMAP | |||||
SRC := keymap_$(KEYMAP).c $(SRC) | |||||
else | |||||
SRC := keymap_default.c $(SRC) | |||||
endif | |||||
CONFIG_H = config.h | |||||
# MCU name | |||||
#MCU = at90usb1287 | |||||
MCU = atmega32u4 | |||||
# Processor frequency. | |||||
# This will define a symbol, F_CPU, in all source code files equal to the | |||||
# processor frequency in Hz. You can then use this symbol in your source code to | |||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done | |||||
# automatically to create a 32-bit value in your source code. | |||||
# | |||||
# This will be an integer division of F_USB below, as it is sourced by | |||||
# F_USB after it has run through any CPU prescalers. Note that this value | |||||
# does not *change* the processor frequency - it should merely be updated to | |||||
# reflect the processor speed set externally so that the code can use accurate | |||||
# software delays. | |||||
F_CPU = 16000000 | |||||
# | |||||
# LUFA specific | |||||
# | |||||
# Target architecture (see library "Board Types" documentation). | |||||
ARCH = AVR8 | |||||
# Input clock frequency. | |||||
# This will define a symbol, F_USB, in all source code files equal to the | |||||
# input clock frequency (before any prescaling is performed) in Hz. This value may | |||||
# differ from F_CPU if prescaling is used on the latter, and is required as the | |||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed | |||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | |||||
# at the end, this will be done automatically to create a 32-bit value in your | |||||
# source code. | |||||
# | |||||
# If no clock division is performed on the input clock inside the AVR (via the | |||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | |||||
F_USB = $(F_CPU) | |||||
# Interrupt driven control endpoint task(+60) | |||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | |||||
# Boot Section Size in *bytes* | |||||
# Teensy halfKay 512 | |||||
# Teensy++ halfKay 1024 | |||||
# Atmel DFU loader 4096 | |||||
# LUFA bootloader 4096 | |||||
# USBaspLoader 2048 | |||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096 | |||||
# Additional definitions from command line | |||||
ifdef DEFS | |||||
OPT_DEFS += $(foreach DEF,$(DEFS),-D$(DEF)) | |||||
endif | |||||
# Build Options | |||||
# comment out to disable the options. | |||||
# | |||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | |||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | |||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | |||||
CONSOLE_ENABLE = yes # Console for debug(+400) | |||||
COMMAND_ENABLE = yes # Commands for debug and configuration | |||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | |||||
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA | |||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | |||||
#PS2_USE_BUSYWAIT = yes | |||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | |||||
KEYMAP_EX_ENABLE = yes # External keymap in eeprom | |||||
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor | |||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight | |||||
# Optimize size but this may cause error "relocation truncated to fit" | |||||
#EXTRALDFLAGS = -Wl,--relax | |||||
# Search Path | |||||
VPATH += $(TARGET_DIR) | |||||
VPATH += $(TOP_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk |
#---------------------------------------------------------------------------- | |||||
# On command line: | |||||
# | |||||
# make all = Make software. | |||||
# | |||||
# make clean = Clean out built project files. | |||||
# | |||||
# make coff = Convert ELF to AVR COFF. | |||||
# | |||||
# make extcoff = Convert ELF to AVR Extended COFF. | |||||
# | |||||
# make program = Download the hex file to the device. | |||||
# Please customize your programmer settings(PROGRAM_CMD) | |||||
# | |||||
# make teensy = Download the hex file to the device, using teensy_loader_cli. | |||||
# (must have teensy_loader_cli installed). | |||||
# | |||||
# make dfu = Download the hex file to the device, using dfu-programmer (must | |||||
# have dfu-programmer installed). | |||||
# | |||||
# make flip = Download the hex file to the device, using Atmel FLIP (must | |||||
# have Atmel FLIP installed). | |||||
# | |||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer | |||||
# (must have dfu-programmer installed). | |||||
# | |||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP | |||||
# (must have Atmel FLIP installed). | |||||
# | |||||
# make debug = Start either simulavr or avarice as specified for debugging, | |||||
# with avr-gdb or avr-insight as the front end for debugging. | |||||
# | |||||
# make filename.s = Just compile filename.c into the assembler code only. | |||||
# | |||||
# make filename.i = Create a preprocessed source file for use in submitting | |||||
# bug reports to the GCC project. | |||||
# | |||||
# To rebuild project do "make clean" then "make all". | |||||
#---------------------------------------------------------------------------- | |||||
# Target file name (without extension). | |||||
TARGET = kimera_pjrc | |||||
# Directory common source filess exist | |||||
TOP_DIR = ../.. | |||||
# Directory keyboard dependent files exist | |||||
TARGET_DIR = . | |||||
# project specific files | |||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
led.c \ | |||||
backlight.c \ | |||||
kimera.c | |||||
ifdef KEYMAP | |||||
SRC := keymap_$(KEYMAP).c $(SRC) | |||||
else | |||||
SRC := keymap_poker.c $(SRC) | |||||
endif | |||||
CONFIG_H = config.h | |||||
# MCU name, you MUST set this to match the board you are using | |||||
# type "make clean" after changing this, so all files will be rebuilt | |||||
MCU = atmega32u4 | |||||
#MCU = at90usb1286 | |||||
# Processor frequency. | |||||
# Normally the first thing your program should do is set the clock prescaler, | |||||
# so your program will run at the correct speed. You should also set this | |||||
# variable to same clock speed. The _delay_ms() macro uses this, and many | |||||
# examples use this variable to calculate timings. Do not add a "UL" here. | |||||
F_CPU = 16000000 | |||||
# Boot Section Size in *bytes* | |||||
# Teensy halfKay 512 | |||||
# Atmel DFU loader 4096 | |||||
# LUFA bootloader 4096 | |||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096 | |||||
# Additional definitions from command line | |||||
ifdef DEFS | |||||
OPT_DEFS += $(foreach DEF,$(DEFS),-D$(DEF)) | |||||
endif | |||||
# Build Options | |||||
# comment out to disable the options. | |||||
# | |||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | |||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | |||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | |||||
CONSOLE_ENABLE = yes # Console for debug(+400) | |||||
COMMAND_ENABLE = yes # Commands for debug and configuration | |||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | |||||
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA | |||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | |||||
#PS2_USE_BUSYWAIT = yes | |||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | |||||
KEYMAP_EX_ENABLE = yes # External keymap in eeprom | |||||
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor | |||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight | |||||
# Search Path | |||||
VPATH += $(TARGET_DIR) | |||||
VPATH += $(TOP_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk |
/* | |||||
Copyright 2014 Kai Ryu <[email protected]> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#include <avr/io.h> | |||||
#include <avr/interrupt.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "backlight.h" | |||||
#include "breathing_led.h" | |||||
#include "kimera.h" | |||||
#ifdef BACKLIGHT_ENABLE | |||||
void backlight_enable(void); | |||||
void backlight_disable(void); | |||||
inline void backlight_set_raw(uint8_t raw); | |||||
static const uint8_t backlight_table[] PROGMEM = { | |||||
0, 16, 128, 255 | |||||
}; | |||||
/* Backlight pin configuration | |||||
* BL: PB5 (D9) | |||||
*/ | |||||
void backlight_enable(void) | |||||
{ | |||||
// Turn on PWM | |||||
BL_DDR |= (1<<BL_BIT); | |||||
cli(); | |||||
TCCR1A |= ((1<<WGM10) | (1<<COM1A1)); | |||||
TCCR1B |= ((1<<CS11) | (1<<CS10)); | |||||
sei(); | |||||
} | |||||
void backlight_disable(void) | |||||
{ | |||||
// Turn off PWM | |||||
BL_DDR &= ~(1<<BL_BIT); | |||||
cli(); | |||||
TCCR1A &= ~((1<<WGM10) | (1<<COM1A1)); | |||||
TCCR1B &= ~((1<<CS11) | (1<<CS10)); | |||||
sei(); | |||||
BL_OCR = 0; | |||||
} | |||||
void backlight_set(uint8_t level) | |||||
{ | |||||
#ifdef BREATHING_LED_ENABLE | |||||
switch (level) { | |||||
case 1: | |||||
case 2: | |||||
case 3: | |||||
backlight_enable(); | |||||
breathing_led_disable(); | |||||
backlight_set_raw(pgm_read_byte(&backlight_table[level])); | |||||
break; | |||||
case 4: | |||||
case 5: | |||||
case 6: | |||||
backlight_enable(); | |||||
breathing_led_enable(); | |||||
breathing_led_set_duration(6 - level); | |||||
break; | |||||
case 0: | |||||
default: | |||||
breathing_led_disable(); | |||||
backlight_disable(); | |||||
break; | |||||
} | |||||
#else | |||||
if (level > 0) { | |||||
backlight_enable(); | |||||
backlight_set_raw(pgm_read_byte(&backlight_table[level])); | |||||
} | |||||
else { | |||||
backlight_disable(); | |||||
} | |||||
#endif | |||||
} | |||||
#ifdef BREATHING_LED_ENABLE | |||||
void breathing_led_set_raw(uint8_t raw) | |||||
{ | |||||
backlight_set_raw(raw); | |||||
} | |||||
#endif | |||||
inline void backlight_set_raw(uint8_t raw) | |||||
{ | |||||
OCR1A = raw; | |||||
} | |||||
#endif |
/* | |||||
Copyright 2014 Kai Ryu <[email protected]> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef CONFIG_H | |||||
#define CONFIG_H | |||||
/* USB Device descriptor parameter */ | |||||
#define VENDOR_ID 0x16c0 | |||||
#define PRODUCT_ID 0x27db | |||||
#define DEVICE_VER 0x0001 | |||||
#define MANUFACTURER [email protected] | |||||
#define PRODUCT Kimera | |||||
#define DESCRIPTION t.m.k. keyboard firmware for Kimera | |||||
/* key matrix size */ | |||||
#define MATRIX_ROWS 24 | |||||
#define MATRIX_COLS 24 | |||||
/* keymap in eeprom */ | |||||
#define FN_ACTIONS_COUNT 32 | |||||
#define KEYMAPS_COUNT 3 | |||||
/* define if matrix has ghost */ | |||||
//#define MATRIX_HAS_GHOST | |||||
/* Set 0 if debouncing isn't needed */ | |||||
#define DEBOUNCE 5 | |||||
/* number of backlight levels */ | |||||
#ifdef BREATHING_LED_ENABLE | |||||
#define BACKLIGHT_LEVELS 6 | |||||
#else | |||||
#define BACKLIGHT_LEVELS 3 | |||||
#endif | |||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | |||||
#define LOCKING_SUPPORT_ENABLE | |||||
/* Locking resynchronize hack */ | |||||
#define LOCKING_RESYNC_ENABLE | |||||
/* key combination for command */ | |||||
#define IS_COMMAND() ( \ | |||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | |||||
) | |||||
/* | |||||
* Feature disable options | |||||
* These options are also useful to firmware size reduction. | |||||
*/ | |||||
/* disable debug print */ | |||||
//#define NO_DEBUG | |||||
/* disable print */ | |||||
//#define NO_PRINT | |||||
/* disable action features */ | |||||
//#define NO_ACTION_LAYER | |||||
//#define NO_ACTION_TAPPING | |||||
//#define NO_ACTION_ONESHOT | |||||
//#define NO_ACTION_MACRO | |||||
//#define NO_ACTION_FUNCTION | |||||
#endif |
/* | |||||
Copyright 2014 Kai Ryu <[email protected]> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#include "keymap_common.h" | |||||
/* translates key to keycode */ | |||||
uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) | |||||
{ | |||||
#ifndef KEYMAP_EX_ENABLE | |||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); | |||||
#else | |||||
return eeconfig_read_keymap_key(layer, key.row, key.col); | |||||
#endif | |||||
} | |||||
/* translates Fn keycode to action */ | |||||
action_t keymap_fn_to_action(uint8_t keycode) | |||||
{ | |||||
return (action_t) { | |||||
#ifndef KEYMAP_EX_ENABLE | |||||
.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) | |||||
#else | |||||
.code = eeconfig_read_keymap_fn_action(FN_INDEX(keycode)) | |||||
#endif | |||||
}; | |||||
} | |||||
#ifdef KEYMAP_EX_ENABLE | |||||
const uint8_t* keymaps_pointer(void) { | |||||
return (const uint8_t*)keymaps; | |||||
} | |||||
const uint16_t* fn_actions_pointer(void) { | |||||
return fn_actions; | |||||
} | |||||
#endif |
/* | |||||
Copyright 2014 Kai Ryu <[email protected]> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef KEYMAP_COMMON_H | |||||
#define KEYMAP_COMMON_H | |||||
#include <stdint.h> | |||||
#include <stdbool.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | |||||
#include "action.h" | |||||
#include "action_macro.h" | |||||
#include "report.h" | |||||
#include "host.h" | |||||
#include "print.h" | |||||
#include "debug.h" | |||||
#include "keymap.h" | |||||
#include "keymap_ex.h" | |||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* Full keymap definition macro */ | |||||
#define KEYMAP( \ | |||||
KAA, KAB, KAC, KAD, KAE, KAF, KAG, KAH, KAJ, KAK, KAL, KAM, KAN, KAP, KAQ, KAR, KAS, KAT, KAU, KAV, KAW, KAX, KAY, KAZ, \ | |||||
KBA, KBB, KBC, KBD, KBE, KBF, KBG, KBH, KBJ, KBK, KBL, KBM, KBN, KBP, KBQ, KBR, KBS, KBT, KBU, KBV, KBW, KBX, KBY, KBZ, \ | |||||
KCA, KCB, KCC, KCD, KCE, KCF, KCG, KCH, KCJ, KCK, KCL, KCM, KCN, KCP, KCQ, KCR, KCS, KCT, KCU, KCV, KCW, KCX, KCY, KCZ, \ | |||||
KDA, KDB, KDC, KDD, KDE, KDF, KDG, KDH, KDJ, KDK, KDL, KDM, KDN, KDP, KDQ, KDR, KDS, KDT, KDU, KDV, KDW, KDX, KDY, KDZ, \ | |||||
KEA, KEB, KEC, KED, KEE, KEF, KEG, KEH, KEJ, KEK, KEL, KEM, KEN, KEP, KEQ, KER, KES, KET, KEU, KEV, KEW, KEX, KEY, KEZ, \ | |||||
KFA, KFB, KFC, KFD, KFE, KFF, KFG, KFH, KFJ, KFK, KFL, KFM, KFN, KFP, KFQ, KFR, KFS, KFT, KFU, KFV, KFW, KFX, KFY, KFZ, \ | |||||
KGA, KGB, KGC, KGD, KGE, KGF, KGG, KGH, KGJ, KGK, KGL, KGM, KGN, KGP, KGQ, KGR, KGS, KGT, KGU, KGV, KGW, KGX, KGY, KGZ, \ | |||||
KHA, KHB, KHC, KHD, KHE, KHF, KHG, KHH, KHJ, KHK, KHL, KHM, KHN, KHP, KHQ, KHR, KHS, KHT, KHU, KHV, KHW, KHX, KHY, KHZ, \ | |||||
KJA, KJB, KJC, KJD, KJE, KJF, KJG, KJH, KJJ, KJK, KJL, KJM, KJN, KJP, KJQ, KJR, KJS, KJT, KJU, KJV, KJW, KJX, KJY, KJZ, \ | |||||
KKA, KKB, KKC, KKD, KKE, KKF, KKG, KKH, KKJ, KKK, KKL, KKM, KKN, KKP, KKQ, KKR, KKS, KKT, KKU, KKV, KKW, KKX, KKY, KKZ, \ | |||||
KLA, KLB, KLC, KLD, KLE, KLF, KLG, KLH, KLJ, KLK, KLL, KLM, KLN, KLP, KLQ, KLR, KLS, KLT, KLU, KLV, KLW, KLX, KLY, KLZ, \ | |||||
KMA, KMB, KMC, KMD, KME, KMF, KMG, KMH, KMJ, KMK, KML, KMM, KMN, KMP, KMQ, KMR, KMS, KMT, KMU, KMV, KMW, KMX, KMY, KMZ, \ | |||||
KNA, KNB, KNC, KND, KNE, KNF, KNG, KNH, KNJ, KNK, KNL, KNM, KNN, KNP, KNQ, KNR, KNS, KNT, KNU, KNV, KNW, KNX, KNY, KNZ, \ | |||||
KPA, KPB, KPC, KPD, KPE, KPF, KPG, KPH, KPJ, KPK, KPL, KPM, KPN, KPP, KPQ, KPR, KPS, KPT, KPU, KPV, KPW, KPX, KPY, KPZ, \ | |||||
KQA, KQB, KQC, KQD, KQE, KQF, KQG, KQH, KQJ, KQK, KQL, KQM, KQN, KQP, KQQ, KQR, KQS, KQT, KQU, KQV, KQW, KQX, KQY, KQZ, \ | |||||
KRA, KRB, KRC, KRD, KRE, KRF, KRG, KRH, KRJ, KRK, KRL, KRM, KRN, KRP, KRQ, KRR, KRS, KRT, KRU, KRV, KRW, KRX, KRY, KRZ, \ | |||||
KSA, KSB, KSC, KSD, KSE, KSF, KSG, KSH, KSJ, KSK, KSL, KSM, KSN, KSP, KSQ, KSR, KSS, KST, KSU, KSV, KSW, KSX, KSY, KSZ, \ | |||||
KTA, KTB, KTC, KTD, KTE, KTF, KTG, KTH, KTJ, KTK, KTL, KTM, KTN, KTP, KTQ, KTR, KTS, KTT, KTU, KTV, KTW, KTX, KTY, KTZ, \ | |||||
KUA, KUB, KUC, KUD, KUE, KUF, KUG, KUH, KUJ, KUK, KUL, KUM, KUN, KUP, KUQ, KUR, KUS, KUT, KUU, KUV, KUW, KUX, KUY, KUZ, \ | |||||
KVA, KVB, KVC, KVD, KVE, KVF, KVG, KVH, KVJ, KVK, KVL, KVM, KVN, KVP, KVQ, KVR, KVS, KVT, KVU, KVV, KVW, KVX, KVY, KVZ, \ | |||||
KWA, KWB, KWC, KWD, KWE, KWF, KWG, KWH, KWJ, KWK, KWL, KWM, KWN, KWP, KWQ, KWR, KWS, KWT, KWU, KWV, KWW, KWX, KWY, KWZ, \ | |||||
KXA, KXB, KXC, KXD, KXE, KXF, KXG, KXH, KXJ, KXK, KXL, KXM, KXN, KXP, KXQ, KXR, KXS, KXT, KXU, KXV, KXW, KXX, KXY, KXZ, \ | |||||
KYA, KYB, KYC, KYD, KYE, KYF, KYG, KYH, KYJ, KYK, KYL, KYM, KYN, KYP, KYQ, KYR, KYS, KYT, KYU, KYV, KYW, KYX, KYY, KYZ, \ | |||||
KZA, KZB, KZC, KZD, KZE, KZF, KZG, KZH, KZJ, KZK, KZL, KZM, KZN, KZP, KZQ, KZR, KZS, KZT, KZU, KZV, KZW, KZX, KZY, KZZ \ | |||||
) { \ | |||||
{ KC_##KAA, KC_##KAB, KC_##KAC, KC_##KAD, KC_##KAE, KC_##KAF, KC_##KAG, KC_##KAH, KC_##KAJ, KC_##KAK, KC_##KAL, KC_##KAM, KC_##KAN, KC_##KAP, KC_##KAQ, KC_##KAR, KC_##KAS, KC_##KAT, KC_##KAU, KC_##KAV, KC_##KAW, KC_##KAX, KC_##KAY, KC_##KAZ }, \ | |||||
{ KC_##KBA, KC_##KBB, KC_##KBC, KC_##KBD, KC_##KBE, KC_##KBF, KC_##KBG, KC_##KBH, KC_##KBJ, KC_##KBK, KC_##KBL, KC_##KBM, KC_##KBN, KC_##KBP, KC_##KBQ, KC_##KBR, KC_##KBS, KC_##KBT, KC_##KBU, KC_##KBV, KC_##KBW, KC_##KBX, KC_##KBY, KC_##KBZ }, \ | |||||
{ KC_##KCA, KC_##KCB, KC_##KCC, KC_##KCD, KC_##KCE, KC_##KCF, KC_##KCG, KC_##KCH, KC_##KCJ, KC_##KCK, KC_##KCL, KC_##KCM, KC_##KCN, KC_##KCP, KC_##KCQ, KC_##KCR, KC_##KCS, KC_##KCT, KC_##KCU, KC_##KCV, KC_##KCW, KC_##KCX, KC_##KCY, KC_##KCZ }, \ | |||||
{ KC_##KDA, KC_##KDB, KC_##KDC, KC_##KDD, KC_##KDE, KC_##KDF, KC_##KDG, KC_##KDH, KC_##KDJ, KC_##KDK, KC_##KDL, KC_##KDM, KC_##KDN, KC_##KDP, KC_##KDQ, KC_##KDR, KC_##KDS, KC_##KDT, KC_##KDU, KC_##KDV, KC_##KDW, KC_##KDX, KC_##KDY, KC_##KDZ }, \ | |||||
{ KC_##KEA, KC_##KEB, KC_##KEC, KC_##KED, KC_##KEE, KC_##KEF, KC_##KEG, KC_##KEH, KC_##KEJ, KC_##KEK, KC_##KEL, KC_##KEM, KC_##KEN, KC_##KEP, KC_##KEQ, KC_##KER, KC_##KES, KC_##KET, KC_##KEU, KC_##KEV, KC_##KEW, KC_##KEX, KC_##KEY, KC_##KEZ }, \ | |||||
{ KC_##KFA, KC_##KFB, KC_##KFC, KC_##KFD, KC_##KFE, KC_##KFF, KC_##KFG, KC_##KFH, KC_##KFJ, KC_##KFK, KC_##KFL, KC_##KFM, KC_##KFN, KC_##KFP, KC_##KFQ, KC_##KFR, KC_##KFS, KC_##KFT, KC_##KFU, KC_##KFV, KC_##KFW, KC_##KFX, KC_##KFY, KC_##KFZ }, \ | |||||
{ KC_##KGA, KC_##KGB, KC_##KGC, KC_##KGD, KC_##KGE, KC_##KGF, KC_##KGG, KC_##KGH, KC_##KGJ, KC_##KGK, KC_##KGL, KC_##KGM, KC_##KGN, KC_##KGP, KC_##KGQ, KC_##KGR, KC_##KGS, KC_##KGT, KC_##KGU, KC_##KGV, KC_##KGW, KC_##KGX, KC_##KGY, KC_##KGZ }, \ | |||||
{ KC_##KHA, KC_##KHB, KC_##KHC, KC_##KHD, KC_##KHE, KC_##KHF, KC_##KHG, KC_##KHH, KC_##KHJ, KC_##KHK, KC_##KHL, KC_##KHM, KC_##KHN, KC_##KHP, KC_##KHQ, KC_##KHR, KC_##KHS, KC_##KHT, KC_##KHU, KC_##KHV, KC_##KHW, KC_##KHX, KC_##KHY, KC_##KHZ }, \ | |||||
{ KC_##KJA, KC_##KJB, KC_##KJC, KC_##KJD, KC_##KJE, KC_##KJF, KC_##KJG, KC_##KJH, KC_##KJJ, KC_##KJK, KC_##KJL, KC_##KJM, KC_##KJN, KC_##KJP, KC_##KJQ, KC_##KJR, KC_##KJS, KC_##KJT, KC_##KJU, KC_##KJV, KC_##KJW, KC_##KJX, KC_##KJY, KC_##KJZ }, \ | |||||
{ KC_##KKA, KC_##KKB, KC_##KKC, KC_##KKD, KC_##KKE, KC_##KKF, KC_##KKG, KC_##KKH, KC_##KKJ, KC_##KKK, KC_##KKL, KC_##KKM, KC_##KKN, KC_##KKP, KC_##KKQ, KC_##KKR, KC_##KKS, KC_##KKT, KC_##KKU, KC_##KKV, KC_##KKW, KC_##KKX, KC_##KKY, KC_##KKZ }, \ | |||||
{ KC_##KLA, KC_##KLB, KC_##KLC, KC_##KLD, KC_##KLE, KC_##KLF, KC_##KLG, KC_##KLH, KC_##KLJ, KC_##KLK, KC_##KLL, KC_##KLM, KC_##KLN, KC_##KLP, KC_##KLQ, KC_##KLR, KC_##KLS, KC_##KLT, KC_##KLU, KC_##KLV, KC_##KLW, KC_##KLX, KC_##KLY, KC_##KLZ }, \ | |||||
{ KC_##KMA, KC_##KMB, KC_##KMC, KC_##KMD, KC_##KME, KC_##KMF, KC_##KMG, KC_##KMH, KC_##KMJ, KC_##KMK, KC_##KML, KC_##KMM, KC_##KMN, KC_##KMP, KC_##KMQ, KC_##KMR, KC_##KMS, KC_##KMT, KC_##KMU, KC_##KMV, KC_##KMW, KC_##KMX, KC_##KMY, KC_##KMZ }, \ | |||||
{ KC_##KNA, KC_##KNB, KC_##KNC, KC_##KND, KC_##KNE, KC_##KNF, KC_##KNG, KC_##KNH, KC_##KNJ, KC_##KNK, KC_##KNL, KC_##KNM, KC_##KNN, KC_##KNP, KC_##KNQ, KC_##KNR, KC_##KNS, KC_##KNT, KC_##KNU, KC_##KNV, KC_##KNW, KC_##KNX, KC_##KNY, KC_##KNZ }, \ | |||||
{ KC_##KPA, KC_##KPB, KC_##KPC, KC_##KPD, KC_##KPE, KC_##KPF, KC_##KPG, KC_##KPH, KC_##KPJ, KC_##KPK, KC_##KPL, KC_##KPM, KC_##KPN, KC_##KPP, KC_##KPQ, KC_##KPR, KC_##KPS, KC_##KPT, KC_##KPU, KC_##KPV, KC_##KPW, KC_##KPX, KC_##KPY, KC_##KPZ }, \ | |||||
{ KC_##KQA, KC_##KQB, KC_##KQC, KC_##KQD, KC_##KQE, KC_##KQF, KC_##KQG, KC_##KQH, KC_##KQJ, KC_##KQK, KC_##KQL, KC_##KQM, KC_##KQN, KC_##KQP, KC_##KQQ, KC_##KQR, KC_##KQS, KC_##KQT, KC_##KQU, KC_##KQV, KC_##KQW, KC_##KQX, KC_##KQY, KC_##KQZ }, \ | |||||
{ KC_##KRA, KC_##KRB, KC_##KRC, KC_##KRD, KC_##KRE, KC_##KRF, KC_##KRG, KC_##KRH, KC_##KRJ, KC_##KRK, KC_##KRL, KC_##KRM, KC_##KRN, KC_##KRP, KC_##KRQ, KC_##KRR, KC_##KRS, KC_##KRT, KC_##KRU, KC_##KRV, KC_##KRW, KC_##KRX, KC_##KRY, KC_##KRZ }, \ | |||||
{ KC_##KSA, KC_##KSB, KC_##KSC, KC_##KSD, KC_##KSE, KC_##KSF, KC_##KSG, KC_##KSH, KC_##KSJ, KC_##KSK, KC_##KSL, KC_##KSM, KC_##KSN, KC_##KSP, KC_##KSQ, KC_##KSR, KC_##KSS, KC_##KST, KC_##KSU, KC_##KSV, KC_##KSW, KC_##KSX, KC_##KSY, KC_##KSZ }, \ | |||||
{ KC_##KTA, KC_##KTB, KC_##KTC, KC_##KTD, KC_##KTE, KC_##KTF, KC_##KTG, KC_##KTH, KC_##KTJ, KC_##KTK, KC_##KTL, KC_##KTM, KC_##KTN, KC_##KTP, KC_##KTQ, KC_##KTR, KC_##KTS, KC_##KTT, KC_##KTU, KC_##KTV, KC_##KTW, KC_##KTX, KC_##KTY, KC_##KTZ }, \ | |||||
{ KC_##KUA, KC_##KUB, KC_##KUC, KC_##KUD, KC_##KUE, KC_##KUF, KC_##KUG, KC_##KUH, KC_##KUJ, KC_##KUK, KC_##KUL, KC_##KUM, KC_##KUN, KC_##KUP, KC_##KUQ, KC_##KUR, KC_##KUS, KC_##KUT, KC_##KUU, KC_##KUV, KC_##KUW, KC_##KUX, KC_##KUY, KC_##KUZ }, \ | |||||
{ KC_##KVA, KC_##KVB, KC_##KVC, KC_##KVD, KC_##KVE, KC_##KVF, KC_##KVG, KC_##KVH, KC_##KVJ, KC_##KVK, KC_##KVL, KC_##KVM, KC_##KVN, KC_##KVP, KC_##KVQ, KC_##KVR, KC_##KVS, KC_##KVT, KC_##KVU, KC_##KVV, KC_##KVW, KC_##KVX, KC_##KVY, KC_##KVZ }, \ | |||||
{ KC_##KWA, KC_##KWB, KC_##KWC, KC_##KWD, KC_##KWE, KC_##KWF, KC_##KWG, KC_##KWH, KC_##KWJ, KC_##KWK, KC_##KWL, KC_##KWM, KC_##KWN, KC_##KWP, KC_##KWQ, KC_##KWR, KC_##KWS, KC_##KWT, KC_##KWU, KC_##KWV, KC_##KWW, KC_##KWX, KC_##KWY, KC_##KWZ }, \ | |||||
{ KC_##KXA, KC_##KXB, KC_##KXC, KC_##KXD, KC_##KXE, KC_##KXF, KC_##KXG, KC_##KXH, KC_##KXJ, KC_##KXK, KC_##KXL, KC_##KXM, KC_##KXN, KC_##KXP, KC_##KXQ, KC_##KXR, KC_##KXS, KC_##KXT, KC_##KXU, KC_##KXV, KC_##KXW, KC_##KXX, KC_##KXY, KC_##KXZ }, \ | |||||
{ KC_##KYA, KC_##KYB, KC_##KYC, KC_##KYD, KC_##KYE, KC_##KYF, KC_##KYG, KC_##KYH, KC_##KYJ, KC_##KYK, KC_##KYL, KC_##KYM, KC_##KYN, KC_##KYP, KC_##KYQ, KC_##KYR, KC_##KYS, KC_##KYT, KC_##KYU, KC_##KYV, KC_##KYW, KC_##KYX, KC_##KYY, KC_##KYZ }, \ | |||||
{ KC_##KZA, KC_##KZB, KC_##KZC, KC_##KZD, KC_##KZE, KC_##KZF, KC_##KZG, KC_##KZH, KC_##KZJ, KC_##KZK, KC_##KZL, KC_##KZM, KC_##KZN, KC_##KZP, KC_##KZQ, KC_##KZR, KC_##KZS, KC_##KZT, KC_##KZU, KC_##KZV, KC_##KZW, KC_##KZX, KC_##KZY, KC_##KZZ }, \ | |||||
} | |||||
/* 8 rows, 24 cols */ | |||||
#define KEYMAP_8x24( \ | |||||
KAA, KAB, KAC, KAD, KAE, KAF, KAG, KAH, KAJ, KAK, KAL, KAM, KAN, KAP, KAQ, KAR, KAS, KAT, KAU, KAV, KAW, KAX, KAY, KAZ, \ | |||||
KBA, KBB, KBC, KBD, KBE, KBF, KBG, KBH, KBJ, KBK, KBL, KBM, KBN, KBP, KBQ, KBR, KBS, KBT, KBU, KBV, KBW, KBX, KBY, KBZ, \ | |||||
KCA, KCB, KCC, KCD, KCE, KCF, KCG, KCH, KCJ, KCK, KCL, KCM, KCN, KCP, KCQ, KCR, KCS, KCT, KCU, KCV, KCW, KCX, KCY, KCZ, \ | |||||
KDA, KDB, KDC, KDD, KDE, KDF, KDG, KDH, KDJ, KDK, KDL, KDM, KDN, KDP, KDQ, KDR, KDS, KDT, KDU, KDV, KDW, KDX, KDY, KDZ, \ | |||||
KEA, KEB, KEC, KED, KEE, KEF, KEG, KEH, KEJ, KEK, KEL, KEM, KEN, KEP, KEQ, KER, KES, KET, KEU, KEV, KEW, KEX, KEY, KEZ, \ | |||||
KFA, KFB, KFC, KFD, KFE, KFF, KFG, KFH, KFJ, KFK, KFL, KFM, KFN, KFP, KFQ, KFR, KFS, KFT, KFU, KFV, KFW, KFX, KFY, KFZ, \ | |||||
KGA, KGB, KGC, KGD, KGE, KGF, KGG, KGH, KGJ, KGK, KGL, KGM, KGN, KGP, KGQ, KGR, KGS, KGT, KGU, KGV, KGW, KGX, KGY, KGZ, \ | |||||
KHA, KHB, KHC, KHD, KHE, KHF, KHG, KHH, KHJ, KHK, KHL, KHM, KHN, KHP, KHQ, KHR, KHS, KHT, KHU, KHV, KHW, KHX, KHY, KHZ \ | |||||
) KEYMAP( \ | |||||
KAA, KAB, KAC, KAD, KAE, KAF, KAG, KAH, KAJ, KAK, KAL, KAM, KAN, KAP, KAQ, KAR, KAS, KAT, KAU, KAV, KAW, KAX, KAY, KAZ, \ | |||||
KBA, KBB, KBC, KBD, KBE, KBF, KBG, KBH, KBJ, KBK, KBL, KBM, KBN, KBP, KBQ, KBR, KBS, KBT, KBU, KBV, KBW, KBX, KBY, KBZ, \ | |||||
KCA, KCB, KCC, KCD, KCE, KCF, KCG, KCH, KCJ, KCK, KCL, KCM, KCN, KCP, KCQ, KCR, KCS, KCT, KCU, KCV, KCW, KCX, KCY, KCZ, \ | |||||
KDA, KDB, KDC, KDD, KDE, KDF, KDG, KDH, KDJ, KDK, KDL, KDM, KDN, KDP, KDQ, KDR, KDS, KDT, KDU, KDV, KDW, KDX, KDY, KDZ, \ | |||||
KEA, KEB, KEC, KED, KEE, KEF, KEG, KEH, KEJ, KEK, KEL, KEM, KEN, KEP, KEQ, KER, KES, KET, KEU, KEV, KEW, KEX, KEY, KEZ, \ | |||||
KFA, KFB, KFC, KFD, KFE, KFF, KFG, KFH, KFJ, KFK, KFL, KFM, KFN, KFP, KFQ, KFR, KFS, KFT, KFU, KFV, KFW, KFX, KFY, KFZ, \ | |||||
KGA, KGB, KGC, KGD, KGE, KGF, KGG, KGH, KGJ, KGK, KGL, KGM, KGN, KGP, KGQ, KGR, KGS, KGT, KGU, KGV, KGW, KGX, KGY, KGZ, \ | |||||
KHA, KHB, KHC, KHD, KHE, KHF, KHG, KHH, KHJ, KHK, KHL, KHM, KHN, KHP, KHQ, KHR, KHS, KHT, KHU, KHV, KHW, KHX, KHY, KHZ, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO \ | |||||
) | |||||
/* 16 rows, 16 cols */ | |||||
#define KEYMAP_16x16( \ | |||||
KAA, KAB, KAC, KAD, KAE, KAF, KAG, KAH, KAJ, KAK, KAL, KAM, KAN, KAP, KAQ, KAR, KAS, KAT, KAU, KAV, KAW, KAX, KAY, KAZ, \ | |||||
KBA, KBB, KBC, KBD, KBE, KBF, KBG, KBH, KBJ, KBK, KBL, KBM, KBN, KBP, KBQ, KBR, KBS, KBT, KBU, KBV, KBW, KBX, KBY, KBZ, \ | |||||
KCA, KCB, KCC, KCD, KCE, KCF, KCG, KCH, KCJ, KCK, KCL, KCM, KCN, KCP, KCQ, KCR, KCS, KCT, KCU, KCV, KCW, KCX, KCY, KCZ, \ | |||||
KDA, KDB, KDC, KDD, KDE, KDF, KDG, KDH, KDJ, KDK, KDL, KDM, KDN, KDP, KDQ, KDR, KDS, KDT, KDU, KDV, KDW, KDX, KDY, KDZ, \ | |||||
KEA, KEB, KEC, KED, KEE, KEF, KEG, KEH, KEJ, KEK, KEL, KEM, KEN, KEP, KEQ, KER, KES, KET, KEU, KEV, KEW, KEX, KEY, KEZ, \ | |||||
KFA, KFB, KFC, KFD, KFE, KFF, KFG, KFH, KFJ, KFK, KFL, KFM, KFN, KFP, KFQ, KFR, KFS, KFT, KFU, KFV, KFW, KFX, KFY, KFZ, \ | |||||
KGA, KGB, KGC, KGD, KGE, KGF, KGG, KGH, KGJ, KGK, KGL, KGM, KGN, KGP, KGQ, KGR, KGS, KGT, KGU, KGV, KGW, KGX, KGY, KGZ, \ | |||||
KHA, KHB, KHC, KHD, KHE, KHF, KHG, KHH, KHJ, KHK, KHL, KHM, KHN, KHP, KHQ, KHR, KHS, KHT, KHU, KHV, KHW, KHX, KHY, KHZ, \ | |||||
KJA, KJB, KJC, KJD, KJE, KJF, KJG, KJH, KJJ, KJK, KJL, KJM, KJN, KJP, KJQ, KJR, KJS, KJT, KJU, KJV, KJW, KJX, KJY, KJZ, \ | |||||
KKA, KKB, KKC, KKD, KKE, KKF, KKG, KKH, KKJ, KKK, KKL, KKM, KKN, KKP, KKQ, KKR, KKS, KKT, KKU, KKV, KKW, KKX, KKY, KKZ, \ | |||||
KLA, KLB, KLC, KLD, KLE, KLF, KLG, KLH, KLJ, KLK, KLL, KLM, KLN, KLP, KLQ, KLR, KLS, KLT, KLU, KLV, KLW, KLX, KLY, KLZ, \ | |||||
KMA, KMB, KMC, KMD, KME, KMF, KMG, KMH, KMJ, KMK, KML, KMM, KMN, KMP, KMQ, KMR, KMS, KMT, KMU, KMV, KMW, KMX, KMY, KMZ, \ | |||||
KNA, KNB, KNC, KND, KNE, KNF, KNG, KNH, KNJ, KNK, KNL, KNM, KNN, KNP, KNQ, KNR, KNS, KNT, KNU, KNV, KNW, KNX, KNY, KNZ, \ | |||||
KPA, KPB, KPC, KPD, KPE, KPF, KPG, KPH, KPJ, KPK, KPL, KPM, KPN, KPP, KPQ, KPR, KPS, KPT, KPU, KPV, KPW, KPX, KPY, KPZ, \ | |||||
KQA, KQB, KQC, KQD, KQE, KQF, KQG, KQH, KQJ, KQK, KQL, KQM, KQN, KQP, KQQ, KQR, KQS, KQT, KQU, KQV, KQW, KQX, KQY, KQZ, \ | |||||
KRA, KRB, KRC, KRD, KRE, KRF, KRG, KRH, KRJ, KRK, KRL, KRM, KRN, KRP, KRQ, KRR, KRS, KRT, KRU, KRV, KRW, KRX, KRY, KRZ, \ | |||||
KSA, KSB, KSC, KSD, KSE, KSF, KSG, KSH, KSJ, KSK, KSL, KSM, KSN, KSP, KSQ, KSR, KSS, KST, KSU, KSV, KSW, KSX, KSY, KSZ, \ | |||||
KTA, KTB, KTC, KTD, KTE, KTF, KTG, KTH, KTJ, KTK, KTL, KTM, KTN, KTP, KTQ, KTR, KTS, KTT, KTU, KTV, KTW, KTX, KTY, KTZ, \ | |||||
KUA, KUB, KUC, KUD, KUE, KUF, KUG, KUH, KUJ, KUK, KUL, KUM, KUN, KUP, KUQ, KUR, KUS, KUT, KUU, KUV, KUW, KUX, KUY, KUZ, \ | |||||
KVA, KVB, KVC, KVD, KVE, KVF, KVG, KVH, KVJ, KVK, KVL, KVM, KVN, KVP, KVQ, KVR, KVS, KVT, KVU, KVV, KVW, KVX, KVY, KVZ, \ | |||||
KWA, KWB, KWC, KWD, KWE, KWF, KWG, KWH, KWJ, KWK, KWL, KWM, KWN, KWP, KWQ, KWR, KWS, KWT, KWU, KWV, KWW, KWX, KWY, KWZ, \ | |||||
KXA, KXB, KXC, KXD, KXE, KXF, KXG, KXH, KXJ, KXK, KXL, KXM, KXN, KXP, KXQ, KXR, KXS, KXT, KXU, KXV, KXW, KXX, KXY, KXZ, \ | |||||
KYA, KYB, KYC, KYD, KYE, KYF, KYG, KYH, KYJ, KYK, KYL, KYM, KYN, KYP, KYQ, KYR, KYS, KYT, KYU, KYV, KYW, KYX, KYY, KYZ, \ | |||||
KZA, KZB, KZC, KZD, KZE, KZF, KZG, KZH, KZJ, KZK, KZL, KZM, KZN, KZP, KZQ, KZR, KZS, KZT, KZU, KZV, KZW, KZX, KZY, KZZ \ | |||||
) KEYMAP( \ | |||||
KAA, KAB, KAC, KAD, KAE, KAF, KAG, KAH, KAJ, KAK, KAL, KAM, KAN, KAP, KAQ, KAR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KBA, KBB, KBC, KBD, KBE, KBF, KBG, KBH, KBJ, KBK, KBL, KBM, KBN, KBP, KBQ, KBR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KCA, KCB, KCC, KCD, KCE, KCF, KCG, KCH, KCJ, KCK, KCL, KCM, KCN, KCP, KCQ, KCR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KDA, KDB, KDC, KDD, KDE, KDF, KDG, KDH, KDJ, KDK, KDL, KDM, KDN, KDP, KDQ, KDR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KEA, KEB, KEC, KED, KEE, KEF, KEG, KEH, KEJ, KEK, KEL, KEM, KEN, KEP, KEQ, KER, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KFA, KFB, KFC, KFD, KFE, KFF, KFG, KFH, KFJ, KFK, KFL, KFM, KFN, KFP, KFQ, KFR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KGA, KGB, KGC, KGD, KGE, KGF, KGG, KGH, KGJ, KGK, KGL, KGM, KGN, KGP, KGQ, KGR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KHA, KHB, KHC, KHD, KHE, KHF, KHG, KHH, KHJ, KHK, KHL, KHM, KHN, KHP, KHQ, KHR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KJA, KJB, KJC, KJD, KJE, KJF, KJG, KJH, KJJ, KJK, KJL, KJM, KJN, KJP, KJQ, KJR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KKA, KKB, KKC, KKD, KKE, KKF, KKG, KKH, KKJ, KKK, KKL, KKM, KKN, KKP, KKQ, KKR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KLA, KLB, KLC, KLD, KLE, KLF, KLG, KLH, KLJ, KLK, KLL, KLM, KLN, KLP, KLQ, KLR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KMA, KMB, KMC, KMD, KME, KMF, KMG, KMH, KMJ, KMK, KML, KMM, KMN, KMP, KMQ, KMR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KNA, KNB, KNC, KND, KNE, KNF, KNG, KNH, KNJ, KNK, KNL, KNM, KNN, KNP, KNQ, KNR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KPA, KPB, KPC, KPD, KPE, KPF, KPG, KPH, KPJ, KPK, KPL, KPM, KPN, KPP, KPQ, KPR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KQA, KQB, KQC, KQD, KQE, KQF, KQG, KQH, KQJ, KQK, KQL, KQM, KQN, KQP, KQQ, KQR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KRA, KRB, KRC, KRD, KRE, KRF, KRG, KRH, KRJ, KRK, KRL, KRM, KRN, KRP, KRQ, KRR, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO \ | |||||
) | |||||
/* 24 rows, 8 cols */ | |||||
#define KEYMAP_24x8( \ | |||||
KAA, KAB, KAC, KAD, KAE, KAF, KAG, KAH, \ | |||||
KBA, KBB, KBC, KBD, KBE, KBF, KBG, KBH, \ | |||||
KCA, KCB, KCC, KCD, KCE, KCF, KCG, KCH, \ | |||||
KDA, KDB, KDC, KDD, KDE, KDF, KDG, KDH, \ | |||||
KEA, KEB, KEC, KED, KEE, KEF, KEG, KEH, \ | |||||
KFA, KFB, KFC, KFD, KFE, KFF, KFG, KFH, \ | |||||
KGA, KGB, KGC, KGD, KGE, KGF, KGG, KGH, \ | |||||
KHA, KHB, KHC, KHD, KHE, KHF, KHG, KHH, \ | |||||
KJA, KJB, KJC, KJD, KJE, KJF, KJG, KJH, \ | |||||
KKA, KKB, KKC, KKD, KKE, KKF, KKG, KKH, \ | |||||
KLA, KLB, KLC, KLD, KLE, KLF, KLG, KLH, \ | |||||
KMA, KMB, KMC, KMD, KME, KMF, KMG, KMH, \ | |||||
KNA, KNB, KNC, KND, KNE, KNF, KNG, KNH, \ | |||||
KPA, KPB, KPC, KPD, KPE, KPF, KPG, KPH, \ | |||||
KQA, KQB, KQC, KQD, KQE, KQF, KQG, KQH, \ | |||||
KRA, KRB, KRC, KRD, KRE, KRF, KRG, KRH, \ | |||||
KSA, KSB, KSC, KSD, KSE, KSF, KSG, KSH, \ | |||||
KTA, KTB, KTC, KTD, KTE, KTF, KTG, KTH, \ | |||||
KUA, KUB, KUC, KUD, KUE, KUF, KUG, KUH, \ | |||||
KVA, KVB, KVC, KVD, KVE, KVF, KVG, KVH, \ | |||||
KWA, KWB, KWC, KWD, KWE, KWF, KWG, KWH, \ | |||||
KXA, KXB, KXC, KXD, KXE, KXF, KXG, KXH, \ | |||||
KYA, KYB, KYC, KYD, KYE, KYF, KYG, KYH, \ | |||||
KZA, KZB, KZC, KZD, KZE, KZF, KZG, KZH \ | |||||
) KEYMAP( \ | |||||
KAA, KAB, KAC, KAD, KAE, KAF, KAG, KAH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KBA, KBB, KBC, KBD, KBE, KBF, KBG, KBH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KCA, KCB, KCC, KCD, KCE, KCF, KCG, KCH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KDA, KDB, KDC, KDD, KDE, KDF, KDG, KDH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KEA, KEB, KEC, KED, KEE, KEF, KEG, KEH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KFA, KFB, KFC, KFD, KFE, KFF, KFG, KFH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KGA, KGB, KGC, KGD, KGE, KGF, KGG, KGH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KHA, KHB, KHC, KHD, KHE, KHF, KHG, KHH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KJA, KJB, KJC, KJD, KJE, KJF, KJG, KJH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KKA, KKB, KKC, KKD, KKE, KKF, KKG, KKH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KLA, KLB, KLC, KLD, KLE, KLF, KLG, KLH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KMA, KMB, KMC, KMD, KME, KMF, KMG, KMH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KNA, KNB, KNC, KND, KNE, KNF, KNG, KNH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KPA, KPB, KPC, KPD, KPE, KPF, KPG, KPH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KQA, KQB, KQC, KQD, KQE, KQF, KQG, KQH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KRA, KRB, KRC, KRD, KRE, KRF, KRG, KRH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KSA, KSB, KSC, KSD, KSE, KSF, KSG, KSH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KTA, KTB, KTC, KTD, KTE, KTF, KTG, KTH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KUA, KUB, KUC, KUD, KUE, KUF, KUG, KUH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KVA, KVB, KVC, KVD, KVE, KVF, KVG, KVH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KWA, KWB, KWC, KWD, KWE, KWF, KWG, KWH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KXA, KXB, KXC, KXD, KXE, KXF, KXG, KXH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KYA, KYB, KYC, KYD, KYE, KYF, KYG, KYH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
KZA, KZB, KZC, KZD, KZE, KZF, KZG, KZH, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO \ | |||||
) | |||||
/* ANSI 104 keymap */ | |||||
#define KEYMAP_ANSI_104( \ | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PRS, SCL, PAU, \ | |||||
GRV, _1, _2, _3, _4, _5, _6, _7, _8, _9, _0, MNS, EQU, BSP, INS, HOM, PGU, NUM, PSL, PAS, PMN, \ | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBR, RBR, BSL, DEL, END, PGD, P7, P8, P9, PPL, \ | |||||
CAP, A, S, D, F, G, H, J, K, L, SCN, QUT, ENT, P4, P5, P6, \ | |||||
LSF, Z, X, C, V, B, N, M, COM, DOT, SLS, RSF, UP, P1, P2, P3, PEN, \ | |||||
LCT, LGU, LAL, SPC, RAL, RGU, APP, RCT, LFT, DOW, RGT, P0, PDT \ | |||||
) KEYMAP_8x24( \ | |||||
ESC, NO, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PRS, SCL, PAU, NO, NO, NO, NO, NO, NO, NO, \ | |||||
GRV, _1, _2, _3, _4, _5, _6, _7, _8, _9, _0, MNS, EQU, BSP, INS, HOM, PGU, NUM, PSL, PAS, PMN, NO, NO, NO, \ | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBR, RBR, BSL, DEL, END, PGD, P7, P8, P9, PPL, NO, NO, NO, \ | |||||
CAP, A, S, D, F, G, H, J, K, L, SCN, QUT, NO, ENT, NO, NO, NO, P4, P5, P6, NO, NO, NO, NO, \ | |||||
LSF, Z, X, C, V, B, N, M, COM, DOT, SLS, NO, NO, RSF, NO, UP, NO, P1, P2, P3, PEN, NO, NO, NO, \ | |||||
LCT, LGU, LAL, NO, NO, NO, SPC, NO, NO, NO, RAL, RGU, APP, RCT, LFT, DOW, RGT, P0, NO, PDT, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO \ | |||||
) | |||||
#endif |
#include "keymap_common.h" | |||||
// Default | |||||
#ifdef KEYMAP_SECTION_ENABLE | |||||
const uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { | |||||
#else | |||||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||||
#endif | |||||
/* Keymap 0: Default Layer | |||||
* ,---------------------------------------------------------------------------------------. | |||||
* |Esc| | F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12|Psc|Slk|Pus| | | |||||
* |---------------------------------------------------------------------------------------| | |||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Ins|Hom|PgU|Num| /| *| -| | |||||
* |---------------------------------------------------------------------------------------| | |||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|Del|End|PgD| 7| 8| 9| | | |||||
* |-----------------------------------------------------------------------------------| +| | |||||
* |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| | | |||||
* |-----------------------------------------------------------| ,---. |---------------| | |||||
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| | | |||||
* |-----------------------------------------------------------------------------------|Ent| | |||||
* |Ctrl|Gui |Alt | Space |Alt |Gui |Fn0 |Ctrl|Lef|Dow|Rig| 0| .| | | |||||
* `---------------------------------------------------------------------------------------' | |||||
*/ | |||||
KEYMAP_ANSI_104( | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, \ | |||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \ | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, \ | |||||
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, \ | |||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, PENT, \ | |||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,FN0, RCTL, LEFT,DOWN,RGHT, P0, PDOT ), | |||||
/* Keymap 1: Fn Layer | |||||
* ,---------------------------------------------------------------------------------------. | |||||
* | | | | | | | | | | | | | | | | | | | | | |||||
* |---------------------------------------------------------------------------------------| | |||||
* | | | | | | | | | | | | | | | | | | | | | | | |||||
* |---------------------------------------------------------------------------------------| | |||||
* | |Fn1|Fn2|Fn3| | | | | | | | | | | | | | | | | | | |||||
* |-----------------------------------------------------------------------------------| | | |||||
* | | | | | | | | | | | | | | | | | | | | |||||
* |-----------------------------------------------------------| ,---. |---------------- | |||||
* | | | | | | | | | | | | | | | | | | | | | |||||
* |-----------------------------------------------------------------------------------| | | |||||
* | | | | | | | | | | | | | | | | | |||||
* `---------------------------------------------------------------------------------------' | |||||
*/ | |||||
KEYMAP_ANSI_104( | |||||
TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \ | |||||
TRNS,FN1, FN2, FN3, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, NLCK,TRNS,TRNS,TRNS, \ | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \ | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, \ | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, \ | |||||
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS ), | |||||
}; | |||||
/* | |||||
* Fn action definition | |||||
*/ | |||||
#ifdef KEYMAP_SECTION_ENABLE | |||||
const uint16_t fn_actions[FN_ACTIONS_COUNT] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
#else | |||||
const uint16_t fn_actions[] PROGMEM = { | |||||
#endif | |||||
/* Poker2 Layout */ | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | |||||
[1] = ACTION_BACKLIGHT_TOGGLE(), | |||||
[2] = ACTION_BACKLIGHT_DECREASE(), | |||||
[3] = ACTION_BACKLIGHT_INCREASE(), | |||||
}; | |||||
#ifdef KEYMAP_EX_ENABLE | |||||
uint16_t keys_count(void) { | |||||
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS; | |||||
} | |||||
uint16_t fn_actions_count(void) { | |||||
return sizeof(fn_actions) / sizeof(fn_actions[0]); | |||||
} | |||||
#endif |
/* | |||||
Copyright 2014 Kai Ryu <[email protected]> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#define KIMERA_C | |||||
#include <stdbool.h> | |||||
#include <avr/eeprom.h> | |||||
#include "kimera.h" | |||||
uint8_t mux_mapping[MUX_COUNT] = { | |||||
MUX_FOR_ROW, MUX_FOR_COL, MUX_FOR_COL, MUX_FOR_COL | |||||
}; | |||||
uint8_t row_mapping[MATRIX_ROWS] = { | |||||
0, 1, 2, 3, 4, 5, 6, 7, | |||||
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, | |||||
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED | |||||
}; | |||||
uint8_t col_mapping[MATRIX_COLS] = { | |||||
8, 9, 10, 11, 12, 13, 14, 15, | |||||
16, 17, 18, 19, 20, 21, 22, 23, | |||||
24, 25, 26, 27, 28, 29, 30, 31 | |||||
}; | |||||
uint16_t shift_out_cache = 0; | |||||
void kimera_init(void) | |||||
{ | |||||
// read config | |||||
if (read_matrix_mapping()) { | |||||
write_matrix_mapping(); | |||||
} | |||||
// init shift out pins | |||||
MOSI_DDR |= (1<<MOSI_BIT); | |||||
SCK_DDR |= (1<<SCK_BIT); | |||||
RCK_DDR |= (1<<RCK_BIT); | |||||
RCK_PORT |= (1<<RCK_BIT); | |||||
// init spi | |||||
SPCR |= ((1<<SPE) | (1<<MSTR)); | |||||
SPSR |= ((1<<SPI2X)); | |||||
} | |||||
uint8_t read_matrix_mapping(void) | |||||
{ | |||||
uint8_t error = 0; | |||||
uint8_t mux_config = 0; | |||||
uint8_t row_max_count = 0; | |||||
uint8_t col_max_count = 0; | |||||
mux_config = eeprom_read_byte(EECONFIG_MUX_MAPPING); | |||||
if (mux_config & (1<<7)) { | |||||
error++; | |||||
return error; | |||||
} | |||||
for (uint8_t i = 0; i < MUX_COUNT; i++) { | |||||
mux_mapping[i] = mux_config & (1<<i); | |||||
if (mux_mapping[i] == MUX_FOR_COL) { | |||||
col_max_count += MUX_PORTS; | |||||
} | |||||
else { | |||||
row_max_count += MUX_PORTS; | |||||
} | |||||
} | |||||
if ((col_max_count == 0) || (row_max_count == 0)) { | |||||
error++; | |||||
} | |||||
uint8_t *mapping = EECONFIG_ROW_COL_MAPPING; | |||||
for (uint8_t i = 0; i < row_max_count; i++) { | |||||
row_mapping[i] = eeprom_read_byte(mapping++); | |||||
if (row_mapping[i] != UNCONFIGURED) { | |||||
if (mux_mapping[PX_TO_MUX(row_mapping[i])] != MUX_FOR_ROW) { | |||||
row_mapping[i] = UNCONFIGURED; | |||||
error++; | |||||
} | |||||
} | |||||
} | |||||
for (uint8_t i = 0; i < col_max_count; i++) { | |||||
col_mapping[i] = eeprom_read_byte(mapping++); | |||||
if (col_mapping[i] != UNCONFIGURED) { | |||||
if (mux_mapping[PX_TO_MUX(col_mapping[i])] != MUX_FOR_COL) { | |||||
col_mapping[i] = UNCONFIGURED; | |||||
error++; | |||||
} | |||||
} | |||||
} | |||||
return error; | |||||
} | |||||
void write_matrix_mapping(void) | |||||
{ | |||||
uint8_t mux_config = 0; | |||||
uint8_t row_max_count = 0; | |||||
uint8_t col_max_count = 0; | |||||
for (uint8_t i = 0; i < MUX_COUNT; i++) { | |||||
mux_config |= (mux_mapping[i] << i); | |||||
if (mux_mapping[i] == MUX_FOR_COL) { | |||||
col_max_count += MUX_PORTS; | |||||
} | |||||
else { | |||||
row_max_count += MUX_PORTS; | |||||
} | |||||
} | |||||
eeprom_write_byte(EECONFIG_MUX_MAPPING, mux_config); | |||||
uint8_t *mapping = EECONFIG_ROW_COL_MAPPING; | |||||
for (uint8_t i = 0; i < row_max_count; i++) { | |||||
eeprom_write_byte(mapping++, row_mapping[i]); | |||||
} | |||||
for (uint8_t i = 0; i < col_max_count; i++) { | |||||
eeprom_write_byte(mapping++, col_mapping[i]); | |||||
} | |||||
} | |||||
void shift_out_word(uint16_t data) | |||||
{ | |||||
SPDR = (data & 0xFF); | |||||
while (!(SPSR & (1<<SPIF))); | |||||
SPDR = ((data>>8) & 0xFF); | |||||
while (!(SPSR & (1<<SPIF))); | |||||
RCK_PORT &= ~(1<<RCK_BIT); | |||||
RCK_PORT |= (1<<RCK_BIT); | |||||
} | |||||
void init_cols(void) | |||||
{ | |||||
// init mux io pins | |||||
for (uint8_t i = 0; i < MUX_COUNT; i++) { | |||||
if (mux_mapping[i] == MUX_FOR_COL) { | |||||
ZX_DDR &= ~(1 << zx_bit[i]); | |||||
ZX_PORT |= (1 << zx_bit[i]); | |||||
} | |||||
else { | |||||
ZX_DDR |= (1 << zx_bit[i]); | |||||
ZX_PORT |= (1 << zx_bit[i]); | |||||
} | |||||
} | |||||
} | |||||
matrix_row_t read_cols(void) | |||||
{ | |||||
matrix_row_t cols = 0; | |||||
for (uint8_t i = 0; i < MATRIX_COLS; i++) { | |||||
uint8_t px = col_mapping[i]; | |||||
if (px != UNCONFIGURED) { | |||||
shift_out_word(shift_out_cache | px_to_shift_out[px]); | |||||
// TODO: delay | |||||
if (!(ZX_PIN & (1 << zx_bit[PX_TO_MUX(px)]))) { | |||||
cols |= (1 << i); | |||||
} | |||||
} | |||||
} | |||||
return cols; | |||||
} | |||||
void unselect_rows(void) | |||||
{ | |||||
shift_out_word(0); | |||||
} | |||||
void select_row(uint8_t row) | |||||
{ | |||||
uint8_t px = row_mapping[row]; | |||||
if (px != UNCONFIGURED) { | |||||
ZX_PORT &= ~(1 << zx_bit[PX_TO_MUX(px)]); | |||||
shift_out_cache = px_to_shift_out[px] | mux_inh_to_shift_out[PX_TO_MUX(px)]; | |||||
shift_out_word(shift_out_cache); | |||||
} | |||||
} |
/* | |||||
Copyright 2014 Kai Ryu <[email protected]> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef KIMERA_H | |||||
#define KIMERA_H | |||||
#include <stdint.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "matrix.h" | |||||
/* | |||||
Pro Micro | |||||
,----------------. | |||||
TX --| TX0(PD3) RAW |-- | |||||
RX --| RX1(PD2) GND |-- | |||||
--| GND RESET |-- RST | |||||
--| GND VCC |-- | |||||
SDA --| 2(PD1) (PF4)A3 |-- (Z4) | |||||
SCL --| 3(PD0) (PF5)A2 |-- (Z1) | |||||
(RCK) --| 4(PD4) (PF6)A1 |-- (Z2) | |||||
LED1 --| 5(PC6) (PF7)A0 |-- (Z3) | |||||
LED2 --| 6(PD7) (PB1)15 |-- SCK | |||||
(SJ1) --| 7(PE6) (PB3)14 |-- MISO | |||||
(SJ2) --| 8(PB4) (PB2)16 |-- MOSI | |||||
BL --| 9(PB5) (PB6)10 |-- LED3 | |||||
`----------------' | |||||
*/ | |||||
#define LED1_PORT PORTC | |||||
#define LED1_PIN PINC | |||||
#define LED1_DDR DDRC | |||||
#define LED1_BIT PC6 | |||||
#define LED2_PORT PORTD | |||||
#define LED2_PIN PIND | |||||
#define LED2_DDR DDRD | |||||
#define LED2_BIT PD7 | |||||
#define LED3_PORT PORTB | |||||
#define LED3_PIN PINB | |||||
#define LED3_DDR DDRB | |||||
#define LED3_BIT PB6 | |||||
#define BL_PORT PORTB | |||||
#define BL_PIN PINB | |||||
#define BL_DDR DDRB | |||||
#define BL_BIT PB5 | |||||
#define BL_OCR OCR1A | |||||
#define RCK_PORT PORTD | |||||
#define RCK_PIN PIND | |||||
#define RCK_DDR DDRD | |||||
#define RCK_BIT PD4 | |||||
#define SCK_PORT PORTB | |||||
#define SCK_PIN PINB | |||||
#define SCK_DDR DDRB | |||||
#define SCK_BIT PB1 | |||||
#define MOSI_PORT PORTB | |||||
#define MOSI_PIN PINB | |||||
#define MOSI_DDR DDRB | |||||
#define MOSI_BIT PB2 | |||||
#define MISO_PORT PORTB | |||||
#define MISO_PIN PINB | |||||
#define MISO_DDR DDRB | |||||
#define MISO_BIT PB3 | |||||
#define ZX_PORT PORTF | |||||
#define ZX_PIN PINF | |||||
#define ZX_DDR DDRF | |||||
#ifdef KIMERA_C | |||||
const uint8_t PROGMEM zx_bit[] = { | |||||
PF5, PF6, PF7, PF4 | |||||
}; | |||||
#endif | |||||
/* | |||||
Shift Register Multiplexer | |||||
,----------. ,------------. | |||||
MOSI --| SER 0 |----| INH X0~X7 |===============. | |||||
SCK --|>SCK 1 |----| A | | | |||||
RCK --|>RCK 2 |----| B | ,-------------+-------------. | |||||
| 3 |----| C | | | | | | | | | | |||||
| | `------------' P26 P27 P28 P25 P29 P32 P30 P31 | |||||
| | ,------------. | |||||
| 4 |----| A X0~X7 |===============. | |||||
| 5 |----| B | | | |||||
| 6 |----| C | ,-------------+-------------. | |||||
| 7 |----| INH | | | | | | | | | | |||||
| | `------------' P2 P3 P4 P1 P5 P8 P6 P7 | |||||
| | ,------------. | |||||
| 8 |----| INH X0~X7 |===============. | |||||
| 9 |----| A | | | |||||
| 10 |----| B | ,-------------+-------------. | |||||
| 11 |----| C | | | | | | | | | | |||||
| | `------------' P10 P11 P12 P9 P13 P16 P14 P15 | |||||
| | ,------------. | |||||
| 12 |----| A X0~X7 |===============. | |||||
| 13 |----| B | | | |||||
| 14 |----| C | ,-------------+-------------. | |||||
| 15 |----| INH | | | | | | | | | | |||||
`----------' `------------' P18 P19 P20 P17 P21 P24 P22 P23 | |||||
*/ | |||||
#define MUX_COUNT 4 | |||||
#define MUX_PORTS 8 | |||||
#define PX_TO_MUX(x) (x>>3) // (x / MUX_PORTS) | |||||
enum { | |||||
MUX4_INH = 0, | |||||
MUX4_A, | |||||
MUX4_B, | |||||
MUX4_C, | |||||
MUX1_A, | |||||
MUX1_B, | |||||
MUX1_C, | |||||
MUX1_INH, | |||||
MUX2_INH, | |||||
MUX2_A, | |||||
MUX2_B, | |||||
MUX2_C, | |||||
MUX3_A, | |||||
MUX3_B, | |||||
MUX3_C, | |||||
MUX3_INH | |||||
}; | |||||
#ifdef KIMERA_C | |||||
const uint16_t PROGMEM px_to_shift_out[] = { | |||||
3<<MUX1_A, 0<<MUX1_A, 1<<MUX1_A, 2<<MUX1_A, 4<<MUX1_A, 6<<MUX1_A, 7<<MUX1_A, 5<<MUX1_A, | |||||
3<<MUX2_A, 0<<MUX2_A, 1<<MUX2_A, 2<<MUX2_A, 4<<MUX2_A, 6<<MUX2_A, 7<<MUX2_A, 5<<MUX2_A, | |||||
3<<MUX3_A, 0<<MUX3_A, 1<<MUX3_A, 2<<MUX3_A, 4<<MUX3_A, 6<<MUX3_A, 7<<MUX3_A, 5<<MUX3_A, | |||||
3<<MUX4_A, 0<<MUX4_A, 1<<MUX4_A, 2<<MUX4_A, 4<<MUX4_A, 6<<MUX4_A, 7<<MUX4_A, 5<<MUX4_A | |||||
}; | |||||
const uint16_t PROGMEM mux_inh_to_shift_out[] = { | |||||
1<<MUX1_INH, 1<<MUX2_INH, 1<<MUX3_INH, 1<<MUX4_INH | |||||
}; | |||||
#endif | |||||
/* Matrix Mapping in EEPROM */ | |||||
#define EECONFIG_MUX_MAPPING (uint8_t *)7 | |||||
#define EECONFIG_ROW_COL_MAPPING (uint8_t *)8 | |||||
#define MATRIX_MAPPING_SIZE MUX_COUNT * MUX_PORTS | |||||
#define EECONFIG_KEYMAP_EX 40 | |||||
typedef struct { | |||||
uint8_t mux_mapping; | |||||
uint8_t row_col_mapping; | |||||
} matrix_mapping_t; | |||||
#define MUX_INPUT 0 | |||||
#define MUX_OUTPUT 1 | |||||
#define MUX_FOR_COL MUX_INPUT | |||||
#define MUX_FOR_ROW MUX_OUTPUT | |||||
#define UNCONFIGURED 0xFF | |||||
/* Functions */ | |||||
void kimera_init(void); | |||||
uint8_t read_matrix_mapping(void); | |||||
void write_matrix_mapping(void); | |||||
void shift_out_word(uint16_t word); | |||||
matrix_row_t read_cols(void); | |||||
void init_cols(void); | |||||
void unselect_rows(void); | |||||
void select_row(uint8_t row); | |||||
#endif |
/* | |||||
Copyright 2014 Kai Ryu <[email protected]> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#include <avr/io.h> | |||||
#include "stdint.h" | |||||
#include "led.h" | |||||
#include "kimera.h" | |||||
void led_set(uint8_t usb_led) | |||||
{ | |||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | |||||
// output low | |||||
LED1_DDR |= (1<<LED1_BIT); | |||||
LED1_PORT &= ~(1<<LED1_BIT); | |||||
} else { | |||||
// Hi-Z | |||||
LED1_DDR &= ~(1<<LED1_BIT); | |||||
LED1_PORT &= ~(1<<LED1_BIT); | |||||
} | |||||
if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { | |||||
// output low | |||||
LED2_DDR |= (1<<LED2_BIT); | |||||
LED2_PORT &= ~(1<<LED2_BIT); | |||||
} else { | |||||
// Hi-Z | |||||
LED2_DDR &= ~(1<<LED2_BIT); | |||||
LED2_PORT &= ~(1<<LED2_BIT); | |||||
} | |||||
if (usb_led & (1<<USB_LED_NUM_LOCK)) { | |||||
// output low | |||||
LED3_DDR |= (1<<LED3_BIT); | |||||
LED3_PORT &= ~(1<<LED3_BIT); | |||||
} else { | |||||
// Hi-Z | |||||
LED3_DDR &= ~(1<<LED3_BIT); | |||||
LED3_PORT &= ~(1<<LED3_BIT); | |||||
} | |||||
} |
/* | |||||
Copyright 2014 Kai Ryu <[email protected]> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
/* | |||||
* scan matrix | |||||
*/ | |||||
#include <stdint.h> | |||||
#include <stdbool.h> | |||||
#include <avr/io.h> | |||||
#include <util/delay.h> | |||||
#include "print.h" | |||||
#include "debug.h" | |||||
#include "util.h" | |||||
#include "matrix.h" | |||||
#include "kimera.h" | |||||
#ifndef DEBOUNCE | |||||
# define DEBOUNCE 5 | |||||
#endif | |||||
static uint8_t debouncing = DEBOUNCE; | |||||
/* matrix state(1:on, 0:off) */ | |||||
static matrix_row_t matrix[MATRIX_ROWS]; | |||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | |||||
inline | |||||
uint8_t matrix_rows(void) | |||||
{ | |||||
return MATRIX_ROWS; | |||||
} | |||||
inline | |||||
uint8_t matrix_cols(void) | |||||
{ | |||||
return MATRIX_COLS; | |||||
} | |||||
void matrix_init(void) | |||||
{ | |||||
// disable JTAG | |||||
MCUCR = (1<<JTD); | |||||
MCUCR = (1<<JTD); | |||||
kimera_init(); | |||||
// initialize row and col | |||||
unselect_rows(); | |||||
init_cols(); | |||||
// initialize matrix state: all keys off | |||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) { | |||||
matrix[i] = 0; | |||||
matrix_debouncing[i] = 0; | |||||
} | |||||
} | |||||
uint8_t matrix_scan(void) | |||||
{ | |||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | |||||
select_row(i); | |||||
_delay_us(30); // without this wait read unstable value. | |||||
matrix_row_t cols = read_cols(); | |||||
if (matrix_debouncing[i] != cols) { | |||||
matrix_debouncing[i] = cols; | |||||
if (debouncing) { | |||||
debug("bounce!: "); debug_hex(debouncing); debug("\n"); | |||||
} | |||||
debouncing = DEBOUNCE; | |||||
} | |||||
unselect_rows(); | |||||
} | |||||
if (debouncing) { | |||||
if (--debouncing) { | |||||
_delay_ms(1); | |||||
} else { | |||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | |||||
matrix[i] = matrix_debouncing[i]; | |||||
} | |||||
} | |||||
} | |||||
return 1; | |||||
} | |||||
bool matrix_is_modified(void) | |||||
{ | |||||
if (debouncing) return false; | |||||
return true; | |||||
} | |||||
inline | |||||
bool matrix_is_on(uint8_t row, uint8_t col) | |||||
{ | |||||
return (matrix[row] & ((matrix_row_t)1<<col)); | |||||
} | |||||
inline | |||||
matrix_row_t matrix_get_row(uint8_t row) | |||||
{ | |||||
return matrix[row]; | |||||
} | |||||
void matrix_print(void) | |||||
{ | |||||
print("\nr/c 0123456789ABCDEF\n"); | |||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | |||||
phex(row); print(": "); | |||||
pbin_reverse16(matrix_get_row(row)); | |||||
print("\n"); | |||||
} | |||||
} | |||||
uint8_t matrix_key_count(void) | |||||
{ | |||||
uint8_t count = 0; | |||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | |||||
count += bitpop16(matrix[i]); | |||||
} | |||||
return count; | |||||
} |