diff options
author | Erez Zukerman <ezuk@madmimi.com> | 2015-10-27 00:54:46 +0200 |
---|---|---|
committer | Erez Zukerman <ezuk@madmimi.com> | 2015-10-27 00:54:46 +0200 |
commit | 0c47e8b008ccb6bfbb7051a5c2e4b0031dae0fa5 (patch) | |
tree | 0f883338e928824d1940fe98f23a69d0e4194e20 /keyboard/ergodox | |
parent | cc1c32671eb1eb43a87e55ac4ffa60b15115e48d (diff) |
[Jack & Erez] Comments + tiny updates and cleanup
Diffstat (limited to 'keyboard/ergodox')
-rw-r--r-- | keyboard/ergodox/Makefile | 139 | ||||
-rw-r--r-- | keyboard/ergodox/README.md | 56 | ||||
-rw-r--r-- | keyboard/ergodox/backlight.c | 61 | ||||
-rw-r--r-- | keyboard/ergodox/config.h | 88 | ||||
-rw-r--r-- | keyboard/ergodox/ergodox.c | 123 | ||||
-rw-r--r-- | keyboard/ergodox/ergodox.h | 145 | ||||
-rw-r--r-- | keyboard/ergodox/i2cmaster.h | 178 | ||||
-rw-r--r-- | keyboard/ergodox/keymaps/keymap_cub.c | 595 | ||||
-rw-r--r-- | keyboard/ergodox/keymaps/keymap_default.c | 130 | ||||
-rw-r--r-- | keyboard/ergodox/keymaps/keymap_ergodox_ez.c | 210 | ||||
-rw-r--r-- | keyboard/ergodox/keymaps/keymap_passwords_example.h | 23 | ||||
-rw-r--r-- | keyboard/ergodox/keymaps/keymap_simon.c | 624 | ||||
-rw-r--r-- | keyboard/ergodox/keymaps/keymap_simon_passwords.example.h | 2 | ||||
-rw-r--r-- | keyboard/ergodox/matrix.c | 405 | ||||
-rw-r--r-- | keyboard/ergodox/twimaster.c | 208 |
15 files changed, 0 insertions, 2987 deletions
diff --git a/keyboard/ergodox/Makefile b/keyboard/ergodox/Makefile deleted file mode 100644 index f71d096783..0000000000 --- a/keyboard/ergodox/Makefile +++ /dev/null @@ -1,139 +0,0 @@ -#---------------------------------------------------------------------------- -# 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 = ergodox - - -# Directory common source filess exist -TOP_DIR = ../.. - -# Directory keyboard dependent files exist -TARGET_DIR = . - -# # project specific files -SRC = ergodox.c \ - twimaster.c \ - backlight.c - -ifdef KEYMAP - SRC := keymaps/keymap_$(KEYMAP).c $(SRC) -else - SRC := keymaps/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 - - -# 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 -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend -# NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA -# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -# MIDI_ENABLE = YES # MIDI controls -# UNICODE_ENABLE = YES # Unicode -# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID - - -# 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)/quantum.mk - diff --git a/keyboard/ergodox/README.md b/keyboard/ergodox/README.md deleted file mode 100644 index bbbc73515b..0000000000 --- a/keyboard/ergodox/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# TMK Generic - -* I'm not sure what the Magic + H does. - Is this a menu that will pop up regardless of what platform and program is open? - - Yes, this is sort of debugging. - Use PJRC's [hid_listen](https://www.pjrc.com/teensy/hid_listen.html) to see debug messages. - -# TMK/Ergodox specific - -* I would like to configure my leds to indicate the active layer. - I read that can be done, but I haven't seen an example for this firmware. - Can someone please post an example or a link? - - TMK for Ergodox have support for seven (!) led's: - - three on right - - three on left (see http://geekhack.org/index.php?topic=22780.msg873819#msg873819 for more details) - - Teensy onboard led as well - - Any of these leds can be used as layer indicator or NumLock/CapsLock/ScrollLock led. - - [Here is example](https://github.com/cub-uanic/tmk_keyboard/blob/cub_layout/keyboard/ergodox/matrix.c#L121-167) - how you can assign some meaning to each led. - In this code only left leds are used to show layers, but you can - [change `led_set()`](https://github.com/cub-uanic/tmk_keyboard/blob/cub_layout/keyboard/ergodox/led.c) - and do anything you want with all leds. - -# Firmware - -Q: Where to get binaries? -A: - -Q: Where to get sources? -A: - -Q: How to compile? -A: - - -# Layouts - -description of layouts in base firmware binaries - - -# Things TO-DO - -- [ ] Flash NumLock led only when "numpad" layer is active -- [ ] Command (in terms of IS_COMMAND) to switch to no-leds mode -- [ ] Increase count of ACTION keys -- [ ] Fix command_state() onboard led: it should flash only when kbd in some specific mode (CONSOLE || MOUSE) -- [ ] ergodox_blink_all_leds() should save current state of leds, and restore after blink. initial state of all leds == off -- [ ] add support for pseudo-backlight (reversed LEDs) + docs/photo -- [ ] command to debug all LEDs (on/off/blink) -- [ ] proper (in-core) implementation of DEBUG_MATRIX_SCAN_RATE (non-Ergodox specific) -- [ ] proper (in-core) support for per-layer fn_actions[] - diff --git a/keyboard/ergodox/backlight.c b/keyboard/ergodox/backlight.c deleted file mode 100644 index f69364b2af..0000000000 --- a/keyboard/ergodox/backlight.c +++ /dev/null @@ -1,61 +0,0 @@ - -#include <avr/io.h> -#include "backlight.h" - -#define CHANNEL OCR1C - -void backlight_init_ports() -{ - - // Setup PB7 as output and output low. - DDRB |= (1<<7); - PORTB &= ~(1<<7); - - // Use full 16-bit resolution. - ICR1 = 0xFFFF; - - // I could write a wall of text here to explain... but TL;DW - // Go read the ATmega32u4 datasheet. - // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on - - // Pin PB7 = OCR1C (Timer 1, Channel C) - // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 - // (i.e. start high, go low when counter matches.) - // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 - // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 - - TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; - TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; - - backlight_init(); -} - -void backlight_set(uint8_t level) -{ - if ( level == 0 ) - { - // Turn off PWM control on PB7, revert to output low. - TCCR1A &= ~(_BV(COM1C1)); - CHANNEL = 0x0; - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - } - else if ( level == BACKLIGHT_LEVELS ) - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF; - } - else - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); - } -}
\ No newline at end of file diff --git a/keyboard/ergodox/config.h b/keyboard/ergodox/config.h deleted file mode 100644 index c8eaae6146..0000000000 --- a/keyboard/ergodox/config.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 2012 Jun Wako <wakojun@gmail.com> -Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com> - -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 - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x1307 -#define DEVICE_VER 0x0001 -#define MANUFACTURER ErgoDox EZ -#define PRODUCT ErgoDox EZ -#define DESCRIPTION t.m.k. keyboard firmware for Ergodox - -/* key matrix size */ -#define MATRIX_ROWS 14 -#define MATRIX_COLS 6 - -#define MOUSEKEY_DELAY 100 -#define MOUSEKEY_INTERVAL 20 -#define MOUSEKEY_MAX_SPEED 3 -#define MOUSEKEY_TIME_TO_MAX 10 - -#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define ROWS (int []){ D0, D5, B5, B6 } - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 2 -#define TAPPING_TERM 230 -#define TAPPING_TOGGLE 2 - -/* 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_LCTL) | MOD_BIT(KC_RCTL)) || \ - keyboard_report->mods == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \ -) - -/* - * 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 -//#define DEBUG_MATRIX_SCAN_RATE - -#endif diff --git a/keyboard/ergodox/ergodox.c b/keyboard/ergodox/ergodox.c deleted file mode 100644 index 950e6a66ca..0000000000 --- a/keyboard/ergodox/ergodox.c +++ /dev/null @@ -1,123 +0,0 @@ -#include "ergodox.h" -#include "i2cmaster.h" - -bool i2c_initialized = 0; -uint8_t mcp23018_status = 0x20; - -bool ergodox_left_led_1 = 0; // left top -bool ergodox_left_led_2 = 0; // left middle -bool ergodox_left_led_3 = 0; // left bottom - -__attribute__ ((weak)) -void * matrix_init_user(void) { - -}; - -__attribute__ ((weak)) -void * matrix_scan_user(void) { - -}; - -void * matrix_init_kb(void) { - // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md") - TCCR1A = 0b10101001; // set and configure fast PWM - TCCR1B = 0b00001001; // set and configure fast PWM - - // (tied to Vcc for hardware convenience) - DDRB &= ~(1<<4); // set B(4) as input - PORTB &= ~(1<<4); // set B(4) internal pull-up disabled - - // unused pins - C7, D4, D5, D7, E6 - // set as input with internal pull-ip enabled - DDRC &= ~(1<<7); - DDRD &= ~(1<<7 | 1<<5 | 1<<4); - DDRE &= ~(1<<6); - PORTC |= (1<<7); - PORTD |= (1<<7 | 1<<5 | 1<<4); - PORTE |= (1<<6); - - ergodox_blink_all_leds(); - - if (matrix_init_user) { - (*matrix_init_user)(); - } -}; - -void * matrix_scan_kb(void) { - - if (matrix_scan_user) { - (*matrix_scan_user)(); - } -}; - - -void ergodox_blink_all_leds(void) -{ - ergodox_led_all_off(); - ergodox_led_all_set(LED_BRIGHTNESS_HI); - ergodox_led_all_on(); - _delay_ms(333); - ergodox_led_all_off(); -} - -uint8_t init_mcp23018(void) { - mcp23018_status = 0x20; - - // I2C subsystem - if (i2c_initialized == 0) { - i2c_init(); // on pins D(1,0) - i2c_initialized++; - _delay_ms(1000); - } - - // set pin direction - // - unused : input : 1 - // - input : input : 1 - // - driving : output : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(IODIRA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out; - i2c_stop(); - - // set pull-up - // - unused : on : 1 - // - input : on : 1 - // - driving : off : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPPUA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out; - -out: - i2c_stop(); - - if (!mcp23018_status) mcp23018_status = ergodox_left_leds_update(); - - return mcp23018_status; -} - -uint8_t ergodox_left_leds_update(void) { - if (mcp23018_status) { // if there was an error - return mcp23018_status; - } - - // set logical value (doesn't matter on inputs) - // - unused : hi-Z : 1 - // - input : hi-Z : 1 - // - driving : hi-Z : 1 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(OLATA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_3<<LEFT_LED_3_SHIFT) - ); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_2<<LEFT_LED_2_SHIFT) - & ~(ergodox_left_led_1<<LEFT_LED_1_SHIFT) - ); if (mcp23018_status) goto out; - -out: - i2c_stop(); - return mcp23018_status; -} - diff --git a/keyboard/ergodox/ergodox.h b/keyboard/ergodox/ergodox.h deleted file mode 100644 index 9d0691dfe2..0000000000 --- a/keyboard/ergodox/ergodox.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef PLANCK_H -#define PLANCK_H - -#include "matrix.h" -#include "keymap_common.h" -#include "backlight.h" -#include <stddef.h> -#include <stdint.h> -#include <stdbool.h> -#include <avr/io.h> -#include "i2cmaster.h" -#include <util/delay.h> - -#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) -#define CPU_16MHz 0x00 - -// I2C aliases and register addresses (see "mcp23018.md") -#define I2C_ADDR 0b0100000 -#define I2C_ADDR_WRITE ( (I2C_ADDR<<1) | I2C_WRITE ) -#define I2C_ADDR_READ ( (I2C_ADDR<<1) | I2C_READ ) -#define IODIRA 0x00 // i/o direction register -#define IODIRB 0x01 -#define GPPUA 0x0C // GPIO pull-up resistor register -#define GPPUB 0x0D -#define GPIOA 0x12 // general purpose i/o port register (write modifies OLAT) -#define GPIOB 0x13 -#define OLATA 0x14 // output latch register -#define OLATB 0x15 - -extern uint8_t mcp23018_status; - -void init_ergodox(void); -void ergodox_blink_all_leds(void); -uint8_t init_mcp23018(void); -uint8_t ergodox_left_leds_update(void); - -#define LED_BRIGHTNESS_LO 31 -#define LED_BRIGHTNESS_HI 255 - -#define LEFT_LED_1_SHIFT 7 // in MCP23018 port B -#define LEFT_LED_2_SHIFT 6 // in MCP23018 port B -#define LEFT_LED_3_SHIFT 7 // in MCP23018 port A - -extern bool ergodox_left_led_1; // left top -extern bool ergodox_left_led_2; // left middle -extern bool ergodox_left_led_3; // left bottom - -inline void ergodox_board_led_on(void) { DDRD |= (1<<6); PORTD |= (1<<6); } -inline void ergodox_right_led_1_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); } -inline void ergodox_right_led_2_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); } -inline void ergodox_right_led_3_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); } -inline void ergodox_left_led_1_on(void) { ergodox_left_led_1 = 1; } -inline void ergodox_left_led_2_on(void) { ergodox_left_led_2 = 1; } -inline void ergodox_left_led_3_on(void) { ergodox_left_led_3 = 1; } - -inline void ergodox_board_led_off(void) { DDRD &= ~(1<<6); PORTD &= ~(1<<6); } -inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); } -inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); } -inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); } -inline void ergodox_left_led_1_off(void) { ergodox_left_led_1 = 0; } -inline void ergodox_left_led_2_off(void) { ergodox_left_led_2 = 0; } -inline void ergodox_left_led_3_off(void) { ergodox_left_led_3 = 0; } - -inline void ergodox_led_all_on(void) -{ - ergodox_board_led_on(); - ergodox_right_led_1_on(); - ergodox_right_led_2_on(); - ergodox_right_led_3_on(); - ergodox_left_led_1_on(); - ergodox_left_led_2_on(); - ergodox_left_led_3_on(); - ergodox_left_leds_update(); -} - -inline void ergodox_led_all_off(void) -{ - ergodox_board_led_off(); - ergodox_right_led_1_off(); - ergodox_right_led_2_off(); - ergodox_right_led_3_off(); - ergodox_left_led_1_off(); - ergodox_left_led_2_off(); - ergodox_left_led_3_off(); - ergodox_left_leds_update(); -} - -inline void ergodox_right_led_1_set(uint8_t n) { OCR1A = n; } -inline void ergodox_right_led_2_set(uint8_t n) { OCR1B = n; } -inline void ergodox_right_led_3_set(uint8_t n) { OCR1C = n; } - -inline void ergodox_led_all_set(uint8_t n) -{ - ergodox_right_led_1_set(n); - ergodox_right_led_2_set(n); - ergodox_right_led_3_set(n); -} - -#define KEYMAP( \ - \ - /* left hand, spatial positions */ \ - k00,k01,k02,k03,k04,k05,k06, \ - k10,k11,k12,k13,k14,k15,k16, \ - k20,k21,k22,k23,k24,k25, \ - k30,k31,k32,k33,k34,k35,k36, \ - k40,k41,k42,k43,k44, \ - k55,k56, \ - k54, \ - k53,k52,k51, \ - \ - /* right hand, spatial positions */ \ - k07,k08,k09,k0A,k0B,k0C,k0D, \ - k17,k18,k19,k1A,k1B,k1C,k1D, \ - k28,k29,k2A,k2B,k2C,k2D, \ - k37,k38,k39,k3A,k3B,k3C,k3D, \ - k49,k4A,k4B,k4C,k4D, \ - k57,k58, \ - k59, \ - k5C,k5B,k5A ) \ - \ - /* matrix positions */ \ - { \ - { k00, k10, k20, k30, k40, KC_NO }, \ - { k01, k11, k21, k31, k41, k51 }, \ - { k02, k12, k22, k32, k42, k52 }, \ - { k03, k13, k23, k33, k43, k53 }, \ - { k04, k14, k24, k34, k44, k54 }, \ - { k05, k15, k25, k35, KC_NO, k55 }, \ - { k06, k16, KC_NO, k36, KC_NO, k56 }, \ - \ - { k07, k17, KC_NO, k37,KC_NO, k57 }, \ - { k08, k18, k28, k38,KC_NO, k58 }, \ - { k09, k19, k29, k39, k49, k59 }, \ - { k0A, k1A, k2A, k3A, k4A, k5A }, \ - { k0B, k1B, k2B, k3B, k4B, k5B }, \ - { k0C, k1C, k2C, k3C, k4C, k5C }, \ - { k0D, k1D, k2D, k3D, k4D, KC_NO } \ - } - -void * matrix_init_user(void); -void * matrix_scan_user(void); - - - -#endif
\ No newline at end of file diff --git a/keyboard/ergodox/i2cmaster.h b/keyboard/ergodox/i2cmaster.h deleted file mode 100644 index 3917b9e6c0..0000000000 --- a/keyboard/ergodox/i2cmaster.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef _I2CMASTER_H -#define _I2CMASTER_H 1 -/************************************************************************* -* Title: C include file for the I2C master interface -* (i2cmaster.S or twimaster.c) -* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury -* File: $Id: i2cmaster.h,v 1.10 2005/03/06 22:39:57 Peter Exp $ -* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3 -* Target: any AVR device -* Usage: see Doxygen manual -**************************************************************************/ - -#ifdef DOXYGEN -/** - @defgroup pfleury_ic2master I2C Master library - @code #include <i2cmaster.h> @endcode - - @brief I2C (TWI) Master Software Library - - Basic routines for communicating with I2C slave devices. This single master - implementation is limited to one bus master on the I2C bus. - - This I2c library is implemented as a compact assembler software implementation of the I2C protocol - which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c). - Since the API for these two implementations is exactly the same, an application can be linked either against the - software I2C implementation or the hardware I2C implementation. - - Use 4.7k pull-up resistor on the SDA and SCL pin. - - Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module - i2cmaster.S to your target when using the software I2C implementation ! - - Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion. - - @note - The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted - to GNU assembler and AVR-GCC C call interface. - Replaced the incorrect quarter period delays found in AVR300 with - half period delays. - - @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury - - @par API Usage Example - The following code shows typical usage of this library, see example test_i2cmaster.c - - @code - - #include <i2cmaster.h> - - - #define Dev24C02 0xA2 // device address of EEPROM 24C02, see datasheet - - int main(void) - { - unsigned char ret; - - i2c_init(); // initialize I2C library - - // write 0x75 to EEPROM address 5 (Byte Write) - i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode - i2c_write(0x05); // write address = 5 - i2c_write(0x75); // write value 0x75 to EEPROM - i2c_stop(); // set stop conditon = release bus - - - // read previously written value back from EEPROM address 5 - i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode - - i2c_write(0x05); // write address = 5 - i2c_rep_start(Dev24C02+I2C_READ); // set device address and read mode - - ret = i2c_readNak(); // read one byte from EEPROM - i2c_stop(); - - for(;;); - } - @endcode - -*/ -#endif /* DOXYGEN */ - -/**@{*/ - -#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304 -#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !" -#endif - -#include <avr/io.h> - -/** defines the data direction (reading from I2C device) in i2c_start(),i2c_rep_start() */ -#define I2C_READ 1 - -/** defines the data direction (writing to I2C device) in i2c_start(),i2c_rep_start() */ -#define I2C_WRITE 0 - - -/** - @brief initialize the I2C master interace. Need to be called only once - @param void - @return none - */ -extern void i2c_init(void); - - -/** - @brief Terminates the data transfer and releases the I2C bus - @param void - @return none - */ -extern void i2c_stop(void); - - -/** - @brief Issues a start condition and sends address and transfer direction - - @param addr address and transfer direction of I2C device - @retval 0 device accessible - @retval 1 failed to access device - */ -extern unsigned char i2c_start(unsigned char addr); - - -/** - @brief Issues a repeated start condition and sends address and transfer direction - - @param addr address and transfer direction of I2C device - @retval 0 device accessible - @retval 1 failed to access device - */ -extern unsigned char i2c_rep_start(unsigned char addr); - - -/** - @brief Issues a start condition and sends address and transfer direction - - If device is busy, use ack polling to wait until device ready - @param addr address and transfer direction of I2C device - @return none - */ -extern void i2c_start_wait(unsigned char addr); - - -/** - @brief Send one byte to I2C device - @param data byte to be transfered - @retval 0 write successful - @retval 1 write failed - */ -extern unsigned char i2c_write(unsigned char data); - - -/** - @brief read one byte from the I2C device, request more data from device - @return byte read from I2C device - */ -extern unsigned char i2c_readAck(void); - -/** - @brief read one byte from the I2C device, read is followed by a stop condition - @return byte read from I2C device - */ -extern unsigned char i2c_readNak(void); - -/** - @brief read one byte from the I2C device - - Implemented as a macro, which calls either i2c_readAck or i2c_readNak - - @param ack 1 send ack, request more data from device<br> - 0 send nak, read is followed by a stop condition - @return byte read from I2C device - */ -extern unsigned char i2c_read(unsigned char ack); -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); - - -/**@}*/ -#endif diff --git a/keyboard/ergodox/keymaps/keymap_cub.c b/keyboard/ergodox/keymaps/keymap_cub.c deleted file mode 100644 index 6e6d0cd8df..0000000000 --- a/keyboard/ergodox/keymaps/keymap_cub.c +++ /dev/null @@ -1,595 +0,0 @@ -static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* - * Keymap: Default Layer in QWERTY - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | ~ | 1 | 2 | 3 | 4 | 5 | \ | | - | 6 | 7 | 8 | 9 | 0 | = | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | Tab | Q | W | E | R | T | ~L5 | | ~L6 | Y | U | I | O | P | [ | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | Tab/Shf| A | S | D | F | G |------| |------| H | J | K | L | ; | ' | - * |--------+------+------+------+------+------| L0 | | ~L7 |------+------+------+------+------+--------| - * | LCtrl | Z | X | C | V | B | | | | N | M | , | . | / | ] | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | ~L5 | ~L2 | Caps | LAlt | LGui | | Lft | Up | Dn | Rght | ~L6 | - * `----------------------------------' `----------------------------------' - * ,-------------. ,-------------. - * | +L2 | Home | | PgUp | Del | - * ,------|------|------| |------+------+------. - * | | | End | | PgDn | | | - * | BkSp | ESC |------| |------| Enter| Space| - * | | | Spc | | Ins | | | - * `--------------------' `--------------------' - * - * - * - **************************************************************************************************** - * - * Under XOrg, I use my own mapping from QWERTY to "Workman for Programmers" - * See XOrg files in ./addons/ subdirectory. - * - * I have to do so, because of two things: - * 1) my native language is Russian, and XOrg keymap for it is based on QWERTY layout - * 2) I want to have non-standart shifted keys, like $ (as normal) and @ (as shifted), or _ and - - * - * And even if (2) could be solved using FN* keys (but there is limit in firmware for only 32 such - * keys), then (1) can't be solved at firmware level at all. - * - * So, I have to stick with QWERTY as my main layout + my own XOrg keyboard layout for English. - * But sometimes I have to input something when XOrg is not active - for example, in Linux console, - * or in firmware console (while debugging firmware), or when keyboard is connected to not my computer. - * - * For such cases I have Layer1 :) - * // hint: switch to Layer1 is only at Layer6 - * - **************************************************************************************************** - * - * - * - * Keymap: Default Layer in Workman - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | ~ | ; | ! | # | { | } | ' | | ^ | [ | ] | * | ( | ) | = | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | Tab | Q | D | R | W | B | NO | | ~L7 | J | F | U | P | $ | : | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | Tab/Shf| A | S | H | T | G |------| |------| Y | N | E | O | I | - | - * |--------+------+------+------+------+------| Home | | End |------+------+------+------+------+--------| - * | LCtrl | Z | X | M | C | V | | | | K | L | , | . | / | | | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | ~L5 | ~L2 | Caps | LAlt | LGui | | Lft | Up | Dn | Rght | ~L6 | - * `----------------------------------' `----------------------------------' - * ,-------------. ,-------------. - * | L0 | +L2 | | PgUp | Del | - * ,------|------|------| |------+------+------. - * | | | NO | | PgDn | | | - * | BkSp | ESC |------| |------| Enter| Space| - * | | | Spc | | Ins | | | - * `--------------------' `--------------------' - * - * Keymap: Default Layer in Workman / with Shift - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | " | | \ | 6 | 7 | 8 | 9 | 0 | + | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | Tab | Q | D | R | W | B | NO | | ~L7 | J | F | U | P | @ | % | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | Tab/Shf| A | S | H | T | G |------| |------| Y | N | E | O | I | _ | - * |--------+------+------+------+------+------| Home | | End |------+------+------+------+------+--------| - * | LCtrl | Z | X | M | C | V | | | | K | L | , | . | / | & | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | ~L5 | ~L2 | Caps | LAlt | LGui | | Lft | Up | Dn | Rght | ~L6 | - * `----------------------------------' `----------------------------------' - * ,-------------. ,-------------. - * | L0 | +L2 | | PgUp | Del | - * ,------|------|------| |------+------+------. - * | | | NO | | PgDn | | | - * | BkSp | ESC |------| |------| Enter| Space| - * | | | Spc | | Ins | | | - * `--------------------' `--------------------' - * - */ - - KEYMAP( // Layer0: default, leftled:none - // left hand - GRV, 1, 2, 3, 4, 5, BSLS, - FN2, Q, W, E, R, T, FN23, - FN11,FN28,FN29,FN30,FN31,G, - FN12,FN24,FN25,FN26,FN27,B, HOME, - FN21,FN20,CAPS,FN13,FN14, - FN17,FN19, - NO, - FN5, FN6, FN7, - // right hand - MINS,6, 7, 8, 9, 0, EQL, - FN23,Y, U, I, O, P, LBRC, - H, J, K, L, SCLN,FN15, - END, N, M, COMM,DOT, SLSH,FN16, - LEFT,UP, DOWN,RGHT,FN22, - PGUP,DEL, - PGDN, - FN8, FN9, FN10 - ), - - KEYMAP( // Layer1: Workman layout, leftled:all - // left hand - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,Q, D, R, W, B, TRNS, - TRNS,A, S, H, T, G, - TRNS,Z, X, M, C, V, TRNS, - TRNS,TRNS,FN17,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - // right hand - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,J, F, U, P, 4, TRNS, - Y, N, E, O, I, TRNS, - TRNS,K, L, TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS - ), - - KEYMAP( // Layer2: numpad, leftled:mid/blue - // left hand - TRNS,NO, NO, NO, NO, PAUS,PSCR, - TRNS,NO, NO, NO, NO, NO, TRNS, - TRNS,NO, NO, NO, TRNS,NO, - TRNS,NO, NO, NO, TRNS,NO, TRNS, - TRNS,TRNS,FN17,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - // right hand - SLCK,NLCK,PSLS,PAST,PAST,PMNS,BSPC, - TRNS,NO, P7, P8, P9, PMNS,PGUP, - NO, P4, P5, P6, PPLS,PGDN, - TRNS,NO, P1, P2, P3, PPLS,PENT, - P0, PDOT,SLSH,PENT,PENT, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS - ), - - KEYMAP( // Layer3: F-keys + PgUp/PgDn on right hand, leftled:bot/green - // left hand - TRNS,NO, NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, NO, NO, TRNS, - TRNS,NO, TRNS,NO, NO, NO, - TRNS,NO, TRNS,NO, NO, NO, TRNS, - TRNS,TRNS,TRNS,LALT,LGUI, - TRNS,TRNS, - TRNS, - LCTL,LSFT,TRNS, - // right hand - NO, NO, NO, NO, NO, NO, TRNS, - TRNS,NO, F1, F2, F3, F4, PGUP, - NO, F5, F6, F7, F8, PGDN, - TRNS,NO, F9, F10, F11, F12, APP, - RGUI,RALT,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,RSFT,RCTL - ), - - KEYMAP( // Layer4: unconvenient keys on right hand, leftled:top/white - // left hand - TRNS,NO, NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, NO, NO, TRNS, - TRNS,TRNS,NO, NO, NO, NO, - TRNS,TRNS,NO, NO, NO, NO, TRNS, - TRNS,TRNS,TRNS,LALT,LGUI, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - - /* in Workman right hand will be: - { } ( ) + - ^ ! ? = - ' ! $ " ; \ - # [ < > ] \ - */ - - // right hand - NO, NO, 4, 5, 9, 0, PPLS, - TRNS,MINS,2, FN5, 9, 0, EQL, - BSLS,2, P, FN1, 1, FN2, - TRNS,3, 6, FN3, FN4, 7, FN2, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS - ), - - KEYMAP( // Layer5: F-keys instead of numbers, leftled:top/white - // left hand - TRNS,F1, F2, F3, F4, F5, F6, - 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, - // right hand - F7, F8, F9, F10, F11, F12, 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 - ), - - KEYMAP( // Layer6: F-keys + utils(Teensy, Workman-layer switch), leftled:top/white+onboard - // left hand - TRNS,F1, F2, F3, F4, F5, F6, - FN0, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - FN18,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - // right hand - F7, F8, F9, F10, F11, F12, TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,FN0, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS - ), - - // - // rarely used - // - - KEYMAP( // Layer7: F-keys only, leftled:top/white - // left hand - FN0, NO, NO, NO, NO, NO, NO, - FN1, F13, F14, F15, F16, NO, TRNS, - TRNS,F17, F18, F19, F20, NO, - TRNS,F21, F22, F23, F24, NO, TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - // right hand - NO, NO, NO, NO, NO, NO, TRNS, - TRNS,NO, F1, F2, F3, F4, TRNS, - NO, F5, F6, F7, F8, TRNS, - TRNS,NO, F9, F10, F11, F12, TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - SLEP,TRNS,TRNS - ), - - KEYMAP( // Layer8: mouse and navigation, leftled:mid/blue+bot/green - // left hand - TRNS,NO, NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, ACL0,NO, TRNS, - TRNS,NO, NO, TRNS,ACL1,NO, - TRNS,NO, NO, TRNS,ACL2,NO, TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - - // right hand - F16, MPLY,MPRV,MNXT,VOLD,VOLU,MUTE, - F14, BTN2,WH_L,WH_U,WH_D,WH_R,PGUP, - BTN1,MS_L,MS_U,MS_D,MS_R,PGDN, - F15, BTN3,HOME,END, DEL, INS, NO, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS - ), - - KEYMAP( // Layer9: application-specific shortcuts (mostly browser), leftled:top/white+bot/green - // left hand - TRNS,NO, NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, NO, NO, TRNS, - TRNS,NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, TRNS,NO, TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - // right hand - NO, NO, NO, NO, NO, NO, TRNS, - TRNS,NO, FN12,FN13,FN14,FN15,FN10, - FN1, FN2, FN3, FN4, FN5, FN11, - TRNS,TRNS,FN6, FN7, FN8, FN9, FN0, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS - ), - -/* - // templates to copy from - - KEYMAP( // LayerN: transparent on edges + hard-defined thumb keys, all others are empty - // left hand - TRNS,NO, NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, NO, NO, TRNS, - TRNS,NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, NO, NO, TRNS, - TRNS,TRNS,TRNS,LALT,LGUI, - TRNS,TRNS, - TRNS, - LCTL,LSFT,TRNS, - // right hand - NO, NO, NO, NO, NO, NO, TRNS, - TRNS,NO, NO, NO, NO, NO, TRNS, - NO, NO, NO, NO, NO, TRNS, - TRNS,NO, NO, NO, NO, NO, TRNS, - RGUI,RALT,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,RSFT,RCTL - ), - KEYMAP( // LayerN: fully transparent - // left hand - 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, - // right hand - 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 - ), -*/ - -}; - -/* id for user defined functions & macros */ -enum function_id { - TEENSY_KEY, - CUSTOM_KEY, - L_CTRL_ALT_ENT, - R_CTRL_ALT_ENT, -}; - -enum macro_id { - XMONAD_RESET, - PASSWORD1, - PASSWORD2, - PASSWORD3, -}; - -/* - * Fn action definition - */ -static const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key - - [1] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN1 = Shifted BackSlash // " in Workman - [2] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // FN2 = Shifted Minus // \ in Workman - [3] = ACTION_MODS_KEY(MOD_LSFT, KC_COMM), // FN3 = Shifted comma // < in Workman - [4] = ACTION_MODS_KEY(MOD_LSFT, KC_DOT), // FN4 = Shifted dot // > in Workman - - [5] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPC), // FN5 = LShift with tap BackSpace - [6] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_DEL), // FN6 = LCtrl with tap Delete - [7] = ACTION_MODS_TAP_KEY(MOD_LALT, KC_ESC), // FN7 = LAlt with tap Escape - [8] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_INS), // FN8 = RAlt with tap Ins - [9] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), // FN9 = RShift with tap Enter - [10] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_SPC), // FN10 = RCtrl with tap Space - - [11] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_TAB), // FN11 = LShift with tap Tab - [12] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_GRV), // FN12 = LCtrl with tap Tilda - [13] = ACTION_MODS_TAP_KEY(MOD_LALT, KC_SPC), // FN13 = LAlt with tap Space - [14] = ACTION_MODS_TAP_KEY(MOD_LGUI, KC_ESC), // FN14 = LGui with tap Escape - [15] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_QUOT), // FN15 = RShift with tap quotes - [16] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_RBRC), // FN16 = RCtrl with tap ] - - [17] = ACTION_LAYER_SET(0, ON_BOTH), // FN17 - set Layer0 - [18] = ACTION_LAYER_SET(1, ON_BOTH), // FN18 - set Layer1, to use Workman layout at firmware level - [19] = ACTION_LAYER_SET(2, ON_BOTH), // FN19 - set Layer2, to use with Numpad keys - - [21] = ACTION_FUNCTION_TAP(L_CTRL_ALT_ENT), // FN21 - momentary Layer5+CTRL+ALT on Enter, to use with F* keys on top row - [22] = ACTION_FUNCTION_TAP(R_CTRL_ALT_ENT), // FN22 - momentary Layer6+CTRL+ALT on Enter, to use with F* keys on top row + utils - - [28] = ACTION_LAYER_TAP_KEY(4, KC_A), // FN28 = momentary Layer4 on A key, to use with unconvenient keys - [29] = ACTION_LAYER_TAP_KEY(3, KC_S), // FN29 = momentary Layer3 on S key, to use with F* keys - [30] = ACTION_LAYER_TAP_KEY(8, KC_D), // FN30 = momentary Layer8 on D key, to use with mouse and navigation keys - [31] = ACTION_LAYER_TAP_KEY(2, KC_F), // FN31 = momentary Layer2 on F key, to use with Numpad keys - - // i'd like to remove this - will try to get used to live without this and convert them to usual keys - [20] = ACTION_LAYER_MOMENTARY(2), // FN20 - momentary Layer2, to use with Numpad keys -// or -// [20] = ACTION_FUNCTION_TAP(CUSTOM_KEY), // FN20 - use custom key, with tapping support - - [23] = ACTION_LAYER_TAP_KEY(7, KC_BSLS), // FN23 - momentary Layer7 on ' , to use with F* keys (F1-F24) - - [24] = ACTION_LAYER_TAP_KEY(4, KC_Z), // FN24 = momentary Layer4 on Z key, to use with unconvenient keys - [25] = ACTION_LAYER_TAP_KEY(3, KC_X), // FN25 = momentary Layer3 on X key, to use with F* keys - [26] = ACTION_LAYER_TAP_KEY(8, KC_C), // FN26 = momentary Layer8 on C key, to use with mouse and navigation keys - [27] = ACTION_LAYER_TAP_KEY(9, KC_V), // FN27 = momentary Layer9 on V key, to use with application-specific shortcuts -}; - -static const uint16_t PROGMEM fn_actions_4[] = { - [1] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN1 = Shifted BackSlash // " in Workman - [2] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // FN2 = Shifted Minus // \ in Workman - [3] = ACTION_MODS_KEY(MOD_LSFT, KC_COMM), // FN3 = Shifted comma // < in Workman - [4] = ACTION_MODS_KEY(MOD_LSFT, KC_DOT), // FN4 = Shifted dot // > in Workman - [5] = ACTION_MODS_KEY(MOD_LSFT, KC_SLSH), // FN5 = Shifted slash // ? in Workman -}; - -static const uint16_t PROGMEM fn_actions_7[] = { - [0] = ACTION_MACRO(XMONAD_RESET), // FN0 = xmonad-reanimator - [1] = ACTION_MACRO(PASSWORD1), // FN1 = default password - [2] = ACTION_MACRO(PASSWORD1), // FN2 = other password - [3] = ACTION_MACRO(PASSWORD1), // FN3 = mega password -}; - -static const uint16_t PROGMEM fn_actions_9[] = { - [0] = ACTION_MODS_KEY(MOD_LCTL, KC_P0), // FN0 = Ctrl+0 - [1] = ACTION_MODS_KEY(MOD_LALT, KC_P1), // FN1 = Alt+1 - [2] = ACTION_MODS_KEY(MOD_LALT, KC_P2), // FN2 = Alt+2 - [3] = ACTION_MODS_KEY(MOD_LALT, KC_P3), // FN3 = Alt+3 - [4] = ACTION_MODS_KEY(MOD_LALT, KC_P4), // FN4 = Alt+4 - [5] = ACTION_MODS_KEY(MOD_LALT, KC_P5), // FN5 = Alt+5 - [6] = ACTION_MODS_KEY(MOD_LALT, KC_P6), // FN6 = Alt+6 - [7] = ACTION_MODS_KEY(MOD_LALT, KC_P7), // FN7 = Alt+7 - [8] = ACTION_MODS_KEY(MOD_LALT, KC_P8), // FN8 = Alt+8 - [9] = ACTION_MODS_KEY(MOD_LALT, KC_P9), // FN9 = Alt+9 - [10] = ACTION_MODS_KEY(MOD_LCTL|MOD_LSFT, KC_TAB), // FN10 = Ctrl+Shift+Tab - [11] = ACTION_MODS_KEY(MOD_LCTL, KC_TAB), // FN11 = Ctrl+Tab - [12] = ACTION_MODS_KEY(MOD_LCTL|MOD_LSFT, KC_PGUP), // FN12 = Ctrl+Shift+PgUp - [13] = ACTION_MODS_KEY(MOD_LCTL|MOD_LSFT, KC_PGDN), // FN13 = Ctrl+Shift+PgDn - [14] = ACTION_MODS_KEY(MOD_LCTL, KC_PMNS), // FN14 = Ctrl+Pad Minus - [15] = ACTION_MODS_KEY(MOD_LCTL, KC_PPLS), // FN15 = Ctrl+Pad Plus -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - // print("action_function called\n"); - // print("id = "); phex(id); print("\n"); - // print("opt = "); phex(opt); print("\n"); - - if (id == TEENSY_KEY) { - clear_keyboard(); - print("\n\nJump to bootloader... "); - _delay_ms(50); - bootloader_jump(); // should not return - print("not supported.\n"); - } - - if (id == L_CTRL_ALT_ENT || id == R_CTRL_ALT_ENT) { - if (record->tap.count == 0 || record->tap.interrupted) { - uint8_t weak_mods; - uint8_t layer; - - if (id == L_CTRL_ALT_ENT) { - weak_mods = MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT); - layer = 5; - } else { - weak_mods = MOD_BIT(KC_RCTL) | MOD_BIT(KC_RALT); - layer = 6; - } - - if (record->event.pressed) { - layer_on(layer); - add_weak_mods(weak_mods); - } else { - del_weak_mods(weak_mods); - layer_off(layer); - } - } else { - if (record->event.pressed) { - add_key(KC_ENT); - send_keyboard_report(); - } else { - del_key(KC_ENT); - send_keyboard_report(); - } - } - } - - -/* - * just an example of custom key implementation - * not really needed with custom keymap_fn_to_action(), - * because it will allow you to have 32 FN** keys on EACH layer - */ - -/* - keyevent_t event = record->event; - - if (id == CUSTOM_KEY) { - uint8_t layer = biton32(layer_state); - uint8_t col = event.key.col; - uint8_t row = event.key.row; - uint8_t handled = 0; - - if (event.pressed) { - if (layer == XXX && col == XXX && row == XXX) { - action_macro_play( - MACRO( - ........... - END) - ); - handled++; - } - } - } - - if (!handled) { - print("custom key not handled"); - print(": layer "); pdec(layer); - print(", col "); pdec(col); - print(", row "); pdec(row); - print("\n"); - } - } -*/ - -} - -#include "keymap_passwords.h" -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - if (record->event.pressed) { - switch (id) { - case XMONAD_RESET: return MACRO_XMONAD_RESET; - case PASSWORD1: return MACRO_PASSWORD1; - } - } - return MACRO_NONE; -} - -#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0])) -#define FN_ACTIONS_4_SIZE (sizeof(fn_actions_4) / sizeof(fn_actions_4[0])) -#define FN_ACTIONS_7_SIZE (sizeof(fn_actions_7) / sizeof(fn_actions_7[0])) -#define FN_ACTIONS_9_SIZE (sizeof(fn_actions_9) / sizeof(fn_actions_9[0])) - -/* - * translates Fn keycode to action - * for some layers, use different translation table - */ -action_t keymap_fn_to_action(uint8_t keycode) -{ - uint8_t layer = biton32(layer_state); - - action_t action; - action.code = ACTION_NO; - - if (layer == 4 && FN_INDEX(keycode) < FN_ACTIONS_4_SIZE) { - action.code = pgm_read_word(&fn_actions_4[FN_INDEX(keycode)]); - } - - if (layer == 7 && FN_INDEX(keycode) < FN_ACTIONS_7_SIZE) { - action.code = pgm_read_word(&fn_actions_7[FN_INDEX(keycode)]); - } - - if (layer == 9 && FN_INDEX(keycode) < FN_ACTIONS_9_SIZE) { - action.code = pgm_read_word(&fn_actions_9[FN_INDEX(keycode)]); - } - - // by default, use fn_actions from default layer 0 - // this is needed to get mapping for same key, that was used switch to some layer, - // to have possibility to switch layers back - if (action.code == ACTION_NO && FN_INDEX(keycode) < FN_ACTIONS_SIZE) { - action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]); - } - - return action; -} - diff --git a/keyboard/ergodox/keymaps/keymap_default.c b/keyboard/ergodox/keymaps/keymap_default.c deleted file mode 100644 index 51ef6b4106..0000000000 --- a/keyboard/ergodox/keymaps/keymap_default.c +++ /dev/null @@ -1,130 +0,0 @@ -#include "ergodox.h" -#include "debug.h" -#include "action_layer.h" - -#define DEFAULT_LAYER 0 -#define COLEMAK_LAYER 1 -#define DVORAK_LAYER 2 -#define LOWER_LAYER 1 -#define RAISE_LAYER 4 - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[DEFAULT_LAYER] = KEYMAP( // layer 0 : default - // left hand - KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, - KC_BSLS,KC_Q, KC_W, KC_E, KC_R, KC_T, KC_FN2, - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, - KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_FN1, - KC_LGUI,KC_GRV, KC_BSLS,KC_LEFT,KC_RGHT, - KC_LCTL,KC_LALT, - KC_HOME, - KC_BSPC,KC_DEL, KC_END, - // right hand - KC_FN3, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - KC_LBRC,KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RBRC, - KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, - KC_FN1, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, - KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_RGUI, - KC_RALT,KC_RCTL, - KC_PGUP, - KC_PGDN,KC_ENT, KC_SPC - ), -[LOWER_LAYER] = KEYMAP( // layer 0 : default - // left hand - KC_EQL, KC_1, KC_2, KC_3, LALT(KC_TAB), KC_5, KC_ESC, - KC_BSLS,KC_Q, S(KC_W), KC_E, KC_R, KC_T, KC_FN2, - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, - KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_FN1, - KC_LGUI,KC_GRV, KC_BSLS,KC_LEFT,KC_RGHT, - KC_LCTL,KC_LALT, - KC_HOME, - KC_BSPC,KC_DEL, KC_END, - // right hand - KC_FN3, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - KC_LBRC,KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RBRC, - KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, - KC_FN1, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, - KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_RGUI, - KC_RALT,KC_RCTL, - KC_PGUP, - KC_PGDN,KC_ENT, KC_SPC - ) -}; - -const uint16_t PROGMEM fn_actions[] = { - - [1] = ACTION_LAYER_MOMENTARY(LOWER_LAYER), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(LOWER_LAYER), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(DEFAULT_LAYER), - [4] = ACTION_DEFAULT_LAYER_SET(COLEMAK_LAYER), - [5] = ACTION_DEFAULT_LAYER_SET(DVORAK_LAYER), -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - // MACRODOWN only works in this function - switch(id) { - case 0: - if (record->event.pressed) { - register_code(KC_RSFT); - } else { - unregister_code(KC_RSFT); - } - break; - } - return MACRO_NONE; -}; - - -void * matrix_init_user(void) { - -}; - -void * matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); - - ergodox_board_led_off(); - ergodox_left_led_1_off(); - ergodox_left_led_2_off(); - ergodox_left_led_3_off(); - switch (layer) { - case 1: - // all - ergodox_left_led_1_on(); - ergodox_left_led_2_on(); - ergodox_left_led_3_on(); - break; - case 2: - // blue - ergodox_left_led_2_on(); - break; - case 8: - // blue and green - ergodox_left_led_2_on(); - // break missed intentionally - case 3: - // green - ergodox_left_led_3_on(); - break; - case 6: - ergodox_board_led_on(); - // break missed intentionally - case 4: - case 5: - case 7: - // white - ergodox_left_led_1_on(); - break; - case 9: - // white+green - ergodox_left_led_1_on(); - ergodox_left_led_3_on(); - break; - default: - // none - break; - } - - mcp23018_status = ergodox_left_leds_update(); -}; diff --git a/keyboard/ergodox/keymaps/keymap_ergodox_ez.c b/keyboard/ergodox/keymaps/keymap_ergodox_ez.c deleted file mode 100644 index 84a17abddb..0000000000 --- a/keyboard/ergodox/keymaps/keymap_ergodox_ez.c +++ /dev/null @@ -1,210 +0,0 @@ -#include "action_util.h" -#include "action_layer.h" -#define KC_SW0 KC_FN0 -#define DEBUG_ACTION - -static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - /* Keymap 0: Basic layer - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | Del | Q | W | E | R | T | Up | | Up | Y | U | I | O | P | \ | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2| ' | - * |--------+------+------+------+------+------| L1 | | L1 |------+------+------+------+------+--------| - * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * |Grv/L1| ~L1 | TAB | Left | Right| | Up | Down | [ | ] | ~L1 | - * `----------------------------------' `----------------------------------' - * ,-------------. ,-------------. - * | Rclk | LGui | | Alt |Ctrl/Esc| - * ,------|------|------| |------+--------+------. - * | | | Home | | PgUp | | | - * | Space| Enter|------| |------| Tab |Enter | - * | | | End | | PgDn | | | - * `--------------------' `----------------------' - */ - - - // Basic layer - - KEYMAP( - EQL, 1, 2, 3, 4, 5, LEFT, - DEL, Q, W, E, R, T, UP, - BSPC, A, S, D, F, G, - LSFT, FN29, X, C, V, B, FN1, - FN30, FN4, TAB, LEFT, RIGHT, - - BTN2,LGUI, - HOME, - SPC, ENT, END, - //RIGHT - RIGHT,6, 7, 8, 9, 0, MINS, - UP, Y, U, I, O, P, BSLS, - H, J, K, L, FN31, QUOT, - FN1, N, M, COMM, DOT, FN28, RSFT, - UP, DOWN, LBRC, RBRC, FN4, - LALT, FN27, - PGUP, - PGDN, TAB, ENT - ), - - /* Keymap 1: Symbol Layer - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | Flash | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | : | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | | | | | | | | . | 0 | = | | - * `----------------------------------' `----------------------------------' - * ,-------------. ,-------------. - * | | | | | | - * ,------|------|------| |------+------+------. - * | | | | | | | | - * | | |------| |------| | | - * | | | | | | | | - * `--------------------' `--------------------' - */ - // SYMBOLS - KEYMAP( - FN0, F1, F2, F3, F4, F5, TRNS, - TRNS, FN7, FN8, FN23, FN24, FN18, TRNS, - FN22, FN9, FN10, FN15, FN16, GRV, - TRNS, FN11, FN12, LBRC, RBRC, FN17, TRNS, - TRNS, TRNS, TRNS, TRNS, TRNS, - - TRNS, TRNS, - TRNS, - TRNS, TRNS, TRNS, - // right hand - TRNS, F6, F7, F8, F9, F10, F11, - TRNS, UP, 7, 8, 9, FN14, F12, - DOWN, 4, 5, 6, FN26, TRNS, - TRNS, FN13, 1, 2, 3, BSLS, TRNS, - TRNS,DOT, 0, EQL, TRNS, - TRNS, TRNS, - TRNS, - TRNS, TRNS, TRNS - ), - /* Keymap 2: Media and mouse keys - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | | | | | | | | | | | | | | | | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | | | MsUp | | | | | | | | | | | | | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | |MsLeft|MsDown|MsRght| | |------| |------| | | | Play | | | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | | | | | | | | | | | Prev | Next | | | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | | | | Lclk | Rclk | |VolUp |VolDn | | | | - * `----------------------------------' `----------------------------------' - * ,-------------. ,-------------. - * | | | | | | - * ,------|------|------| |------+------+------. - * | | | | | | | | - * | | |------| |------| | | - * | | | | | | | | - * `--------------------' `--------------------' - */ - // MEDIA AND MOUSE - KEYMAP( - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, - TRNS, TRNS, MS_U, TRNS, TRNS, TRNS, TRNS, - TRNS, MS_L, MS_D, MS_R, TRNS, TRNS, - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, - TRNS, TRNS, TRNS, BTN3, BTN2, - - TRNS, TRNS, - TRNS, - TRNS, TRNS, TRNS, - // right hand - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, - TRNS, TRNS, TRNS, MPLY, TRNS, TRNS, - TRNS, TRNS, TRNS, MPRV, MNXT, TRNS, TRNS, - VOLU, VOLD, TRNS, TRNS, TRNS, - TRNS, TRNS, - TRNS, - TRNS, TRNS, WBAK - ), -}; - -/* id for user defined functions */ -enum function_id { - TEENSY_KEY, -}; - -/* - * Fn action definition - */ -static const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key - [1] = ACTION_LAYER_INVERT(1, ON_RELEASE), // FN1 - Toggle 1 - [2] = ACTION_LAYER_TOGGLE(2), // FN2 - Toggle 2 - [3] = ACTION_LAYER_TOGGLE(3), // FN3 - Toggle 3 - [4] = ACTION_LAYER_TAP_TOGGLE(1), // FN4 - Momentary Layer 1 - [5] = ACTION_LAYER_MOMENTARY(2), // FN5 - Momentary L2 - - // SYMBOLS - ACTION_MODS_KEY(MOD_LSFT, KC_QUOT), // FN6 - " - ACTION_MODS_KEY(MOD_LSFT, KC_1), // FN7 - ! - ACTION_MODS_KEY(MOD_LSFT, KC_2), // FN8 - @ - ACTION_MODS_KEY(MOD_LSFT, KC_3), // FN9 - # - ACTION_MODS_KEY(MOD_LSFT, KC_4), // FN10 - $ - ACTION_MODS_KEY(MOD_LSFT, KC_5), // FN11 - % - ACTION_MODS_KEY(MOD_LSFT, KC_6), // FN12 - ^ - ACTION_MODS_KEY(MOD_LSFT, KC_7), // FN13 - & - ACTION_MODS_KEY(MOD_LSFT, KC_8), // FN14 - * - ACTION_MODS_KEY(MOD_LSFT, KC_9), // FN15 - ( - ACTION_MODS_KEY(MOD_LSFT, KC_0), // FN16 - ) - ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // FN17 - ~ - ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN18 - | - ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // FN19 - _ - ACTION_MODS_KEY(MOD_LSFT, KC_COMM), // FN20 - < - ACTION_MODS_KEY(MOD_LSFT, KC_DOT), // FN21 - > - ACTION_MODS_KEY(MOD_LSFT, KC_SCLN), // FN22 - : - ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), // FN23 - { - ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), // FN24 - } - ACTION_MODS_KEY(MOD_LSFT, KC_SLSH), // FN25 - ? - ACTION_MODS_KEY(MOD_LSFT, KC_EQL), // FN26 - + - - ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), // FN27 - Control/esc on tap - ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SLSH), // FN28 - slash becomes Ctrl when held (right pinky) - ACTION_MODS_TAP_KEY(MOD_LCTL, KC_Z), // FN29 - z becomes Ctrl when held (left pinky) - - // Fancy tapping/toggling - ACTION_LAYER_TAP_KEY(1, KC_GRV), // FN30 - Layer 1 when holding backtick key - ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN31 - Layer 2 when holding semicolon key - - -}; - -void action_function(keyrecord_t *event, uint8_t id, uint8_t opt) -{ - print("action_function called\n"); - print("id = "); phex(id); print("\n"); - print("opt = "); phex(opt); print("\n"); - if (id == TEENSY_KEY) { - clear_keyboard(); - print("\n\nJump to bootloader... "); - _delay_ms(250); - bootloader_jump(); // should not return - print("not supported.\n"); - } -} - -void * matrix_init_user(void) { - -}; - -void * matrix_scan_user(void) { - -}; diff --git a/keyboard/ergodox/keymaps/keymap_passwords_example.h b/keyboard/ergodox/keymaps/keymap_passwords_example.h deleted file mode 100644 index ed53b99d87..0000000000 --- a/keyboard/ergodox/keymaps/keymap_passwords_example.h +++ /dev/null @@ -1,23 +0,0 @@ -#define MACRO_XMONAD_RESET MACRO( \ - I(15), \ - D(LCTL), D(LALT), T(F2), W(255), U(LALT), U(LCTL), W(255), \ - T(X), T(M), T(O), T(N), T(UP), T(ENT), W(255), \ - D(LCTL), D(LALT), T(F5), W(255), U(LALT), U(LCTL), W(255), \ - END) \ - -#define MACRO_PASSWORD1 MACRO( \ - I(15), \ - T(E), T(X), T(A), T(M), T(P), T(L), T(E), \ - END) \ - -#define MACRO_PASSWORD2 MACRO( \ - I(15), \ - T(E), T(X), T(A), T(M), T(P), T(L), T(E), \ - END) \ - -#define MACRO_PASSWORD2 MACRO( \ - I(15), \ - T(E), T(X), T(A), T(M), T(P), T(L), T(E), \ - END) \ - - diff --git a/keyboard/ergodox/keymaps/keymap_simon.c b/keyboard/ergodox/keymaps/keymap_simon.c deleted file mode 100644 index 525c2d6019..0000000000 --- a/keyboard/ergodox/keymaps/keymap_simon.c +++ /dev/null @@ -1,624 +0,0 @@ -#include "action_util.h" -#include "action_layer.h" -#define KC_SW0 KC_FN0 -#define DEBUG_ACTION - -static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Keymap 0: Default Layer - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | ~ | 1 | 2 | 3 | 4 | 5 | \ | | ' | 6 | 7 | 8 | 9 | 0 | = | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | Tab | Q | W | E | R | T | ~Fn1 | | ~Fn3 | Y | U | I | O | P | [ | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | LShift | A | S | D | F | G |------| |------| H | J | K | L | ; | RShift | - * |--------+------+------+------+------+------| Fn0 | | ~Fn4 |------+------+------+------+------+--------| - * | LCtrl | Z | X | C | V | B | | | | N | M | , | . | / | RCtrl | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | ~Fn1 | ~Fn2 | Caps | LAlt | LGui | | Lft | Up | Dn | Rght | ~Fn4 | - * `----------------------------------' `----------------------------------' - * ,-------------. ,-------------. - * | +Fn2 | Home | | PgUp | Del | - * ,------|------|------| |------+------+------. - * | | | End | | PgDn | | | - * | BkSp | ESC |------| |------| Enter| Space| - * | | | Spc | | Ins | | | - * `--------------------' `--------------------' - */ - - // BASE LAYERS - - KEYMAP( // layout: layer 0: customized dvorak with symbol row switched - // left hand - ESC, FN12,FN12,FN12,FN12,FN12,BSLS, - TAB, QUOT,COMM,DOT, P, Y, FN2, - LSFT,A, O, E, U, I, - LCTL,SCLN,Q, J, K, X, DEL, - FN3, FN1, LCTL,LALT,LGUI, - FN5, HOME, - END, - BSPC,LSFT,LGUI, - // right hand - MINS,FN12,FN12,FN12,FN12,FN12,MPLY, - FN3, F, G, C, R, L, MNXT, - D, H, T, N, S, RSFT, - DEL, B, M, W, V, Z, RCTL, - MPRV,MNXT,APP, FN8,FN2, - PGUP,MPLY, - PGDN, - ENT, FN1, SPC - ), - - KEYMAP( // layout: layer 1: customized dvorak - // left hand - ESC, 1, 2, 3, 4, 5, BSLS, - TAB, QUOT,COMM,DOT, P, Y, FN2, - LSFT,A, O, E, U, I, - LCTL,SCLN,Q, J, K, X, DEL, - FN3, FN1, LCTL,LALT,LGUI, - FN5, HOME, - END, - BSPC,LSFT,LGUI, - // right hand - MINS,6, 7, 8, 9, 0, EQL, - FN3, F, G, C, R, L, SLSH, - D, H, T, N, S, RSFT, - DEL, B, M, W, V, Z, RCTL, - LEFT,DOWN,UP, RGHT,FN2, - PGUP,MPLY, - PGDN, - ENT, FN1, SPC - ), - - KEYMAP( // layer 2 : qwerty - // left hand - TRNS,1, 2, 3, 4, 5, TRNS, - TRNS,Q, W, E, R, T, TRNS, - TRNS,A, S, D, F, G, - TRNS,Z, X, C, V, B, TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - // right hand - TRNS,6, 7, 8, 9, 0, MINS, - TRNS,Y, U, I, O, P, RBRC, - H, J, K, L, SCLN,RSFT, - TRNS,N, M, COMM,DOT, SLSH,RSFT, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS - ), - - KEYMAP( // layer 3 : reserved - // left hand - TRNS,1, 2, 3, 4, 5, TRNS, - TRNS,Q, W, E, R, T, TRNS, - TRNS,A, S, D, F, G, - TRNS,Z, X, C, V, B, TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - // right hand - TRNS,6, 7, 8, 9, 0, MINS, - TRNS,Y, U, I, O, P, RBRC, - H, J, K, L, SCLN,QUOT, - TRNS,N, M, COMM,DOT, SLSH,RSFT, - TRNS,TRNS,TRNS,TRNS,TRNS, - RALT,RCTL, - PGUP, - PGDN,ENT, SPC - ), - - // PLOVER (SPECIAL CASE) - - KEYMAP( // layout: layer 4: Steno for Plover - // left hand - FN5, NO, NO, NO, NO, NO, NO, - NO, 1, 2, 3, 4, 5, NO, - NO, Q, W, E, R, T, - NO, A, S, D, F, G, NO, - NO, NO, NO, NO, NO, - FN5, NO, - NO, - C, V, NO, - // right hand - NO, NO, NO, NO, NO, NO, TRNS, - NO, 6, 7, 8, 9, 0, TRNS, - Y, U, I, O, P, LBRC, - NO, H, J, K, L, SCLN,QUOT, - TRNS,TRNS,NO, NO, NO, - TRNS,TRNS, - TRNS, - NO, N, M - ), - - KEYMAP( // layout: layer 5: reserved - // left hand - 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, - // right hand - 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 - ), - - // MODIFIERS THAT MIGHT BE STICKY - - KEYMAP( // layout: layer 6: mouse + numpad - // left hand - FN0, NO, NO, NO, NO, PAUS,PSCR, - TRNS,NO, WH_U,MS_U,WH_D,BTN2,TRNS, - TRNS,NO, MS_L,MS_D,MS_R,BTN1, - TRNS,NO, NO, NO, NO, BTN3,TRNS, - TRNS,FN13,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS, - // right hand - SLCK,NLCK,EQL, PSLS,PAST,PMNS,TRNS, - TRNS,NO, P7, P8, P9, PMNS,BSPC, - NO, P4, P5, P6, PPLS,PENT, - TRNS,NO, P1, P2, P3, PPLS,PENT, - P0, PDOT,PDOT,PENT,PENT, - TRNS,TRNS, - TRNS, - ENT, TRNS,BSPC - ), - - KEYMAP( // layout: layer 7: F-keys + cursor - // left hand - FN0, F1, F2, F3, F4, F5, F6, - FN4, NO, PGUP,UP, PGDN,NO, TRNS, - TRNS,HOME,LEFT,DOWN,RGHT,END, - TRNS,NO, NO, END, HOME,NO, TRNS, - TRNS,TRNS,TRNS,FN10,FN11, - TRNS,TRNS, - TRNS, - LCTL,LSFT,TRNS, - // right hand - F7, F8, F9, F10, F11, F12, MINS, - TRNS,NO, PGUP,UP, PGDN, NO, FN4, - HOME,LEFT,DOWN,RGHT,END, TRNS, - TRNS,NO, NO, NO, NO, NO, TRNS, - RGUI,RALT,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, TRNS,RSFT,RCTL - ), - - KEYMAP( // layout: layer 8: "BlueShift" - // left hand - FN0, F1, F2, F3, F4, F5, F6, - TRNS,GRV, FN12,FN12,PSCR,BSLS,TRNS, // the FN12 entries are for inverted brace/bracket keys - TRNS,APP, TAB, EQL, TRNS,INS, - TRNS,TRNS,FN8, TRNS,CAPS,TRNS,TRNS, // quit (alt+f4) - FN13,TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - ESC, TRNS,TRNS, - // right hand - F7, F8, F9, F10, F11, F12, MINS, - TRNS,PGUP,HOME,UP, END, SLSH,RBRC, - PGDN,LEFT,DOWN,RGHT,MINS,TRNS, - TRNS,TRNS,NO, UP, NO, TRNS,TRNS, - LEFT,DOWN,RGHT,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,TRNS,TRNS - ), - - KEYMAP( // layout: layer 9: reserved - // left hand - 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, - // right hand - 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 - ), - - KEYMAP( // layout: layer 10: reserved - // left hand - 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, - // right hand - 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 - ), - - // MODIFIERS THAT WON'T BE STICKY - - KEYMAP( // layout: layer 11: Special function-driven commands (any-key) - // left hand - FN8, FN8, FN8, FN8, FN8, FN8, FN8, - FN8, FN8, FN8, FN8, FN8, FN8, FN8, - LSFT,FN8, FN8, FN8, FN8, FN8, - FN8, FN8, FN8, FN8, FN8, FN8, FN8, - FN8, FN8, FN8, FN8, FN8, - FN8, FN8, - FN8, - FN8, FN10,FN8, - // right hand - FN8, FN8, FN8, FN8, FN8, FN8, FN8, - FN8, FN8, FN8, FN8, FN8, FN8, FN8, - FN8, FN8, FN8, FN8, FN8, RSFT, - FN8, FN8, FN8, FN8, FN8, FN8, FN8, - FN8, FN8, FN8, FN8, FN8, - FN8, FN8, - FN8, - FN8, FN8, FN8 - ), - - KEYMAP( // layout: layer 12: F-keys only - // left hand - FN0, NO, NO, NO, NO, NO, NO, - TRNS,F13, F14, F15, F16, NO, TRNS, - TRNS,F17, F18, F19, F20, NO, - TRNS,F21, F22, F23, F24, NO, TRNS, - FN13,FN13,TRNS,LALT,LGUI, - TRNS,TRNS, - TRNS, - LCTL,LSFT,TRNS, - // right hand - NO, NO, F10, F11, F12, NO, TRNS, - TRNS,NO, F7, F8, F9, NO, TRNS, - NO, F4, F5, F6, NO, TRNS, - TRNS,NO, F1, F2, F3, NO, TRNS, - RGUI,RALT,RCTL,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,RSFT,RCTL - ), - - KEYMAP( // layout: layer 13: reserved - // left hand - 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, - // right hand - 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 - ), - - KEYMAP( // layout: layer 14: reserved - // left hand - 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, - // right hand - 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 - ), - - // TEMPLATES - -/* - KEYMAP( // layout: layer N: transparent on edges, all others are empty - // left hand - TRNS,NO, NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, NO, NO, TRNS, - TRNS,NO, NO, NO, NO, NO, - TRNS,NO, NO, NO, NO, NO, TRNS, - TRNS,TRNS,TRNS,LALT,LGUI, - TRNS,TRNS, - TRNS, - LCTL,LSFT,TRNS, - // right hand - NO, NO, NO, NO, NO, NO, TRNS, - TRNS,NO, NO, NO, NO, NO, TRNS, - NO, NO, NO, NO, NO, TRNS, - TRNS,NO, NO, NO, NO, NO, TRNS, - RGUI,RALT,TRNS,TRNS,TRNS, - TRNS,TRNS, - TRNS, - TRNS,RSFT,RCTL - ), - KEYMAP( // layout: layer N: fully transparent - // left hand - 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, - // right hand - 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 - ), -*/ - -}; - -/* id for user defined functions */ -enum function_id { - TEENSY_KEY, - ANY_KEY, - PLOVER_SWITCH, - SHIFT_SWITCH, - FKEY_SWITCH, -}; - -enum macro_id { - MACRO_PASSWORD1, - MACRO_PASSWORD2, - MACRO_PASSWORD3, -}; - -/* - * Fn action definition - */ -static const uint16_t PROGMEM fn_actions[] = { - ACTION_LAYER_SET(0, ON_PRESS), // FN0 - set layer0 only - ACTION_LAYER_TAP_TOGGLE(8), // FN1 - switch to BlueShift - ACTION_LAYER_TAP_TOGGLE(7), // FN2 - movement tap/toggle - ACTION_LAYER_TAP_TOGGLE(6), // FN3 - numpad - ACTION_FUNCTION(TEENSY_KEY), // FN4 - Teensy key - ACTION_FUNCTION(PLOVER_SWITCH), // FN5 - enable Plover - ACTION_FUNCTION(PLOVER_SWITCH), // ** FN6 - suspend Plover (OUT OF USE) - ACTION_LAYER_MOMENTARY(11), // FN7 - Trigger the AnyKey layer - ACTION_FUNCTION(ANY_KEY), // FN8 - AnyKey functional layer - ACTION_MODS_TAP_TOGGLE(MOD_LSFT), // ** FN9 - tap toggle shift (OUT OF USE) - ACTION_MACRO(MACRO_PASSWORD1), // FN10 - password1 - ACTION_MACRO(MACRO_PASSWORD2), // FN11 - password2 - ACTION_FUNCTION(SHIFT_SWITCH), // FN12 - symbolized number row - ACTION_FUNCTION(FKEY_SWITCH), // FN13 - trigger Fkey layer and get rid of it appropriately -}; - -void simon_hotkey(keyrecord_t *record, action_t action) -{ - keyevent_t event = record->event; - - switch (action.kind.id) { - /* Key and Mods */ - case ACT_LMODS: - case ACT_RMODS: - { - uint8_t mods = (action.kind.id == ACT_LMODS) ? action.key.mods : - action.key.mods<<4; - if (event.pressed) { - if (mods) { - add_weak_mods(mods); - send_keyboard_report(); - } - register_code(action.key.code); - } else { - unregister_code(action.key.code); - if (mods) { - del_weak_mods(mods); - send_keyboard_report(); - } - } - } - break; - default: - print("not supported.\n"); - break; - } -} - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - keyevent_t event = record->event; - - // print("action_function called\n"); - // print("id = "); phex(id); print("\n"); - // print("opt = "); phex(opt); print("\n"); - if (id == TEENSY_KEY) { - clear_keyboard(); - print("\n\nJump to bootloader... "); - _delay_ms(250); - bootloader_jump(); // should not return - print("not supported.\n"); - } - else if (id == PLOVER_SWITCH) { - if (event.pressed) { - if (layer_state & 1<<4) { // plover is already on - print("switching off plover layout...\n"); - action_macro_play(MACRO( D(A), D(W), D(P), D(F), D(SCLN), D(LBRC), D(QUOT), D(D), D(A), D(L), U(W), U(P), U(F), U(SCLN), U(LBRC), U(QUOT), U(D), U(L), END)); - layer_off(4); - } else { - print("switching on plover layout...\n"); - action_macro_play(MACRO(D(LANG5), U(LANG5), D(W), D(P), D(F), D(SCLN), D(LBRC), D(QUOT), D(D), D(A), U(W), U(P), U(F), U(SCLN), U(LBRC), U(QUOT), U(D), END)); - layer_on(4); - } - } - } - else if (id == ANY_KEY) { - uint8_t col = event.key.col; - uint8_t row = event.key.row; - - action_t action = { .code = ACTION_NO }; - - if (col == 3 && row == 2) { // Q - action.code = ACTION_MODS_KEY(MOD_LALT, KC_F4); - } - if (col == 3 && row == 10) { // W - action.code = ACTION_MODS_KEY(MOD_LALT, KC_F4); - } - if (col == 4 && row == 12) { // Alt+tab - action.code = ACTION_MODS_KEY(MOD_LALT, KC_TAB); - } - if (action.code != ACTION_NO) { - simon_hotkey(record, action); - } - else - { - print("col = "); pdec(col); print("\n"); - print("row = "); pdec(row); print("\n"); - } - } - else if (id == SHIFT_SWITCH) { - uint8_t col = event.key.col; - uint8_t row = event.key.row; - uint8_t savedmods = get_mods(); - uint8_t shiftpressed = (savedmods & (MOD_LSFT | MOD_RSFT)); - uint8_t othermodspressed = (savedmods & (MOD_LGUI | MOD_RGUI | MOD_LCTL | MOD_RCTL | MOD_LALT | MOD_RALT )); - - action_t action = { .code = ACTION_NO }; - uint8_t keycode = KC_NO; - - if (col == 0) { // Number row - switch (row) { - case 1: - keycode = KC_1; - break; - case 2: - keycode = KC_2; - break; - case 3: - keycode = KC_3; - break; - case 4: - keycode = KC_4; - break; - case 5: - keycode = KC_5; - break; - case 8: - keycode = KC_6; - break; - case 9: - keycode = KC_7; - break; - case 10: - keycode = KC_8; - break; - case 11: - keycode = KC_9; - break; - case 12: - keycode = KC_0; - break; - default: - break; - } - } - if (col == 1) { // next row - switch (row) { - case 2: - keycode = KC_LBRC; - break; - case 3: - keycode = KC_RBRC; - break; - default: - break; - } - } - if (keycode != KC_NO) { - action.code = ACTION_MODS_KEY(MOD_LSFT, keycode); - } - if (action.code != ACTION_NO) { - if (othermodspressed) { - action.key.mods = 0; - } - else if (shiftpressed) { - action.key.mods = 0; - del_mods(MOD_LSFT | MOD_RSFT); - } - simon_hotkey(record, action); - if (shiftpressed) { - set_mods(savedmods); - } - } - } - else if (id == FKEY_SWITCH) { - uint8_t row = event.key.row; - if (event.pressed) { - layer_on(12); - } - else { - if ((row == 0) && (layer_state & 1<<6)) { // left button and from numpad; out-of-order release - layer_off(6); - } - else if ((row == 1) && (layer_state & 1<<8)) { // right button and from BlueShift; out-of-order release - layer_off(8); - } - else { - layer_off(12); - } - } - } -} - -/* - * Macro definition - */ -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - keyevent_t event = record->event; - - if (event.pressed) { - switch (id) { -#include "keymap_simon_passwords.h" - } - } - return MACRO_NONE; -} - diff --git a/keyboard/ergodox/keymaps/keymap_simon_passwords.example.h b/keyboard/ergodox/keymaps/keymap_simon_passwords.example.h deleted file mode 100644 index ef67d1d2e3..0000000000 --- a/keyboard/ergodox/keymaps/keymap_simon_passwords.example.h +++ /dev/null @@ -1,2 +0,0 @@ -case MACRO_PASSWORD1: - return MACRO( D(LSFT), D(H), U(H), U(LSFT), D(E), U(E), D(L), U(L), D(L), U(L), D(O), U(O), D(DOT), U(DOT), D(W), U(W), D(O), U(O), D(R), U(R), D(L), U(L), D(D), U(D), D(ENTER), U(ENTER), END); // types "Hello.world{ENTER}" diff --git a/keyboard/ergodox/matrix.c b/keyboard/ergodox/matrix.c deleted file mode 100644 index cc10e29410..0000000000 --- a/keyboard/ergodox/matrix.c +++ /dev/null @@ -1,405 +0,0 @@ -/* -Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com> - -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 "action_layer.h" -#include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" -#include "ergodox.h" -#include "i2cmaster.h" -#ifdef DEBUG_MATRIX_SCAN_RATE -#include "timer.h" -#endif - -#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]; - -static matrix_row_t read_cols(uint8_t row); -static void init_cols(void); -static void unselect_rows(); -static void select_row(uint8_t row); - -static uint8_t mcp23018_reset_loop; - -#ifdef DEBUG_MATRIX_SCAN_RATE -uint32_t matrix_timer; -uint32_t matrix_scan_count; -#endif - - -__attribute__ ((weak)) -void * matrix_init_kb(void) { -}; - -__attribute__ ((weak)) -void * matrix_scan_kb(void) { -}; - -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - // initialize row and col - - mcp23018_status = init_mcp23018(); - - - 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; - } - -#ifdef DEBUG_MATRIX_SCAN_RATE - matrix_timer = timer_read32(); - matrix_scan_count = 0; -#endif - - if (matrix_init_kb) { - (*matrix_init_kb)(); - } - -} - -uint8_t matrix_scan(void) -{ - if (mcp23018_status) { // if there was an error - if (++mcp23018_reset_loop == 0) { - // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans - // this will be approx bit more frequent than once per second - print("trying to reset mcp23018\n"); - mcp23018_status = init_mcp23018(); - if (mcp23018_status) { - print("left side not responding\n"); - } else { - print("left side attached\n"); - ergodox_blink_all_leds(); - } - } - } - -#ifdef DEBUG_MATRIX_SCAN_RATE - matrix_scan_count++; - - uint32_t timer_now = timer_read32(); - if (TIMER_DIFF_32(timer_now, matrix_timer)>1000) { - print("matrix scan frequency: "); - pdec(matrix_scan_count); - print("\n"); - - matrix_timer = timer_now; - matrix_scan_count = 0; - } -#endif - -#ifdef KEYMAP_CUB - uint8_t layer = biton32(layer_state); - - ergodox_board_led_off(); - ergodox_left_led_1_off(); - ergodox_left_led_2_off(); - ergodox_left_led_3_off(); - switch (layer) { - case 1: - // all - ergodox_left_led_1_on(); - ergodox_left_led_2_on(); - ergodox_left_led_3_on(); - break; - case 2: - // blue - ergodox_left_led_2_on(); - break; - case 8: - // blue and green - ergodox_left_led_2_on(); - // break missed intentionally - case 3: - // green - ergodox_left_led_3_on(); - break; - case 6: - ergodox_board_led_on(); - // break missed intentionally - case 4: - case 5: - case 7: - // white - ergodox_left_led_1_on(); - break; - case 9: - // white+green - ergodox_left_led_1_on(); - ergodox_left_led_3_on(); - break; - default: - // none - break; - } - - mcp23018_status = ergodox_left_leds_update(); -#endif - -#ifdef KEYMAP_SIMON - uint8_t layer = biton32(layer_state); - - ergodox_board_led_off(); - switch (layer) { - case 0: -// none - - break; - default: - ergodox_board_led_on(); - break; - } -#endif - - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - select_row(i); - matrix_row_t cols = read_cols(i); - 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]; - } - } - } - - - if (matrix_scan_kb) { - (*matrix_scan_kb)(); - } - - 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; -} - -/* Column pin configuration - * - * Teensy - * col: 0 1 2 3 4 5 - * pin: F0 F1 F4 F5 F6 F7 - * - * MCP23018 - * col: 0 1 2 3 4 5 - * pin: B5 B4 B3 B2 B1 B0 - */ -static void init_cols(void) -{ - // init on mcp23018 - // not needed, already done as part of init_mcp23018() - - // init on teensy - // Input with pull-up(DDR:0, PORT:1) - DDRF &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0); - PORTF |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0); -} - -static matrix_row_t read_cols(uint8_t row) -{ - if (row < 7) { - if (mcp23018_status) { // if there was an error - return 0; - } else { - uint8_t data = 0; - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPIOB); if (mcp23018_status) goto out; - mcp23018_status = i2c_start(I2C_ADDR_READ); if (mcp23018_status) goto out; - data = i2c_readNak(); - data = ~data; - out: - i2c_stop(); - return data; - } - } else { - _delay_us(30); // without this wait read unstable value. - // read from teensy - return - (PINF&(1<<0) ? 0 : (1<<0)) | - (PINF&(1<<1) ? 0 : (1<<1)) | - (PINF&(1<<4) ? 0 : (1<<2)) | - (PINF&(1<<5) ? 0 : (1<<3)) | - (PINF&(1<<6) ? 0 : (1<<4)) | - (PINF&(1<<7) ? 0 : (1<<5)) ; - } -} - -/* Row pin configuration - * - * Teensy - * row: 7 8 9 10 11 12 13 - * pin: B0 B1 B2 B3 D2 D3 C6 - * - * MCP23018 - * row: 0 1 2 3 4 5 6 - * pin: A0 A1 A2 A3 A4 A5 A6 - */ -static void unselect_rows(void) -{ - // unselect on mcp23018 - if (mcp23018_status) { // if there was an error - // do nothing - } else { - // set all rows hi-Z : 1 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPIOA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write( 0xFF - & ~(ergodox_left_led_3<<LEFT_LED_3_SHIFT) - ); if (mcp23018_status) goto out; - out: - i2c_stop(); - } - - // unselect on teensy - // Hi-Z(DDR:0, PORT:0) to unselect - DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3); - PORTB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3); - DDRD &= ~(1<<2 | 1<<3); - PORTD &= ~(1<<2 | 1<<3); - DDRC &= ~(1<<6); - PORTC &= ~(1<<6); -} - -static void select_row(uint8_t row) -{ - if (row < 7) { - // select on mcp23018 - if (mcp23018_status) { // if there was an error - // do nothing - } else { - // set active row low : 0 - // set other rows hi-Z : 1 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPIOA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write( 0xFF & ~(1<<row) - & ~(ergodox_left_led_3<<LEFT_LED_3_SHIFT) - ); if (mcp23018_status) goto out; - out: - i2c_stop(); - } - } else { - // select on teensy - // Output low(DDR:1, PORT:0) to select - switch (row) { - case 7: - DDRB |= (1<<0); - PORTB &= ~(1<<0); - break; - case 8: - DDRB |= (1<<1); - PORTB &= ~(1<<1); - break; - case 9: - DDRB |= (1<<2); - PORTB &= ~(1<<2); - break; - case 10: - DDRB |= (1<<3); - PORTB &= ~(1<<3); - break; - case 11: - DDRD |= (1<<2); - PORTD &= ~(1<<3); - break; - case 12: - DDRD |= (1<<3); - PORTD &= ~(1<<3); - break; - case 13: - DDRC |= (1<<6); - PORTC &= ~(1<<6); - break; - } - } -} - diff --git a/keyboard/ergodox/twimaster.c b/keyboard/ergodox/twimaster.c deleted file mode 100644 index f91c08e6e4..0000000000 --- a/keyboard/ergodox/twimaster.c +++ /dev/null @@ -1,208 +0,0 @@ -/************************************************************************* -* Title: I2C master library using hardware TWI interface -* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury -* File: $Id: twimaster.c,v 1.3 2005/07/02 11:14:21 Peter Exp $ -* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3 -* Target: any AVR device with hardware TWI -* Usage: API compatible with I2C Software Library i2cmaster.h -**************************************************************************/ -#include <inttypes.h> -#include <compat/twi.h> - -#include <i2cmaster.h> - - -/* define CPU frequency in Mhz here if not defined in Makefile */ -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -/* I2C clock in Hz */ -#define SCL_CLOCK 400000L - - -/************************************************************************* - Initialization of the I2C bus interface. Need to be called only once -*************************************************************************/ -void i2c_init(void) -{ - /* initialize TWI clock - * minimal values in Bit Rate Register (TWBR) and minimal Prescaler - * bits in the TWI Status Register should give us maximal possible - * I2C bus speed - about 444 kHz - * - * for more details, see 20.5.2 in ATmega16/32 secification - */ - - TWSR = 0; /* no prescaler */ - TWBR = 10; /* must be >= 10 for stable operation */ - -}/* i2c_init */ - - -/************************************************************************* - Issues a start condition and sends address and transfer direction. - return 0 = device accessible, 1= failed to access device -*************************************************************************/ -unsigned char i2c_start(unsigned char address) -{ - uint8_t twst; - - // send START condition - TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); - - // wait until transmission completed - while(!(TWCR & (1<<TWINT))); - - // check value of TWI Status Register. Mask prescaler bits. - twst = TW_STATUS & 0xF8; - if ( (twst != TW_START) && (twst != TW_REP_START)) return 1; - - // send device address - TWDR = address; - TWCR = (1<<TWINT) | (1<<TWEN); - - // wail until transmission completed and ACK/NACK has been received - while(!(TWCR & (1<<TWINT))); - - // check value of TWI Status Register. Mask prescaler bits. - twst = TW_STATUS & 0xF8; - if ( (twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK) ) return 1; - - return 0; - -}/* i2c_start */ - - -/************************************************************************* - Issues a start condition and sends address and transfer direction. - If device is busy, use ack polling to wait until device is ready - - Input: address and transfer direction of I2C device -*************************************************************************/ -void i2c_start_wait(unsigned char address) -{ - uint8_t twst; - - - while ( 1 ) - { - // send START condition - TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); - - // wait until transmission completed - while(!(TWCR & (1<<TWINT))); - - // check value of TWI Status Register. Mask prescaler bits. - twst = TW_STATUS & 0xF8; - if ( (twst != TW_START) && (twst != TW_REP_START)) continue; - - // send device address - TWDR = address; - TWCR = (1<<TWINT) | (1<<TWEN); - - // wail until transmission completed - while(!(TWCR & (1<<TWINT))); - - // check value of TWI Status Register. Mask prescaler bits. - twst = TW_STATUS & 0xF8; - if ( (twst == TW_MT_SLA_NACK )||(twst ==TW_MR_DATA_NACK) ) - { - /* device busy, send stop condition to terminate write operation */ - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); - - // wait until stop condition is executed and bus released - while(TWCR & (1<<TWSTO)); - - continue; - } - //if( twst != TW_MT_SLA_ACK) return 1; - break; - } - -}/* i2c_start_wait */ - - -/************************************************************************* - Issues a repeated start condition and sends address and transfer direction - - Input: address and transfer direction of I2C device - - Return: 0 device accessible - 1 failed to access device -*************************************************************************/ -unsigned char i2c_rep_start(unsigned char address) -{ - return i2c_start( address ); - -}/* i2c_rep_start */ - - -/************************************************************************* - Terminates the data transfer and releases the I2C bus -*************************************************************************/ -void i2c_stop(void) -{ - /* send stop condition */ - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); - - // wait until stop condition is executed and bus released - while(TWCR & (1<<TWSTO)); - -}/* i2c_stop */ - - -/************************************************************************* - Send one byte to I2C device - - Input: byte to be transfered - Return: 0 write successful - 1 write failed -*************************************************************************/ -unsigned char i2c_write( unsigned char data ) -{ - uint8_t twst; - - // send data to the previously addressed device - TWDR = data; - TWCR = (1<<TWINT) | (1<<TWEN); - - // wait until transmission completed - while(!(TWCR & (1<<TWINT))); - - // check value of TWI Status Register. Mask prescaler bits - twst = TW_STATUS & 0xF8; - if( twst != TW_MT_DATA_ACK) return 1; - return 0; - -}/* i2c_write */ - - -/************************************************************************* - Read one byte from the I2C device, request more data from device - - Return: byte read from I2C device -*************************************************************************/ -unsigned char i2c_readAck(void) -{ - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWEA); - while(!(TWCR & (1<<TWINT))); - - return TWDR; - -}/* i2c_readAck */ - - -/************************************************************************* - Read one byte from the I2C device, read is followed by a stop condition - - Return: byte read from I2C device -*************************************************************************/ -unsigned char i2c_readNak(void) -{ - TWCR = (1<<TWINT) | (1<<TWEN); - while(!(TWCR & (1<<TWINT))); - - return TWDR; - -}/* i2c_readNak */ |