commit
8a91aa5e6c
@ -0,0 +1,31 @@ |
||||
#include "atom47.h" |
||||
#include "led.h" |
||||
|
||||
void matrix_init_kb(void) { |
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
matrix_init_user(); |
||||
led_init_ports(); |
||||
}; |
||||
|
||||
void matrix_scan_kb(void) { |
||||
// put your looping keyboard code here
|
||||
// runs every cycle (a lot)
|
||||
matrix_scan_user(); |
||||
}; |
||||
|
||||
void led_init_ports(void) { |
||||
// * Set our LED pins as output
|
||||
DDRB &= ~(1<<5); |
||||
} |
||||
|
||||
void led_set_kb(uint8_t usb_led) { |
||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) { |
||||
// Turn capslock on
|
||||
PORTF |= (1<<5); |
||||
} else { |
||||
// Turn capslock off
|
||||
PORTF &= ~(1<<5); |
||||
} |
||||
led_set_user(usb_led); |
||||
} |
@ -0,0 +1,25 @@ |
||||
#ifndef ATOM47_H |
||||
#define ATOM47_H |
||||
|
||||
#include "quantum.h" |
||||
|
||||
// readability
|
||||
#define XXX KC_NO |
||||
|
||||
#define KEYMAP_ANSI( \ |
||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \
|
||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1c, \
|
||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2c, \
|
||||
k30, k31, k32, k33, k34, k36, k38, k39, k3a, k3c \
|
||||
) \
|
||||
{ \
|
||||
{k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c}, \
|
||||
{k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, XXX, k1c}, \
|
||||
{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, XXX, k2c}, \
|
||||
{k30, k31, k32, k33, k34, XXX, k36, XXX, k38, k39, k3a, XXX, k3c} \
|
||||
} |
||||
|
||||
void matrix_init_user(void); |
||||
void matrix_scan_user(void); |
||||
|
||||
#endif |
@ -0,0 +1,73 @@ |
||||
/*
|
||||
Copyright 2012 Maarten Dekkers <atomkeeb@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 0x6060 |
||||
#define DEVICE_VER 0x0003 |
||||
#define MANUFACTURER Vortex |
||||
#define PRODUCT Core |
||||
#define DESCRIPTION Atom47 PCB for the Vortex Core |
||||
|
||||
/* key matrix size */ |
||||
#define MATRIX_ROWS 4 |
||||
#define MATRIX_COLS 13 |
||||
|
||||
// ROWS: Top to bottom, COLS: Left to right
|
||||
|
||||
#define MATRIX_ROW_PINS {B1,B2,B3,B7} |
||||
#define MATRIX_COL_PINS {D7,D5,F0,F1,F4,F6,F7,D4,C7,C6,D6,B5,B4} |
||||
#define UNUSED_PINS |
||||
|
||||
#define BACKLIGHT_PIN B6 |
||||
|
||||
/* COL2ROW or ROW2COL */ |
||||
#define DIODE_DIRECTION COL2ROW |
||||
|
||||
/* define if matrix has ghost */ |
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* Set 0 if debouncing isn't needed */ |
||||
#define DEBOUNCING_DELAY 5 |
||||
|
||||
/* 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)) \
|
||||
) |
||||
|
||||
/* Backlight configuration
|
||||
*/ |
||||
#define BACKLIGHT_LEVELS 4 |
||||
|
||||
#endif |
||||
|
||||
#define RGB_DI_PIN D0 // The pin the LED strip is connected to
|
||||
#define RGBLED_NUM 1 // Number of LEDs in your strip
|
||||
|
||||
#define QMK_ESC_OUTPUT D7 // usually COL
|
||||
#define QMK_ESC_INPUT B1 // usually ROW
|
||||
#define QMK_LED B6 |
@ -0,0 +1,31 @@ |
||||
#include "atom47.h" |
||||
#include "led.h" |
||||
|
||||
void matrix_init_kb(void) { |
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
matrix_init_user(); |
||||
led_init_ports(); |
||||
}; |
||||
|
||||
void matrix_scan_kb(void) { |
||||
// put your looping keyboard code here
|
||||
// runs every cycle (a lot)
|
||||
matrix_scan_user(); |
||||
}; |
||||
|
||||
void led_init_ports(void) { |
||||
// * Set our LED pins as output
|
||||
DDRB &= ~(1<<5); |
||||
} |
||||
|
||||
void led_set_kb(uint8_t usb_led) { |
||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) { |
||||
// Turn capslock on
|
||||
PORTF |= (1<<5); |
||||
} else { |
||||
// Turn capslock off
|
||||
PORTF &= ~(1<<5); |
||||
} |
||||
led_set_user(usb_led); |
||||
} |
@ -0,0 +1,25 @@ |
||||
#ifndef ATOM47_H |
||||
#define ATOM47_H |
||||
|
||||
#include "quantum.h" |
||||
|
||||
// readability
|
||||
#define XXX KC_NO |
||||
|
||||
#define KEYMAP_ANSI( \ |
||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \
|
||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1c, \
|
||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2c, \
|
||||
k30, k31, k32, k33, k34, k36, k38, k39, k3a, k3c \
|
||||
) \
|
||||
{ \
|
||||
{k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c}, \
|
||||
{k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, XXX, k1c}, \
|
||||
{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, XXX, k2c}, \
|
||||
{k30, k31, k32, k33, k34, XXX, k36, XXX, k38, k39, k3a, XXX, k3c} \
|
||||
} |
||||
|
||||
void matrix_init_user(void); |
||||
void matrix_scan_user(void); |
||||
|
||||
#endif |
@ -0,0 +1,73 @@ |
||||
/*
|
||||
Copyright 2012 Maarten Dekkers <atomkeeb@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 0x6060 |
||||
#define DEVICE_VER 0x0003 |
||||
#define MANUFACTURER Vortex |
||||
#define PRODUCT Core |
||||
#define DESCRIPTION Atom47 PCB for the Vortex Core |
||||
|
||||
/* key matrix size */ |
||||
#define MATRIX_ROWS 4 |
||||
#define MATRIX_COLS 13 |
||||
|
||||
// ROWS: Top to bottom, COLS: Left to right
|
||||
|
||||
#define MATRIX_ROW_PINS {B1,B2,B3,B7} |
||||
#define MATRIX_COL_PINS {D7,D5,F0,F1,F4,F6,F7,D4,C7,C6,D6,B5,B4} |
||||
#define UNUSED_PINS |
||||
|
||||
#define BACKLIGHT_PIN B6 |
||||
|
||||
/* COL2ROW or ROW2COL */ |
||||
#define DIODE_DIRECTION COL2ROW |
||||
|
||||
/* define if matrix has ghost */ |
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* Set 0 if debouncing isn't needed */ |
||||
#define DEBOUNCING_DELAY 5 |
||||
|
||||
/* 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)) \
|
||||
) |
||||
|
||||
/* Backlight configuration
|
||||
*/ |
||||
#define BACKLIGHT_LEVELS 4 |
||||
|
||||
#endif |
||||
|
||||
#define RGB_DI_PIN D0 // The pin the LED strip is connected to
|
||||
#define RGBLED_NUM 1 // Number of LEDs in your strip
|
||||
|
||||
#define QMK_ESC_OUTPUT D7 // usually COL
|
||||
#define QMK_ESC_INPUT B1 // usually ROW
|
||||
#define QMK_LED B6 |
@ -0,0 +1,65 @@ |
||||
# 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 = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality (+4870)
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality (+1150)
|
||||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = no
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
@ -0,0 +1,39 @@ |
||||
#include QMK_KEYBOARD_H |
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
|
||||
#define _MA 0 //Main layer
|
||||
#define _FN 1 //Fn
|
||||
#define _FN1 2 //Fn1
|
||||
#define _PN 3 //Pn
|
||||
|
||||
#define _______ KC_TRNS |
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
[_MA] = KEYMAP_ANSI( |
||||
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, KC_BSPC, \
|
||||
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_RSFT, MO(_FN1), \
|
||||
KC_LCTL, KC_LGUI, KC_LALT, MO(_PN), KC_SPC, KC_SPC, MO(_FN), KC_RALT, KC_APP, KC_RCTRL), \
|
||||
|
||||
[_FN] = KEYMAP_ANSI( |
||||
_______, KC_VOLD, KC_VOLU, KC_MUTE, RESET, _______, KC_CALC, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, \
|
||||
KC_CAPS, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_INS, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_DEC, BL_INC, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______), \
|
||||
|
||||
[_FN1] = KEYMAP_ANSI( |
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, \
|
||||
_______, _______, _______, _______, _______, KC_QUOT, KC_SLSH, KC_LBRC, KC_RBRC, KC_BSLS, KC_RSFT, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______), \
|
||||
|
||||
[_PN] = KEYMAP_ANSI( |
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, RESET), |
||||
}; |
@ -0,0 +1,10 @@ |
||||
To be updated... |
||||
|
||||
|
||||
// This layer is just a blank template to be copied for easy layer creation. please don not edit it. |
||||
|
||||
[_LX] = KEYMAP_ANSI( |
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ |
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ |
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ |
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, RESET), |
@ -0,0 +1,28 @@ |
||||
# ATOM47 |
||||
|
||||
 |
||||
|
||||
## Support |
||||
Keyboard Maintainer: [Matthew Kerfoot(https://github.com/mkerfoot) |
||||
Hardware Supported: ATOM47 |
||||
Hardware Availability: [GeekHack.com Group Buy](https://geekhack.org/index.php?topic=93447.msg2545221) |
||||
|
||||
|
||||
## Features |
||||
QMK Firmware |
||||
6 Underglow RGB leds |
||||
In-switch leds |
||||
Through-hole micro usb connector (less likely to break off!) |
||||
South facing leds for the QMX/Zealencio users |
||||
Multiple layouts |
||||
Easily reachable reset button under the spacebar |
||||
CapsLock indicator |
||||
|
||||
## Build |
||||
To build the default keymap, simply run `make atom47:default`. |
||||
|
||||
For an alternative, heavily modified layout you would just need to run `make atom47:LEdiodes`. |
||||
|
||||
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. |
||||
|
||||
 |
@ -0,0 +1,65 @@ |
||||
# 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 = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality (+4870)
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality (+1150)
|
||||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = no
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
@ -0,0 +1,192 @@ |
||||
/* Copyright 2018 Yiancar
|
||||
* |
||||
* 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 0x0000 |
||||
#define DEVICE_VER 0x0001 |
||||
#define MANUFACTURER Yiancar/CapsUnlocked |
||||
#define PRODUCT CU24 |
||||
#define DESCRIPTION A luxurious fully customisable numpad |
||||
|
||||
/* key matrix size */ |
||||
#define MATRIX_ROWS 6 |
||||
#define MATRIX_COLS 4 |
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments |
||||
* |
||||
* Change this to how you wired your keyboard |
||||
* COLS: AVR pins used for columns, left to right |
||||
* ROWS: AVR pins used for rows, top to bottom |
||||
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) |
||||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) |
||||
* |
||||
*/ |
||||
#define MATRIX_ROW_PINS { E6, F5, B4, B6, C6, C7 } |
||||
#define MATRIX_COL_PINS { F0, F1, D0, D1 } |
||||
#define UNUSED_PINS |
||||
|
||||
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ |
||||
#define DIODE_DIRECTION ROW2COL |
||||
|
||||
/* Backlight */ |
||||
#define BACKLIGHT_PIN B5 |
||||
#define BACKLIGHT_BREATHING |
||||
#define BACKLIGHT_LEVELS 5 |
||||
|
||||
/* RGB Glow */ |
||||
#define RGB_DI_PIN F4 // The pin the LED strip is connected to
|
||||
#define RGBLED_NUM 5 // Number of LEDs in your strip
|
||||
#define RGBLIGHT_ANIMATIONS |
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ |
||||
#define DEBOUNCING_DELAY 5 |
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */ |
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* 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 |
||||
|
||||
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
|
||||
* This is userful for the Windows task manager shortcut (ctrl+shift+esc). |
||||
*/ |
||||
// #define GRAVE_ESC_CTRL_OVERRIDE
|
||||
|
||||
/*
|
||||
* Force NKRO |
||||
* |
||||
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved |
||||
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the |
||||
* makefile for this to work.) |
||||
* |
||||
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) |
||||
* until the next keyboard reset. |
||||
* |
||||
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is |
||||
* fully operational during normal computer usage. |
||||
* |
||||
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) |
||||
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by |
||||
* bootmagic, NKRO mode will always be enabled until it is toggled again during a |
||||
* power-up. |
||||
* |
||||
*/ |
||||
//#define FORCE_NKRO
|
||||
|
||||
/*
|
||||
* Magic Key Options |
||||
* |
||||
* Magic keys are hotkey commands that allow control over firmware functions of |
||||
* the keyboard. They are best used in combination with the HID Listen program, |
||||
* found here: https://www.pjrc.com/teensy/hid_listen.html
|
||||
* |
||||
* The options below allow the magic key functionality to be changed. This is |
||||
* useful if your keyboard/keypad is missing keys and you want magic key support. |
||||
* |
||||
*/ |
||||
|
||||
/* key combination for magic key command */ |
||||
#define IS_COMMAND() ( \ |
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||
) |
||||
|
||||
/* control how magic key switches layers */ |
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
|
||||
|
||||
/* override magic key keymap */ |
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
|
||||
//#define MAGIC_KEY_HELP1 H
|
||||
//#define MAGIC_KEY_HELP2 SLASH
|
||||
//#define MAGIC_KEY_DEBUG D
|
||||
//#define MAGIC_KEY_DEBUG_MATRIX X
|
||||
//#define MAGIC_KEY_DEBUG_KBD K
|
||||
//#define MAGIC_KEY_DEBUG_MOUSE M
|
||||
//#define MAGIC_KEY_VERSION V
|
||||
//#define MAGIC_KEY_STATUS S
|
||||
//#define MAGIC_KEY_CONSOLE C
|
||||
//#define MAGIC_KEY_LAYER0_ALT1 ESC
|
||||
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
|
||||
//#define MAGIC_KEY_LAYER0 0
|
||||
//#define MAGIC_KEY_LAYER1 1
|
||||
//#define MAGIC_KEY_LAYER2 2
|
||||
//#define MAGIC_KEY_LAYER3 3
|
||||
//#define MAGIC_KEY_LAYER4 4
|
||||
//#define MAGIC_KEY_LAYER5 5
|
||||
//#define MAGIC_KEY_LAYER6 6
|
||||
//#define MAGIC_KEY_LAYER7 7
|
||||
//#define MAGIC_KEY_LAYER8 8
|
||||
//#define MAGIC_KEY_LAYER9 9
|
||||
//#define MAGIC_KEY_BOOTLOADER PAUSE
|
||||
//#define MAGIC_KEY_LOCK CAPS
|
||||
//#define MAGIC_KEY_EEPROM E
|
||||
//#define MAGIC_KEY_NKRO N
|
||||
//#define MAGIC_KEY_SLEEP_LED Z
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
/*
|
||||
* MIDI options |
||||
*/ |
||||
|
||||
/* Prevent use of disabled MIDI features in the keymap */ |
||||
//#define MIDI_ENABLE_STRICT 1
|
||||
|
||||
/* enable basic MIDI features:
|
||||
- MIDI notes can be sent when in Music mode is on |
||||
*/ |
||||
//#define MIDI_BASIC
|
||||
|
||||
/* enable advanced MIDI features:
|
||||
- MIDI notes can be added to the keymap |
||||
- Octave shift and transpose |
||||
- Virtual sustain, portamento, and modulation wheel |
||||
- etc. |
||||
*/ |
||||
//#define MIDI_ADVANCED
|
||||
|
||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ |
||||
//#define MIDI_TONE_KEYCODE_OCTAVES 1
|
||||
|
||||
#endif |
@ -0,0 +1,16 @@ |
||||
/* Copyright 2018 Yiancar
|
||||
* |
||||
* 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 "cu24.h" |
@ -0,0 +1,42 @@ |
||||
/* Copyright 2018 Yiancar
|
||||
* |
||||
* 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 CU24_H |
||||
#define CU24_H |
||||
|
||||
#include "quantum.h" |
||||
|
||||
// This a shortcut to help you visually see your layout.
|
||||
// The following is an example using the Planck MIT layout
|
||||
// The first section contains all of the arguments
|
||||
// The second converts the arguments into a two-dimensional array
|
||||
#define KEYMAP( \ |
||||
k00, k01, k02, k03, \
|
||||
k10, k11, k12, k13, \
|
||||
k20, k21, k22, k23, \
|
||||
k30, k31, k32, k33, \
|
||||
k40, k41, k42, k43, \
|
||||
k50, k51, k52, k53 \
|
||||
) \
|
||||
{ \
|
||||
{ k00, k01, k02, k03 }, \
|
||||
{ k10, k11, k12, k13 }, \
|
||||
{ k20, k21, k22, k23 }, \
|
||||
{ k30, k31, k32, k33 }, \
|
||||
{ k40, k41, k42, k43 }, \
|
||||
{ k50, k51, k52, k53 } \
|
||||
} |
||||
|
||||
#endif |
@ -0,0 +1,56 @@ |
||||
/* Copyright 2018 Yiancar
|
||||
* |
||||
* 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 "cu24.h" |
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
[0] = KEYMAP( /* Base */ |
||||
KC_MPLY, KC_MUTE, KC_VOLD, KC_VOLU, \
|
||||
MO(1) , KC_PSLS, KC_PAST, KC_PMNS, \
|
||||
KC_P7 , KC_P8 , KC_P9 , KC_PPLS, \
|
||||
KC_P4 , KC_P5 , KC_P6 , KC_PPLS, \
|
||||
KC_P1 , KC_P2 , KC_P3 , KC_PENT, \
|
||||
KC_P0 , KC_P0 , KC_PDOT, KC_PENT |
||||
), |
||||
|
||||
[1] = KEYMAP( /* FN */ |
||||
RGB_TOG, RGB_MOD, BL_STEP, BL_BRTG, \
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
|
||||
RGB_HUI, RGB_SAI, RGB_VAI, KC_TRNS, \
|
||||
RGB_HUD, RGB_SAD, RGB_VAD, KC_TRNS, \
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
|
||||
KC_TRNS, KC_TRNS, RESET , KC_TRNS |
||||
), |
||||
}; |
||||
|
||||
/* Use this function to add macros */ |
||||
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; |
||||
}; |
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
||||
return true; |
||||
} |
@ -0,0 +1,10 @@ |
||||
https://imgur.com/a/vpHFj |
||||
|
||||
 |
||||
|
||||
# Default CU24 Layout |
||||
|
||||
This is the default layout that comes flashed on every CU24. It is like a normal numpad, |
||||
with all the led customization on the Fn layer. |
||||
|
||||
See [All Layouts](https://imgur.com/trwO7dN) for all supported configurations! |
@ -0,0 +1,15 @@ |
||||
# CU24 |
||||
|
||||
 |
||||
|
||||
A luxurious 24 key keypad with various layouts. Includes RGB underglow, backlight and an aluminium, brass and nylon case. |
||||
|
||||
Keyboard Maintainer: [Yiancar](https://github.com/yiancar) |
||||
Hardware Supported: PCB v1.0 (uses a 32u4) |
||||
Hardware Availability: http://caps-unlocked.com/ |
||||
|
||||
Make example for this keyboard (after setting up your build environment): |
||||
|
||||
make CU24:default |
||||
|
||||
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. |
@ -0,0 +1,69 @@ |
||||
# MCU name
|
||||
#MCU = at90usb1286
|
||||
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
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
|
||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||
RGBLIGHT_ENABLE = yes # RGB drivers
|
@ -0,0 +1,18 @@ |
||||
{ |
||||
"keyboard_name": "DeltaSplit75", |
||||
"identifier":"FEED:3060:0001", |
||||
"manufacturer": "xyxjj", |
||||
"maintainer": "xyxjj & itsaferbie", |
||||
"processor": "atmega32u4", |
||||
"bootloader": "n/a", |
||||
"width": 17, |
||||
"height": 6, |
||||
"layouts": { |
||||
"KEYMAP_V2": { |
||||
"layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":8, "y":0}, {"label":"F8", "x":9, "y":0}, {"label":"F9", "x":10, "y":0}, {"label":"F10", "x":11, "y":0}, {"label":"F11", "x":12, "y":0}, {"label":"F12", "x":13, "y":0}, {"label":"Print", "x":14, "y":0}, {"label":"Scroll", "x":15, "y":0}, {"label":"Pause", "x":16, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":8, "y":1}, {"label":"*", "x":9, "y":1}, {"label":"(", "x":10, "y":1}, {"label":")", "x":11, "y":1}, {"label":"_", "x":12, "y":1}, {"label":"+", "x":13, "y":1}, {"label":"Back", "x":14, "y":1}, {"label":"Trns", "x":15, "y":1}, {"label":"Home", "x":16, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":7.5, "y":2}, {"label":"U", "x":8.5, "y":2}, {"label":"I", "x":9.5, "y":2}, {"label":"O", "x":10.5, "y":2}, {"label":"P", "x":11.5, "y":2}, {"label":"{", "x":12.5, "y":2}, {"label":"}", "x":13.5, "y":2}, {"label":"Back", "x":14.5, "y":2, "w":1.5}, {"label":"PgUp", "x":16, "y":2}, {"label":"Ctrl", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":7.75, "y":3}, {"label":"J", "x":8.75, "y":3}, {"label":"K", "x":9.75, "y":3}, {"label":"L", "x":10.75, "y":3}, {"label":":", "x":11.75, "y":3}, {"label":"\"", "x":12.75, "y":3}, {"label":"Trns", "x":13.75, "y":3}, {"label":"Enter", "x":14.75, "y":3, "w":1.25}, {"label":"PgDn", "x":16, "y":3}, {"label":"Shift", "x":0, "y":4, "w":1.25}, {"label":"Trns", "x":1.25, "y":4}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"B", "x":7.25, "y":4}, {"label":"N", "x":8.25, "y":4}, {"label":"M", "x":9.25, "y":4}, {"label":"<", "x":10.25, "y":4}, {"label":">", "x":11.25, "y":4}, {"label":"?", "x":12.25, "y":4}, {"label":"Shift", "x":13.25, "y":4, "w":1.75}, {"label":"Up", "x":15, "y":4}, {"label":"End", "x":16, "y":4}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"label":"Space", "x":3.75, "y":5, "w":2}, {"label":"Fn", "x":5.75, "y":5}, {"label":"Space", "x":7.75, "y":5, "w":2.75}, {"label":"Alt", "x":10.5, "y":5, "w":1.25}, {"label":"Win", "x":11.75, "y":5}, {"label":"Ctrl", "x":12.75, "y":5, "w":1.25}, {"label":"Left", "x":14, "y":5}, {"label":"Down", "x":15, "y":5}, {"label":"Right", "x":16, "y":5}] |
||||
}, |
||||
"KEYMAP_PROTOSPLIT": { |
||||
"layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":8, "y":0}, {"label":"F8", "x":9, "y":0}, {"label":"F9", "x":10, "y":0}, {"label":"F10", "x":11, "y":0}, {"label":"F11", "x":12, "y":0}, {"label":"F12", "x":13, "y":0}, {"label":"Insert", "x":14, "y":0}, {"label":"Home", "x":15, "y":0}, {"label":"PgUp", "x":16, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":8, "y":1}, {"label":"*", "x":9, "y":1}, {"label":"(", "x":10, "y":1}, {"label":")", "x":11, "y":1}, {"label":"_", "x":12, "y":1}, {"label":"+", "x":13, "y":1}, {"label":"Delete", "x":14, "y":1}, {"label":"End", "x":15, "y":1}, {"label":"PgDn", "x":16, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":7.5, "y":2}, {"label":"U", "x":8.5, "y":2}, {"label":"I", "x":9.5, "y":2}, {"label":"O", "x":10.5, "y":2}, {"label":"P", "x":11.5, "y":2}, {"label":"{", "x":12.5, "y":2}, {"label":"}", "x":13.5, "y":2}, {"label":"Back", "x":14.5, "y":2, "w":1.5}, {"label":"Scroll", "x":16, "y":2}, {"label":"Ctrl", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":7.75, "y":3}, {"label":"J", "x":8.75, "y":3}, {"label":"K", "x":9.75, "y":3}, {"label":"L", "x":10.75, "y":3}, {"label":":", "x":11.75, "y":3}, {"label":"\"", "x":12.75, "y":3}, {"label":"Enter", "x":13.75, "y":3, "w":2.25}, {"label":"Pause", "x":16, "y":3}, {"label":"Shift", "x":0, "y":4, "w":2.25}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"B", "x":7.25, "y":4}, {"label":"N", "x":8.25, "y":4}, {"label":"M", "x":9.25, "y":4}, {"label":"<", "x":10.25, "y":4}, {"label":">", "x":11.25, "y":4}, {"label":"?", "x":12.25, "y":4}, {"label":"Shift", "x":13.25, "y":4, "w":1.75}, {"label":"Up", "x":15, "y":4}, {"label":"Print", "x":16, "y":4}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"label":"Space", "x":3.75, "y":5, "w":2}, {"label":"Fn", "x":5.75, "y":5}, {"label":"Space", "x":7.75, "y":5, "w":2.75}, {"label":"Alt", "x":10.5, "y":5, "w":1.25}, {"label":"Win", "x":11.75, "y":5}, {"label":"Ctrl", "x":12.75, "y":5, "w":1.25}, {"label":"Left", "x":14, "y":5}, {"label":"Down", "x":15, "y":5}, {"label":"Right", "x":16, "y":5}] |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,61 @@ |
||||
#include "dz60.h" |
||||
|
||||
#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) |
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
KEYMAP( |
||||
F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_NO, KC_BSPC,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
|
||||
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
|
||||
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, MO(1), KC_RALT, KC_RALT, KC_LGUI, KC_RCTL), |
||||
|
||||
KEYMAP( |
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_DEL,
|
||||
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_TOGG, BL_INC, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_LEFT, KC_DOWN, KC_RIGHT), |
||||
|
||||
KEYMAP( |
||||
KC_TRNS, M(1), M(2), M(3), M(4), M(5), M(6), M(7), M(8), M(9), M(10), M(11), M(12), KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), |
||||
}; |
||||
|
||||
enum function_id { |
||||
SHIFT_ESC, |
||||
}; |
||||
|
||||
const uint16_t PROGMEM fn_actions[] = { |
||||
[0] = ACTION_FUNCTION(SHIFT_ESC), |
||||
}; |
||||
|
||||
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { |
||||
static uint8_t shift_esc_shift_mask; |
||||
switch (id) { |
||||
case SHIFT_ESC: |
||||
shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; |
||||
if (record->event.pressed) { |
||||
if (shift_esc_shift_mask) { |
||||
add_key(KC_GRV); |
||||
send_keyboard_report(); |
||||
} else { |
||||
add_key(KC_ESC); |
||||
send_keyboard_report(); |
||||
} |
||||
} else { |
||||
if (shift_esc_shift_mask) { |
||||
del_key(KC_GRV); |
||||
send_keyboard_report(); |
||||
} else { |
||||
del_key(KC_ESC); |
||||
send_keyboard_report(); |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
@ -0,0 +1,58 @@ |
||||
#ifndef CONFIG_H |
||||
#define CONFIG_H |
||||
|
||||
#include "config.h" |
||||
|
||||
/* USB Device descriptor parameter */ |
||||
#define VENDOR_ID 0xFEED |
||||
#define PRODUCT_ID 0x2260 |
||||
#define DEVICE_VER 0x0001 |
||||
#define MANUFACTURER KBDFans |
||||
#define PRODUCT DZ60 |
||||
#define DESCRIPTION DZ60 Keyboard |
||||
|
||||
/* key matrix size */ |
||||
#define MATRIX_ROWS 5 |
||||
#define MATRIX_COLS 15 |
||||
|
||||
/* key matrix pins */ |
||||
#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 } |
||||
#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3, F4 } |
||||
#define UNUSED_PINS |
||||
|
||||
/* COL2ROW or ROW2COL */ |
||||
#define DIODE_DIRECTION COL2ROW |
||||
|
||||
/* number of backlight levels */ |
||||
#define BACKLIGHT_PIN B6 |
||||
#define BACKLIGHT_LEVELS 5 |
||||
|
||||
/* Set 0 if debouncing isn't needed */ |
||||
#define DEBOUNCING_DELAY 5 |
||||
|
||||
/* 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)) \
|
||||
) |
||||
|
||||
/* prevent stuck modifiers */ |
||||
#define PREVENT_STUCK_MODIFIERS |
||||
|
||||
#define RGB_DI_PIN E2 |
||||
#define RGBLIGHT_ANIMATIONS |
||||
#define RGBLED_NUM 16 |
||||
#define RGBLIGHT_HUE_STEP 8 |
||||
#define RGBLIGHT_SAT_STEP 8 |
||||
#define RGBLIGHT_VAL_STEP 8 |
||||
|
||||
/* sets 'Auto Shift' timeouts */ |
||||
#define AUTO_SHIFT_TIMEOUT 150 |
||||
#define NO_AUTO_SHIFT_SPECIAL |
||||
|
||||
#endif |
@ -0,0 +1,141 @@ |
||||
#include "xd60.h" |
||||
#include "action_layer.h" |
||||
|
||||
#Define _L0 0 |
||||
#Define _L1 1 |
||||
#Define _L2 2 |
||||
#Define _L3 3 |
||||
#Define _L4 4 |
||||
|
||||
#define _______ KC_TRNS |
||||
|
||||
/*
|
||||
* template |
||||
* [_L1] = KEYMAP(
|
||||
* _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \
|
||||
* _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
|
||||
* _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
|
||||
* _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \
|
||||
* _______,_______,_______, _______,_______,_______, _______,_______,_______,_______,_______, |
||||
*
|
||||
*
|
||||
*\
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
/* Keymap _L0: (Layer 0 - Base Layer) This is the default layer
|
||||
* This layer has a key set to MO(_L1) which means when held down Layer 1 will become active, If Layer 1 does not have anything set for tat key is will revert to uing the key set at layer 0. |
||||
* LT(_L1, KC_1) means that when the "1" key is long touched then it will activate the layer _L1 key(F1) but if the key is just tapped it will activate the "1" key. |
||||
* KC_GESC = Escape when tapped, ` when pressed with Shift or GUI |
||||
* KC_LSPO = Left Shift when held, ( when tapped |
||||
* TD(LT(_L3,KC_SPACE)) = This is a test... hoping it will tap dance if double tapped it does enter if single tap it does space if long hold down it does _L3(Layer 3). |
||||
* LT(_L3,KC_SPACE) = if tapped it does space, is long touch it does _L3(Layer 3) |
||||
* BL_TOGG = Toggles the LEDs. |
||||
* ,-----------------------------------------------------------------------------------------. |
||||
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bkspc| Del | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | _L4 | A | S | D | F | G | H | J | K | L | ; | ' | Enter | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | Shift | Z | X | C | V | B | N | M | , | . | / | RSh | U | _L1 | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | Ctrl | Win | Alt | _L3[Space] |LEdiodes| Space |Win | _L2| L | D | R | |
||||
* `-----------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_L0] = KEYMAP( |
||||
KC_GESC, LT(_L1, KC_1),LT(_L1, KC_2),LT(_L1, KC_3),LT(_L1, KC_4),LT(_L1, KC_5),LT(_L1, KC_6),LT(_L1, KC_7),LT(_L1, KC_8),LT(_L1, KC_9),LT(_L1, KC_0),LT(_L1, KC_MINS),LT(_L1, KC_EQL),KC_BSPC, KC_DEL, \
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \
|
||||
KC_LSPO, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPO, KC_UP, M0(_L1), \
|
||||
KC_LCTL, KC_LGUI, KC_LALT, TD(LT(_L3,KC_SPACE)),BL_TOGG,TD(TD_SPC_ENT), KC_RGUI, M0(_L2), KC_LEFT, KC_DOWN, KC_RIGHT), |
||||
|
||||
/* Keymap _L1: (Layer 1) This is function layer 1
|
||||
* This layer is activated while the Fn key is being held down. |
||||
* ,-----------------------------------------------------------------------------------------. |
||||
* | Reset | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13| F14| |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | WhUp| U | WhDn | | | | | | PrtScr | | | | | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | L | D | R | | | Home | | | | | | | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | | | End | VolDn|VolUp|Mute | | | PgUp| | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | | | | | Home| PgDn| End | |
||||
* `-----------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_L1] = KEYMAP(
|
||||
RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, KC_F14, \
|
||||
_______, KC_WH_U, KC_UP, KC_WH_D, _______, _______,_______, _______, _______, _______, KC_PSCR, _______, _______, _______, \
|
||||
_______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, KC_HOME, _______, _______, _______, KC_HOME, _______, _______, _______, \
|
||||
_______, _______, _______, KC_APP, BL_STEP,_______, KC_END, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, _______, KC_PGUP, _______, \
|
||||
_______, _______, _______, _______,_______,_______, _______, _______, KC_HOME, KC_PGDOWN, KC_END), |
||||
|
||||
/* Keymap _L2: (Layer 2) This is function layer 2
|
||||
* This layer is activated while the Fn2 key is being held down. |
||||
* LCA(KC_TAB) = Hold Left Control and Alt and press kc_tab which cycles trough open apps. |
||||
* MEH(KC_TAB) = Hold Left Control, Shift and Alt and press kc_TAB to cycle backwards through apps. |
||||
* ,-----------------------------------------------------------------------------------------. |
||||
* | | | | | | | | | | | | | | | LCA(KC_TAB)| |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | | | | | | | | | | |MEH(KC_TAB) |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | | | | | | | | | | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | | | | || | | | | | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | | | | | | | | |
||||
* `-----------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_L2] = KEYMAP(
|
||||
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,LCA(KC_TAB), \
|
||||
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, MEH(KC_TAB), \
|
||||
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
|
||||
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_MS_BTN1,KC_MS_UP,KC_MS_BTN2, \
|
||||
_______,_______,_______, _______,_______,_______, _______,_______,KC_MS_LEFT,KC_MS_DOWN,KC_MS_RIGHT, |
||||
|
||||
}; |
||||
|
||||
// Custom Actions
|
||||
const uint16_t PROGMEM fn_actions[] = { |
||||
[0] = ACTION_LAYER_MOMENTARY(1), // to Fn overlay
|
||||
}; |
||||
|
||||
// Macros
|
||||
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; |
||||
}; |
||||
|
||||
// Loop
|
||||
void matrix_scan_user(void) { |
||||
// Empty
|
||||
}; |
||||
|
||||
//Tap Dance Declarations
|
||||
enum { |
||||
TD_SPC_ENT = 0, |
||||
TD_KC_LSFT_CAPS = 0, |
||||
TD_KC_RSFT_CAPS = 0 |
||||
}; |
||||
|
||||
//Tap Dance Definitions
|
||||
qk_tap_dance_action_t tap_dance_actions[] = { |
||||
|
||||
//Tap once for space, tap twice for enter
|
||||
[TD_SPC_ENT] = ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT), |
||||
//Tap once for Left Shift, twice for Caps Lock
|
||||
[TD_KC_LSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), |
||||
//Tap once for Right Shift, twice for Caps Lock
|
||||
[TD_KC_RSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_RSFT, KC_CAPS) |
||||
|
||||
// Other declarations would go here, separated by commas, if you have them
|
||||
|
||||
}; |
@ -0,0 +1,9 @@ |
||||
# LEdiodes Keymap for XD60 60% PCB |
||||
|
||||
 |
||||
|
||||
## Additional Notes |
||||
Layer 0(default) Keymap for LEdiodes XD60. |
||||
|
||||
## Build |
||||
To build the default keymap, simply run `make xd60:LEdiodes`. |
@ -0,0 +1,57 @@ |
||||
# MCU name
|
||||
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*
|
||||
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 = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
AUDIO_ENABLE = no
|
||||
RGBLIGHT_ENABLE = yes
|
||||
AUTO_SHIFT_ENABLE = yes # If the time depressed is greater than or equal to the AUTO_SHIFT_TIMEOUT, then a shifted version of the key is emitted. If the time is less than the AUTO_SHIFT_TIMEOUT time, then the normal state is emitted
|
@ -0,0 +1,85 @@ |
||||
#include "dz60.h" |
||||
|
||||
#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) |
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
/* Layer 0
|
||||
* ,-----------------------------------------------------------------------------------------. |
||||
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | ` | Bck | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | Caps | A | S | D | F | G | H | J | K | L | ; | ' | Enter | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | Shift | Z | X | C | V | B | N | M | , | . | RSh | U | / | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | Ctrl | GUI | Alt | Space | Fn1 | Play | Pscr | Fn1 | Left |Rght |Down | |
||||
* `-----------------------------------------------------------------------------------------' |
||||
*/ |
||||
|
||||
KEYMAP_2_SHIFTS( |
||||
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRV, KC_BSPC,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
|
||||
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
|
||||
KC_LSFT, KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_TRNS, KC_RSFT, KC_UP, KC_SLSH, |
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_MPLY, KC_PSCR, MO(1), KC_LEFT, KC_DOWN, KC_RGHT), |
||||
|
||||
|
||||
|
||||
/* Layer 1
|
||||
* ,-----------------------------------------------------------------------------------------. |
||||
* | PWR | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | Del | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | |RGBT |RGBM |Hue+ |Hue- |Sat+ |Sat- |Val+ |Val- | | | | | RESET | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | | | | | | | | | | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | BLT | BL- | BL+ | BLS | | | |Vol+ | | |
||||
* |-----------------------------------------------------------------------------------------+ |
||||
* | | | | | | Stop | | |Prev |Vol- |Next | |
||||
* `-----------------------------------------------------------------------------------------' |
||||
*/
|
||||
|
||||
|
||||
KEYMAP_2_SHIFTS( |
||||
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_DEL,
|
||||
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BL_TOGG, BL_DEC, BL_INC, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, KC_TRNS, |
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MSTP, KC_TRNS, KC_TRNS, KC_MPRV, KC_VOLD, KC_MNXT), |
||||
}; |
||||
|
||||
enum function_id { |
||||
SHIFT_ESC, |
||||
}; |
||||
|
||||
const uint16_t PROGMEM fn_actions[] = { |
||||
[0] = ACTION_FUNCTION(SHIFT_ESC), |
||||
}; |
||||
|
||||
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { |
||||
static uint8_t shift_esc_shift_mask; |
||||
switch (id) { |
||||
case SHIFT_ESC: |
||||
shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; |
||||
if (record->event.pressed) { |
||||
if (shift_esc_shift_mask) { |
||||
add_key(KC_GRV); |
||||
send_keyboard_report(); |
||||
} else { |
||||
add_key(KC_ESC); |
||||
send_keyboard_report(); |
||||
} |
||||
} else { |
||||
if (shift_esc_shift_mask) { |
||||
del_key(KC_GRV); |
||||
send_keyboard_report(); |
||||
} else { |
||||
del_key(KC_ESC); |
||||
send_keyboard_report(); |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
@ -0,0 +1,255 @@ |
||||
#include QMK_KEYBOARD_H |
||||
|
||||
#include "ergodox_ez.h" |
||||
#include "debug.h" |
||||
#include "action_layer.h" |
||||
|
||||
#define BASE 0 // Base layer - QWERTY
|
||||
#define SPEC 1 // Special keys favoring programming in c-like languages
|
||||
#define NUM 2 // Numeric layer with number row functional keys
|
||||
|
||||
#define ___ KC_TRNS |
||||
#define BSLASH LSFT(KC_SLSH) |
||||
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
[BASE] = LAYOUT_ergodox( |
||||
|
||||
// Left side
|
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_VOLU, /**/ KC_1, /**/ KC_2, /**/ KC_3, /**/ KC_4, /**/ KC_5, /**/ KC_F11, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_VOLD, /**/ KC_Q, /**/ KC_W, /**/ KC_E, /**/ KC_R, /**/ KC_T, /**/ KC_ESC, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*==========================================================================================*/ /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_MPLY, /**/ KC_A, /**/ KC_S, /**/ KC_D, /**/ KC_F, /**/ KC_G, /*===============*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*==========================================================================================*/ /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_MUTE, /**/ KC_Z, /**/ KC_X, /**/ KC_C, /**/ KC_V, /**/ KC_B, /**/ KC_BSPC, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ ___, /**/ ___, /**/ KC_RALT, /**/ KC_LCTRL, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=======================================================================*/ |
||||
|
||||
|
||||
/*==============================*/ |
||||
/**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_DEL, /**/ |
||||
/**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ /**/ /**/ KC_LALT, /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ /**/ /*===============*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ KC_SPACE, /**/ KC_LGUI, /**/ KC_LCTRL, /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
|
||||
// Right side
|
||||
//
|
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_F12, /**/ KC_1, /**/ KC_2, /**/ KC_3, /**/ KC_4, /**/ KC_5, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_Y, /**/ KC_U, /**/ KC_I, /**/ KC_O, /**/ KC_P, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ /*==========================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*===============*/ KC_H, /**/ KC_J, /**/ KC_K, /**/ KC_L, /**/ KC_SCLN, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ /*==========================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_ENT, /**/ KC_N, /**/ KC_M, /**/ KC_COMM, /**/ KC_DOT, /**/ KC_SLSH, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ MO(NUM), /**/ ___, /**/ ___, /**/ ___, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=======================================================================*/ |
||||
|
||||
/*==============================*/ |
||||
/**/ /**/ /**/ |
||||
/**/ ___, /**/ ___, /**/ |
||||
/**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ /**/ /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*===============*/ /**/ /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_RSFT, /**/ MO(SPEC) /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
), |
||||
|
||||
|
||||
[SPEC] = LAYOUT_ergodox( |
||||
|
||||
// Left side
|
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_EXLM, /**/ KC_AT, /**/ KC_HASH, /**/ KC_DLR, /**/ KC_PERC, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_GRV, /**/ KC_QUOT, /**/ KC_LCBR, /**/ KC_RCBR, /**/ KC_PLUS, /**/ KC_ESC, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*==========================================================================================*/ /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_TAB, /**/ KC_ASTR, /**/ KC_LPRN, /**/ KC_RPRN, /**/ KC_EQUAL, /*===============*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*==========================================================================================*/ /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_HASH, /**/ KC_PERC, /**/ KC_LBRC, /**/ KC_RBRC, /**/ KC_MINUS, /**/ KC_BSPC, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ ___, /**/ ___, /**/ KC_LALT, /**/ KC_LCTRL, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=======================================================================*/ |
||||
|
||||
|
||||
/*==============================*/ |
||||
/**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_DEL, /**/ |
||||
/**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ /**/ /**/ KC_LALT, /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ /**/ /*===============*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ KC_SPACE, /**/ KC_LGUI, /**/ KC_LCTRL, /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
|
||||
// Right side
|
||||
//
|
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_CIRC, /**/ KC_AMPR, /**/ KC_ASTR, /**/ KC_LPRN, /**/ KC_RPRN, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_AMPR, /**/ KC_HOME, /**/ KC_UP, /**/ KC_END, /**/ KC_CIRC, /**/ KC_F7, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ /*==========================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*===============*/ KC_EXLM, /**/ KC_LEFT, /**/ KC_DOWN, /**/ KC_RIGHT, /**/ KC_COLN, /**/ KC_F8, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ /*==========================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_ENT, /**/ KC_PIPE, /**/ KC_UNDS, /**/ KC_LT, /**/ KC_GT, /**/ KC_BSLS, /**/ KC_F9, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ ___, /**/ ___, /**/ ___, /**/KC_F10,/**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=======================================================================*/ |
||||
|
||||
/*==============================*/ |
||||
/**/ /**/ /**/ |
||||
/**/ ___, /**/ ___, /**/ |
||||
/**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ /**/ /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*===============*/ /**/ /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_RSFT, /**/ ___ /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
), |
||||
|
||||
[NUM] = LAYOUT_ergodox( |
||||
|
||||
// Left side
|
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_F1, /**/ KC_F2, /**/ KC_F3, /**/ KC_F4, /**/ KC_F5, /**/ KC_F11, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_EXLM, /**/ KC_AT, /**/ KC_HASH, /**/ KC_DLR, /**/ KC_PERC, /**/ KC_ESC, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*==========================================================================================*/ /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_1, /**/ KC_2, /**/ KC_3, /**/ KC_4, /**/ KC_5, /*===============*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*==========================================================================================*/ /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_HASH, /**/ KC_PERC, /**/ KC_LBRC, /**/ KC_RBRC, /**/ KC_MINUS, /**/ KC_BSPC, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ ___, /**/ ___, /**/ KC_LALT, /**/ KC_LCTRL, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=======================================================================*/ |
||||
|
||||
|
||||
/*==============================*/ |
||||
/**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_DEL, /**/ |
||||
/**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ /**/ /**/ KC_LALT, /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ /**/ /*===============*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ KC_SPACE, /**/ KC_LGUI, /**/ KC_LCTRL, /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
|
||||
// Right side
|
||||
//
|
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_F12, /**/ KC_F6, /**/ KC_F7, /**/ KC_F8, /**/ KC_F9, /**/ KC_F10, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_CIRC, /**/ KC_AMPR, /**/ KC_ASTR, /**/ KC_LPRN, /**/ KC_RPRN, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ /*==========================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*===============*/ KC_6, /**/ KC_7, /**/ KC_8, /**/ KC_9, /**/ KC_0, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ /*==========================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ KC_ENT, /**/ KC_PIPE, /**/ KC_UNDS, /**/ KC_COMM, /**/ KC_DOT, /**/ KC_BSLS, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=========================================================================================================*/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ ___, /**/ ___, /**/ ___, /**/ ___, /**/ |
||||
/**/ /**/ /**/ /**/ /**/ /**/ |
||||
/*=======================================================================*/ |
||||
|
||||
/*==============================*/ |
||||
/**/ /**/ /**/ |
||||
/**/ ___, /**/ ___, /**/ |
||||
/**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ /**/ /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*===============*/ /**/ /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/**/ ___, /**/ KC_RSFT, /**/ ___ /**/ |
||||
/**/ /**/ /**/ /**/ |
||||
/*=============================================*/ |
||||
), |
||||
|
||||
}; |
@ -0,0 +1,14 @@ |
||||
{ |
||||
"keyboard_name": "Infinity Ergodox", |
||||
"manufacturer": "Input Club", |
||||
"identifier": "FEED:6464:0001", |
||||
"processor": "MK20DX256VLH7", |
||||
"bootloader": "KIIBOHD_BOOTLOADER", |
||||
"width": 19.5, |
||||
"height": 9.375, |
||||
"layouts": { |
||||
"KEYMAP": { |
||||
"layout": [{"label":"#", "x":3.5, "y":0}, {"label":"*", "x":15, "y":0}, {"label":"@", "x":2.5, "y":0.125}, {"label":"$", "x":4.5, "y":0.125}, {"label":"&", "x":14, "y":0.125}, {"label":"(", "x":16, "y":0.125}, {"label":"%", "x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, {"x":12, "y":0.25}, {"label":"^", "x":13, "y":0.25}, {"x":0, "y":0.375, "w":1.5}, {"label":"!", "x":1.5, "y":0.375}, {"label":")", "x":17, "y":0.375}, {"x":18, "y":0.375, "w":1.5}, {"label":"E", "x":3.5, "y":1}, {"label":"I", "x":15, "y":1}, {"label":"W", "x":2.5, "y":1.125}, {"label":"R", "x":4.5, "y":1.125}, {"label":"U", "x":14, "y":1.125}, {"label":"O", "x":16, "y":1.125}, {"label":"T", "x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, {"x":12, "y":1.25, "h":1.5}, {"label":"Y", "x":13, "y":1.25}, {"x":0, "y":1.375, "w":1.5}, {"label":"Q", "x":1.5, "y":1.375}, {"label":"P", "x":17, "y":1.375}, {"x":18, "y":1.375, "w":1.5}, {"label":"D", "x":3.5, "y":2}, {"label":"K", "x":15, "y":2}, {"label":"S", "x":2.5, "y":2.125}, {"label":"F", "x":4.5, "y":2.125}, {"label":"J", "x":14, "y":2.125}, {"label":"L", "x":16, "y":2.125}, {"label":"G", "x":5.5, "y":2.25}, {"label":"H", "x":13, "y":2.25}, {"x":0, "y":2.375, "w":1.5}, {"label":"A", "x":1.5, "y":2.375}, {"label":":", "x":17, "y":2.375}, {"x":18, "y":2.375, "w":1.5}, {"x":6.5, "y":2.75, "h":1.5}, {"x":12, "y":2.75, "h":1.5}, {"label":"C", "x":3.5, "y":3}, {"label":"<", "x":15, "y":3}, {"label":"X", "x":2.5, "y":3.125}, {"label":"V", "x":4.5, "y":3.125}, {"label":"M", "x":14, "y":3.125}, {"label":">", "x":16, "y":3.125}, {"label":"B", "x":5.5, "y":3.25}, {"label":"N", "x":13, "y":3.25}, {"x":0, "y":3.375, "w":1.5}, {"label":"Z", "x":1.5, "y":3.375}, {"label":"?", "x":17, "y":3.375}, {"x":18, "y":3.375, "w":1.5}, {"x":3.5, "y":4}, {"x":15, "y":4}, {"x":2.5, "y":4.125}, {"x":4.5, "y":4.125}, {"x":14, "y":4.125}, {"x":16, "y":4.125}, {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":17, "y":4.375}, {"x":18, "y":4.375}, {"x":1, "y":4.375}, {"x":2, "y":4.375}, {"x":0, "y":5.375, "h":2}, {"x":1, "y":5.375, "h":2}, {"x":2, "y":5.375}, {"x":2, "y":6.375}, {"x":-3.0, "y":6.375}, {"x":-2, "y":6.375}, {"x":-3.0, "y":7.375}, {"x":-2, "y":7.375, "h":2}, {"x":-1.0, "y":7.375, "h":2}, {"x":-3.0, "y":8.375}] |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,72 @@ |
||||
/*
|
||||
Copyright 2017 Fred Sundvik |
||||
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 "simple_visualizer.h" |
||||
|
||||
#define RED 0 |
||||
#define ORANGE 21 |
||||
#define YELLOW 42 |
||||
#define SPRING_GREEN 64 |
||||
#define GREEN 85 |
||||
#define TURQUOISE 107 |
||||
#define CYAN 127 |
||||
#define OCEAN 149 |
||||
#define BLUE 170 |
||||
#define VIOLET 192 |
||||
#define MAGENTA 212 |
||||
#define RASPBERRY 234 |
||||
|
||||
// This function should be implemented by the keymap visualizer
|
||||
// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
|
||||
// that the simple_visualizer assumes that you are updating
|
||||
// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
|
||||
// stopped. This can be done by either double buffering it or by using constant strings
|
||||
static void get_visualizer_layer_and_color(visualizer_state_t* state) { |
||||
uint8_t saturation = 255; |
||||
/* if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
|
||||
saturation = 255; |
||||
} */ |
||||
if (state->status.layer & 0x100) { |
||||
state->target_lcd_color = LCD_COLOR(MAGENTA, saturation, 0xFF); |
||||
state->layer_text = "Shortcuts Layer"; |
||||
} |
||||
else if (state->status.layer & 0x80) { |
||||
state->target_lcd_color = LCD_COLOR(VIOLET, saturation, 0xFF); |
||||
state->layer_text = "Plover"; |
||||
} |
||||
else if (state->status.layer & 0x40) { |
||||
state->target_lcd_color = LCD_COLOR(RASPBERRY, saturation, 0xFF); |
||||
state->layer_text = "Mirrored Symbols"; |
||||
} |
||||
else if (state->status.layer & 0x20) { |
||||
state->target_lcd_color = LCD_COLOR(RED, saturation, 0xFF); |
||||
state->layer_text = "Symbols"; |
||||
} |
||||
else if (state->status.layer & 0x8) { |
||||
state->target_lcd_color = LCD_COLOR(OCEAN, saturation, 0xFF); |
||||
state->layer_text = "Mirrored Dvorak"; |
||||
} |
||||
else if (state->status.layer & 0x4) { |
||||
state->target_lcd_color = LCD_COLOR(BLUE, saturation, 0xFF); |
||||
state->layer_text = "Dvorak"; |
||||
} |
||||
else if (state->status.layer & 0x2) { |
||||
state->target_lcd_color = LCD_COLOR(ORANGE, saturation, 0xFF); |
||||
state->layer_text = "Mirrored Qwerty"; |
||||
} |
||||
else { |
||||
state->target_lcd_color = LCD_COLOR(YELLOW, saturation, 0xFF); |
||||
state->layer_text = "Qwerty"; |
||||
} |
||||
} |
@ -0,0 +1,292 @@ |
||||
#include QMK_KEYBOARD_H |
||||
|
||||
/*
|
||||
NQN is not-quite-neo |
||||
A layout based on neo2 |
||||
*/ |
||||
|
||||
#include "action_layer.h" |
||||
#include "version.h" |
||||
|
||||
#include "nqn-keys-on-quertz-de-latin1.h" |
||||
#include "nqn-basic-layout.h" |
||||
|
||||
// Since our quirky block definitions are basically a list of comma separated
|
||||
// arguments, we need a wrapper in order for these definitions to be
|
||||
// expanded before being used as arguments to the LAYOUT_xxx macro.
|
||||
#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__) |
||||
|
||||
#ifdef LEADER_TIMEOUT |
||||
#undef LEADER_TIMEOUT |
||||
#endif |
||||
#define LEADER_TIMEOUT 300 |
||||
|
||||
#define TAP_ONCE(code) \ |
||||
register_code (code); \
|
||||
unregister_code (code) |
||||
|
||||
|
||||
// Automatic number generation of important keywords
|
||||
enum my_keycodes{ |
||||
// Layer numbers follow the neo2 terminology, i.e. base layer = layer 1
|
||||
L01 = 0, |
||||
/* L02, SHIFT is not (yet) implemented as a fully customizable layer */ |
||||
L03, |
||||
L04, |
||||
L05, |
||||
/* L06, UNSPECIFIED not (yet) needed */ |
||||
LFN |
||||
}; |
||||
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
/* L01 -> default: BASE LAYER
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------. |
||||
* | TAB | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | BACKSP | |
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| |
||||
* | ESC | | LEADR| | LEADR| | ENTER | |
||||
* |--------+ | | | | +--------| |
||||
* | L03 | L01_LEFT |------| |------| L01_RIGHT | L03 | |
||||
* |--------+ | LFN | | LFN | +--------| |
||||
* | SHIFT | | | | | | SHIFT | |
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' |
||||
* | CTRL | GUI | ALT | L05 | L04 | | L04 | L05 | ALTGR| LFN | CTRL | |
||||
* `----------------------------------' `----------------------------------' |
||||
* ,-------------. ,-------------. |
||||
* | HOME | END | | LEFT | RIGHT| |
||||
* ,------|------|------| |------+------+------. |
||||
* | | | PGUP | | UP | | | |
||||
* | SPACE| SHIFT|------| |------| SHIFT| SPACE| |
||||
* | | | PGDN | | DOWN | | | |
||||
* `--------------------' `--------------------' |
||||
*/ |
||||
[L01] = LAYOUT_ergodox_wrapper( |
||||
KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, XXXXXXX, |
||||
KC_ESC, L01_LEFT_01, KC_LEAD, |
||||
MO(L03), L01_LEFT_02, |
||||
KC_LSHIFT, L01_LEFT_03, MO(LFN), |
||||
KC_LCTRL,KC_LGUI,KC_LALT, MO(L05), MO(L04), |
||||
XXXXXXX, XXXXXXX, |
||||
KC_PGUP, |
||||
KC_SPACE,KC_LSHIFT,KC_PGDN, |
||||
//--
|
||||
XXXXXXX, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPACE, |
||||
KC_LEAD, L01_RIGHT_01, KC_ENTER, |
||||
L01_RIGHT_02, MO(L03), |
||||
MO(LFN), L01_RIGHT_03, KC_RSHIFT, |
||||
MO(L04), MO(L05), KC_RALT, MO(LFN), KC_RCTRL, |
||||
KC_LEFT, KC_RIGHT, |
||||
KC_UP, |
||||
KC_DOWN, KC_RSHIFT, KC_SPACE |
||||
), |
||||
|
||||
|
||||
/*
|
||||
L02 -> MO(L02): SHIFT (as a layer not used, not defined, not reachable) |
||||
*/ |
||||
|
||||
|
||||
/* L03 -> MO(L03): PROGRAMMING
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------. |
||||
* | | | | | | | | | | | | | | | | |
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| |
||||
* | | | | | | | | |
||||
* |--------+ | | | | +--------| |
||||
* | | L03_LEFT |------| |------| L03_RIGHT | | |
||||
* |--------+ | | | | +--------| |
||||
* | | | | | | | | |
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' |
||||
* | | | | | | | | | | | | |
||||
* `----------------------------------' `----------------------------------' |
||||
* ,-------------. ,-------------. |
||||
* | | | | | | |
||||
* ,------|------|------| |------+------+------. |
||||
* | | | | | | | | |
||||
* | | |------| |------| | | |
||||
* | | | | | | | | |
||||
* `--------------------' `--------------------' |
||||
*/ |
||||
[L03] = LAYOUT_ergodox_wrapper( |
||||
_______, _______, _______, _______, _______, _______, _______, |
||||
_______, L03_LEFT_01, _______, |
||||
_______, L03_LEFT_02, |
||||
_______, L03_LEFT_03, _______, |
||||
_______, _______, _______, _______, _______, |
||||
_______, _______, |
||||
_______, |
||||
_______, _______, _______, |
||||
//--
|
||||
_______, _______, _______, _______, _______, _______, _______, |
||||
_______, L03_RIGHT_01, _______, |
||||
L03_RIGHT_02, _______, |
||||
_______, L03_RIGHT_03, _______, |
||||
_______, _______, _______, _______, _______, |
||||
_______, _______, |
||||
_______, |
||||
_______, _______, _______ |
||||
), |
||||
|
||||
/* L04 -> MO(L04): NAVIGATION AND NUMBERS
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------. |
||||
* | | | | | | | | | | | | | | | | |
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| |
||||
* | | | | | | | | |
||||
* |--------+ | | | | +--------| |
||||
* | | L04_LEFT |------| |------| L04_RIGHT | | |
||||
* |--------+ | | | | +--------| |
||||
* | | | | | | | | |
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' |
||||
* | | | | | | | | | | | | |
||||
* `----------------------------------' `----------------------------------' |
||||
* ,-------------. ,-------------. |
||||
* | | | | | | |
||||
* ,------|------|------| |------+------+------. |
||||
* | | | | | | | | |
||||
* | 0 | |------| |------| | 0 | |
||||
* | | | | | | | | |
||||
* `--------------------' `--------------------' |
||||
*/ |
||||
[L04] = LAYOUT_ergodox_wrapper( |
||||
_______, _______, _______, _______, _______, _______, _______, |
||||
_______, L04_LEFT_01, _______, |
||||
_______, L04_LEFT_02, |
||||
_______, L04_LEFT_03, _______, |
||||
_______, _______, _______, _______, _______, |
||||
_______, _______, |
||||
_______, |
||||
KC_0, _______, _______, |
||||
//--
|
||||
_______, _______, _______, _______, _______, _______, _______, |
||||
_______, L04_RIGHT_01, _______, |
||||
L04_RIGHT_02, _______, |
||||
_______, L04_RIGHT_03, _______, |
||||
_______, _______, _______, _______, _______, |
||||
_______, _______, |
||||
_______, |
||||
_______, _______, KC_0 |
||||
), |
||||
|
||||
|
||||
/* L05 -> MO(L05): ALTERNATE
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------. |
||||
* | | | | | | | | | | | | | | | | |
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| |
||||
* | | | | | | | | |
||||
* |--------+ | | | | +--------| |
||||
* | | L05_LEFT |------| |------| L05_RIGHT | | |
||||
* |--------+ | | | | +--------| |
||||
* | | | | | | | | |
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' |
||||
* | | | | | | | | | | | | |
||||
* `----------------------------------' `----------------------------------' |
||||
* ,-------------. ,-------------. |
||||
* | | | | | | |
||||
* ,------|------|------| |------+------+------. |
||||
* | | | | | | | | |
||||
* | | |------| |------| | | |
||||
* | | | | | | | | |
||||
* `--------------------' `--------------------' |
||||
*/ |
||||
[L05] = LAYOUT_ergodox_wrapper( |
||||
_______, _______, _______, _______, _______, _______, _______, |
||||
_______, L05_LEFT_01, _______, |
||||
_______, L05_LEFT_02, |
||||
_______, L05_LEFT_03, _______, |
||||
_______, _______, _______, _______, _______, |
||||
_______, _______, |
||||
_______, |
||||
_______, _______, _______, |
||||
//--
|
||||
_______, _______, _______, _______, _______, _______, _______, |
||||
_______, L05_RIGHT_01, _______, |
||||
L05_RIGHT_02, _______, |
||||
_______, L05_RIGHT_03, _______, |
||||
_______, _______, _______, _______, _______, |
||||
_______, _______, |
||||
_______, |
||||
_______, _______, _______ |
||||
), |
||||
|
||||
|
||||
/*
|
||||
L06 -> <TBD>: UNSPECIFIED |
||||
*/ |
||||
|
||||
|
||||
/* LFN -> MO(FN): FUNCTION
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------. |
||||
* | RESET | | | | | | | | | | | | | | RESET | |
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| |
||||
* | | | | | | | BACKSPC| |
||||
* |--------+ | | | | +--------| |
||||
* | | L06_LEFT |------| |------| L06_RIGHT | INSERT | |
||||
* |--------+ | | | | +--------| |
||||
* | | | | | | | DELETE | |
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' |
||||
* | | | | | | | VOL+ | VOL- | MUTE | | | |
||||
* `----------------------------------' `----------------------------------' |
||||
* ,-------------. ,-------------. |
||||
* | | | | | | |
||||
* ,------|------|------| |------+------+------. |
||||
* | | | | | | | | |
||||
* | | |------| |------| | | |
||||
* | | | | | | | | |
||||
* `--------------------' `--------------------' |
||||
*/ |
||||
[LFN] = LAYOUT_ergodox_wrapper( |
||||
RESET, _______, _______, _______, _______, _______, _______, |
||||
_______, L06_LEFT_01, _______, |
||||
_______, L06_LEFT_02, |
||||
_______, L06_LEFT_03, _______, |
||||
_______, _______, _______, _______, _______, |
||||
_______, _______, |
||||
_______, |
||||
_______, _______, _______, |
||||
//--
|
||||
_______, _______, _______, _______, _______, _______, RESET, |
||||
_______, L06_RIGHT_01, KC_BSPACE, |
||||
L06_RIGHT_02, KC_INSERT, |
||||
_______, L06_RIGHT_03, KC_DELETE, |
||||
KC_VOLU, KC_VOLD, KC_MUTE, _______, _______, |
||||
_______, _______, |
||||
_______, |
||||
_______, _______, _______ |
||||
) |
||||
|
||||
}; |
||||
|
||||
|
||||
// Runs just one time when the keyboard initializes.
|
||||
void matrix_init_user(void) { |
||||
set_unicode_input_mode(UC_LNX); |
||||
}; |
||||
|
||||
|
||||
LEADER_EXTERNS(); |
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) { |
||||
LEADER_DICTIONARY() { |
||||
leading = false; |
||||
leader_end(); |
||||
|
||||
SEQ_ONE_KEY (KC_1) { |
||||
// ¯\_(ツ)_/¯
|
||||
unicode_input_start(); register_hex(0xaf); unicode_input_finish(); |
||||
register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT); |
||||
register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT); |
||||
unicode_input_start (); register_hex(0x30c4); unicode_input_finish(); |
||||
register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT); |
||||
unicode_input_start (); register_hex(0xaf); unicode_input_finish(); |
||||
} |
||||
|
||||
SEQ_ONE_KEY (KC_2) { |
||||
// 凸(ツ)凸
|
||||
unicode_input_start(); register_hex(0x51F8); unicode_input_finish(); |
||||
register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT); |
||||
unicode_input_start (); register_hex(0x30c4); unicode_input_finish(); |
||||
register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT); |
||||
unicode_input_start (); register_hex(0x51F8); unicode_input_finish(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,5 @@ |
||||
# not-quite-neo |
||||
|
||||
This is my personal take on porting the [neo2 layout](https://www.neo-layout.org/) to support multiple keyboards. |
||||
|
||||
Refer to the [readme.md](../../../../users/not-quite-neo/readme.md) of the generic parts of the implementation. |
@ -0,0 +1,2 @@ |
||||
BACKLIGHT_ENABLE = yes
|
||||
UNICODE_ENABLE = yes
|
@ -0,0 +1,244 @@ |
||||
// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0.
|
||||
// See gfxfont.h for newer custom bitmap font info.
|
||||
|
||||
#ifndef FONT5X7_H |
||||
#define FONT5X7_H |
||||
|
||||
#ifdef __AVR__ |
||||
#include <avr/io.h> |
||||
#include <avr/pgmspace.h> |
||||
#elif defined(ESP8266) |
||||
#include <pgmspace.h> |
||||
#else |
||||
#define PROGMEM |
||||
#endif |
||||
|
||||
// Standard ASCII 5x7 font
|
||||
|
||||
static const unsigned char font[] PROGMEM = { |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, |
||||
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, |
||||
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, |
||||
0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, |
||||
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, |
||||
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, |
||||
0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, |
||||
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, |
||||
0x00, 0x18, 0x24, 0x18, 0x00, 0x00, |
||||
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, |
||||
0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, |
||||
0x26, 0x29, 0x79, 0x29, 0x26, 0x00, |
||||
0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, |
||||
0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, |
||||
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, |
||||
0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, |
||||
0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, |
||||
0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, |
||||
0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, |
||||
0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, |
||||
0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, |
||||
0x60, 0x60, 0x60, 0x60, 0x60, 0x00, |
||||
0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, |
||||
0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, |
||||
0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, |
||||
0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, |
||||
0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, |
||||
0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, |
||||
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, |
||||
0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, |
||||
0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, |
||||
0x00, 0x07, 0x00, 0x07, 0x00, 0x00, |
||||
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, |
||||
0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, |
||||
0x23, 0x13, 0x08, 0x64, 0x62, 0x00, |
||||
0x36, 0x49, 0x56, 0x20, 0x50, 0x00, |
||||
0x00, 0x08, 0x07, 0x03, 0x00, 0x00, |
||||
0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, |
||||
0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, |
||||
0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, |
||||
0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, |
||||
0x00, 0x80, 0x70, 0x30, 0x00, 0x00, |
||||
0x08, 0x08, 0x08, 0x08, 0x08, 0x00, |
||||
0x00, 0x00, 0x60, 0x60, 0x00, 0x00, |
||||
0x20, 0x10, 0x08, 0x04, 0x02, 0x00, |
||||
0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, |
||||
0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, |
||||
0x72, 0x49, 0x49, 0x49, 0x46, 0x00, |
||||
0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, |
||||
0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, |
||||
0x27, 0x45, 0x45, 0x45, 0x39, 0x00, |
||||
0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, |
||||
0x41, 0x21, 0x11, 0x09, 0x07, 0x00, |
||||
0x36, 0x49, 0x49, 0x49, 0x36, 0x00, |
||||
0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, |
||||
0x00, 0x00, 0x14, 0x00, 0x00, 0x00, |
||||
0x00, 0x40, 0x34, 0x00, 0x00, 0x00, |
||||
0x00, 0x08, 0x14, 0x22, 0x41, 0x00, |
||||
0x14, 0x14, 0x14, 0x14, 0x14, 0x00, |
||||
0x00, 0x41, 0x22, 0x14, 0x08, 0x00, |
||||
0x02, 0x01, 0x59, 0x09, 0x06, 0x00, |
||||
0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, |
||||
0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, |
||||
0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, |
||||
0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, |
||||
0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, |
||||
0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, |
||||
0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, |
||||
0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, |
||||
0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, |
||||
0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, |
||||
0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, |
||||
0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, |
||||
0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, |
||||
0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, |
||||
0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, |
||||
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, |
||||
0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, |
||||
0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, |
||||
0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, |
||||
0x26, 0x49, 0x49, 0x49, 0x32, 0x00, |
||||
0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, |
||||
0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, |
||||
0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, |
||||
0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, |
||||
0x63, 0x14, 0x08, 0x14, 0x63, 0x00, |
||||
0x03, 0x04, 0x78, 0x04, 0x03, 0x00, |
||||
0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, |
||||
0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, |
||||
0x02, 0x04, 0x08, 0x10, 0x20, 0x00, |
||||
0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, |
||||
0x04, 0x02, 0x01, 0x02, 0x04, 0x00, |
||||
0x40, 0x40, 0x40, 0x40, 0x40, 0x00, |
||||
0x00, 0x03, 0x07, 0x08, 0x00, 0x00, |
||||
0x20, 0x54, 0x54, 0x78, 0x40, 0x00, |
||||
0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, |
||||
0x38, 0x44, 0x44, 0x44, 0x28, 0x00, |
||||
0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, |
||||
0x38, 0x54, 0x54, 0x54, 0x18, 0x00, |
||||
0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, |
||||
0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00, |
||||
0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, |
||||
0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, |
||||
0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, |
||||
0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, |
||||
0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, |
||||
0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, |
||||
0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, |
||||
0x38, 0x44, 0x44, 0x44, 0x38, 0x00, |
||||
0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, |
||||
0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, |
||||
0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, |
||||
0x48, 0x54, 0x54, 0x54, 0x24, 0x00, |
||||
0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, |
||||
0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, |
||||
0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, |
||||
0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, |
||||
0x44, 0x28, 0x10, 0x28, 0x44, 0x00, |
||||
0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, |
||||
0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, |
||||
0x00, 0x08, 0x36, 0x41, 0x00, 0x00, |
||||
0x00, 0x00, 0x77, 0x00, 0x00, 0x00, |
||||
0x00, 0x41, 0x36, 0x08, 0x00, 0x00, |
||||
0x02, 0x01, 0x02, 0x04, 0x02, 0x00, |
||||
0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, |
||||
0x03, 0x07, 0x1F, 0x7F, 0xFF, 0xFF, |
||||
0xFE, 0xF8, 0xF0, 0xC0, 0x20, 0xF8, |
||||
0xFE, 0xFF, 0xFE, 0x79, 0x27, 0x1F, |
||||
0x7F, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, |
||||
0xC0, 0x20, 0xF8, 0xFE, 0xFF, 0xFF, |
||||
0x7F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFE, |
||||
0xF8, 0xF0, 0xC0, 0x00, 0x00, 0x00, |
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0xFF, 0x7F, 0x7F, 0x7F, |
||||
0xBF, 0xBF, 0xC0, 0xC0, 0xC0, 0xE0, |
||||
0xE0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF0, |
||||
0xF8, 0x78, 0x78, 0x7C, 0x3C, 0x3C, |
||||
0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x80, 0x80, |
||||
0xBF, 0xBF, 0xDF, 0xDF, 0xEF, 0xEF, |
||||
0x00, 0x03, 0x07, 0x1F, 0x7F, 0xFF, |
||||
0xFF, 0xFF, 0xFE, 0xF8, 0xE0, 0xC0, |
||||
0xE0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, |
||||
0x7F, 0x1F, 0x07, 0x03, 0x00, 0x00, |
||||
0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, |
||||
0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, |
||||
0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, |
||||
0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, |
||||
0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, |
||||
0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, |
||||
0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, |
||||
0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0xC1, 0xF3, |
||||
0xCF, 0xBF, 0x7F, 0xFF, 0xFF, 0xFC, |
||||
0xFB, 0xE7, 0x81, 0x00, 0x00, 0x00, |
||||
0x00, 0x80, 0xE3, 0xCF, 0x3F, 0xFF, |
||||
0xFF, 0xFF, 0xFC, 0xFB, 0xE7, 0x81, |
||||
0x00, 0x00, 0x00, 0x00, 0x81, 0xE7, |
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x3C, 0x00, |
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
||||
0xFF, 0xF8, 0xF8, 0xFC, 0x7C, 0x7E, |
||||
0x7E, 0x3E, 0xFE, 0xFF, 0xFF, 0xFF, |
||||
0xFF, 0xFF, 0xF7, 0xF7, 0xF7, 0xFB, |
||||
0xFB, 0x7D, 0x7D, 0x7D, 0xBE, 0xBE, |
||||
0xBE, 0xDF, 0xDF, 0xE0, 0xE0, 0x00, |
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
||||
0x00, 0xFC, 0xFC, 0x7C, 0x7E, 0x7E, |
||||
0x3E, 0x3E, 0x1F, 0x1F, 0x1F, 0x0F, |
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x81, |
||||
0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0x81, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, |
||||
0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, |
||||
0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, |
||||
0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, |
||||
0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, |
||||
0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, |
||||
0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, |
||||
0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x60, 0x70, 0x7C, 0x7F, 0x7F, 0x7F, |
||||
0x7F, 0x1F, 0x06, 0x01, 0x03, 0x0F, |
||||
0x3F, 0x7F, 0x7F, 0x7E, 0x7C, 0x7C, |
||||
0x7E, 0x7F, 0x7F, 0x7F, 0x1F, 0x06, |
||||
0x01, 0x07, 0x0F, 0x3F, 0x7F, 0x7F, |
||||
0x7E, 0x7C, 0x7C, 0x7E, 0x7F, 0x7F, |
||||
0x3F, 0x0F, 0x03, 0x00, 0x00, 0x00, |
||||
0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, |
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, |
||||
0x7F, 0x7F, 0x7D, 0x7D, 0x3D, 0x3E, |
||||
0x1E, 0x1F, 0x1F, 0x1F, 0x0F, 0x0F, |
||||
0x07, 0x07, 0x07, 0x03, 0x03, 0x00, |
||||
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, |
||||
0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, |
||||
0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x00, |
||||
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, |
||||
0x00, 0x40, 0x70, 0x78, 0x7E, 0x7F, |
||||
0x7F, 0x7F, 0x3F, 0x0F, 0x03, 0x01, |
||||
0x03, 0x0F, 0x3F, 0x7F, 0x7F, 0x7F, |
||||
0x7E, 0x78, 0x70, 0x40, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
||||
}; |
||||
#endif // FONT5X7_H
|
@ -0,0 +1,28 @@ |
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com> |
||||
Copyright 2015 Jack Humbert |
||||
|
||||
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" |
||||
|
||||
#ifdef SUBPROJECT_rev1 |
||||
#include "rev1/config.h" |
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1 @@ |
||||
#include "helix.h" |
@ -0,0 +1,57 @@ |
||||
#ifndef HELIX_H |
||||
#define HELIX_H |
||||
|
||||
#ifdef KEYBOARD_helix_rev1 |
||||
#include "rev1.h" |
||||
#endif |
||||
#ifdef KEYBOARD_helix_rev2 |
||||
#include "rev2.h" |
||||
#endif |
||||
|
||||
#if HELIX_ROWS == 3 |
||||
#define KC_KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
) \
|
||||
KEYMAP( \
|
||||
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
|
||||
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
|
||||
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
|
||||
) |
||||
#elif HELIX_ROWS == 4 |
||||
// Used to create a keymap using only KC_ prefixed keys
|
||||
#define KC_KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
|
||||
) \
|
||||
KEYMAP( \
|
||||
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
|
||||
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
|
||||
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
|
||||
KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \
|
||||
) |
||||
#elif HELIX_ROWS == 5 |
||||
#define KC_KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \
|
||||
L40, L41, L42, L43, L44, L45, R40, R41, R42, R43, R44, R45 \
|
||||
) \
|
||||
KEYMAP( \
|
||||
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
|
||||
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
|
||||
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
|
||||
KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, \
|
||||
KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##L45, KC_##R40, KC_##R41, KC_##R42, KC_##R43, KC_##R44, KC_##R45 \
|
||||
) |
||||
#else |
||||
#error "expected HELIX_ROWS 3 or 4 or 5" |
||||
#endif |
||||
|
||||
#include "quantum.h" |
||||
|
||||
#endif |
@ -0,0 +1,162 @@ |
||||
#include <util/twi.h> |
||||
#include <avr/io.h> |
||||
#include <stdlib.h> |
||||
#include <avr/interrupt.h> |
||||
#include <util/twi.h> |
||||
#include <stdbool.h> |
||||
#include "i2c.h" |
||||
|
||||
#ifdef USE_I2C |
||||
|
||||
// Limits the amount of we wait for any one i2c transaction.
|
||||
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
||||
// 9 bits, a single transaction will take around 90μs to complete.
|
||||
//
|
||||
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
|
||||
// poll loop takes at least 8 clock cycles to execute
|
||||
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 |
||||
|
||||
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) |
||||
|
||||
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; |
||||
|
||||
static volatile uint8_t slave_buffer_pos; |
||||
static volatile bool slave_has_register_set = false; |
||||
|
||||
// Wait for an i2c operation to finish
|
||||
inline static |
||||
void i2c_delay(void) { |
||||
uint16_t lim = 0; |
||||
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) |
||||
lim++; |
||||
|
||||
// easier way, but will wait slightly longer
|
||||
// _delay_us(100);
|
||||
} |
||||
|
||||
// Setup twi to run at 100kHz
|
||||
void i2c_master_init(void) { |
||||
// no prescaler
|
||||
TWSR = 0; |
||||
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
|
||||
// Check datasheets for more info.
|
||||
TWBR = ((F_CPU/SCL_CLOCK)-16)/2; |
||||
} |
||||
|
||||
// Start a transaction with the given i2c slave address. The direction of the
|
||||
// transfer is set with I2C_READ and I2C_WRITE.
|
||||
// returns: 0 => success
|
||||
// 1 => error
|
||||
uint8_t i2c_master_start(uint8_t address) { |
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); |
||||
|
||||
i2c_delay(); |
||||
|
||||
// check that we started successfully
|
||||
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) |
||||
return 1; |
||||
|
||||
TWDR = address; |
||||
TWCR = (1<<TWINT) | (1<<TWEN); |
||||
|
||||
i2c_delay(); |
||||
|
||||
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) |
||||
return 1; // slave did not acknowledge
|
||||
else |
||||
return 0; // success
|
||||
} |
||||
|
||||
|
||||
// Finish the i2c transaction.
|
||||
void i2c_master_stop(void) { |
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); |
||||
|
||||
uint16_t lim = 0; |
||||
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) |
||||
lim++; |
||||
} |
||||
|
||||
// Write one byte to the i2c slave.
|
||||
// returns 0 => slave ACK
|
||||
// 1 => slave NACK
|
||||
uint8_t i2c_master_write(uint8_t data) { |
||||
TWDR = data; |
||||
TWCR = (1<<TWINT) | (1<<TWEN); |
||||
|
||||
i2c_delay(); |
||||
|
||||
// check if the slave acknowledged us
|
||||
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; |
||||
} |
||||
|
||||
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
|
||||
// if ack=0 the acknowledge bit is not set.
|
||||
// returns: byte read from i2c device
|
||||
uint8_t i2c_master_read(int ack) { |
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); |
||||
|
||||
i2c_delay(); |
||||
return TWDR; |
||||
} |
||||
|
||||
void i2c_reset_state(void) { |
||||
TWCR = 0; |
||||
} |
||||
|
||||
void i2c_slave_init(uint8_t address) { |
||||
TWAR = address << 0; // slave i2c address
|
||||
// TWEN - twi enable
|
||||
// TWEA - enable address acknowledgement
|
||||
// TWINT - twi interrupt flag
|
||||
// TWIE - enable the twi interrupt
|
||||
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); |
||||
} |
||||
|
||||
ISR(TWI_vect); |
||||
|
||||
ISR(TWI_vect) { |
||||
uint8_t ack = 1; |
||||
switch(TW_STATUS) { |
||||
case TW_SR_SLA_ACK: |
||||
// this device has been addressed as a slave receiver
|
||||
slave_has_register_set = false; |
||||
break; |
||||
|
||||
case TW_SR_DATA_ACK: |
||||
// this device has received data as a slave receiver
|
||||
// The first byte that we receive in this transaction sets the location
|
||||
// of the read/write location of the slaves memory that it exposes over
|
||||
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
|
||||
// slave_buffer_pos after each write.
|
||||
if(!slave_has_register_set) { |
||||
slave_buffer_pos = TWDR; |
||||
// don't acknowledge the master if this memory loctaion is out of bounds
|
||||
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { |
||||
ack = 0; |
||||
slave_buffer_pos = 0; |
||||
} |
||||
slave_has_register_set = true; |
||||
} else { |
||||
i2c_slave_buffer[slave_buffer_pos] = TWDR; |
||||
BUFFER_POS_INC(); |
||||
} |
||||
break; |
||||
|
||||
case TW_ST_SLA_ACK: |
||||
case TW_ST_DATA_ACK: |
||||
// master has addressed this device as a slave transmitter and is
|
||||
// requesting data.
|
||||
TWDR = i2c_slave_buffer[slave_buffer_pos]; |
||||
BUFFER_POS_INC(); |
||||
break; |
||||
|
||||
case TW_BUS_ERROR: // something went wrong, reset twi state
|
||||
TWCR = 0; |
||||
default: |
||||
break; |
||||
} |
||||
// Reset everything, so we are ready for the next TWI interrupt
|
||||
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); |
||||
} |
||||
#endif |
@ -0,0 +1,49 @@ |
||||
#ifndef I2C_H |
||||
#define I2C_H |
||||
|
||||
#include <stdint.h> |
||||
|
||||
#ifndef F_CPU |
||||
#define F_CPU 16000000UL |
||||
#endif |
||||
|
||||
#define I2C_READ 1 |
||||
#define I2C_WRITE 0 |
||||
|
||||
#define I2C_ACK 1 |
||||
#define I2C_NACK 0 |
||||
|
||||
#define SLAVE_BUFFER_SIZE 0x10 |
||||
|
||||
// i2c SCL clock frequency
|
||||
#define SCL_CLOCK 400000L |
||||
|
||||
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; |
||||
|
||||
void i2c_master_init(void); |
||||
uint8_t i2c_master_start(uint8_t address); |
||||
void i2c_master_stop(void); |
||||
uint8_t i2c_master_write(uint8_t data); |
||||
uint8_t i2c_master_read(int); |
||||
void i2c_reset_state(void); |
||||
void i2c_slave_init(uint8_t address); |
||||
|
||||
|
||||
static inline unsigned char i2c_start_read(unsigned char addr) { |
||||
return i2c_master_start((addr << 1) | I2C_READ); |
||||
} |
||||
|
||||
static inline unsigned char i2c_start_write(unsigned char addr) { |
||||
return i2c_master_start((addr << 1) | I2C_WRITE); |
||||
} |
||||
|
||||
// from SSD1306 scrips
|
||||
extern unsigned char i2c_rep_start(unsigned char addr); |
||||
extern void i2c_start_wait(unsigned char addr); |
||||
extern unsigned char i2c_readAck(void); |
||||
extern unsigned char i2c_readNak(void); |
||||
extern unsigned char i2c_read(unsigned char ack); |
||||
|
||||
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); |
||||
|
||||
#endif |
@ -0,0 +1,362 @@ |
||||
/*
|
||||
pins_arduino.h - Pin definition functions for Arduino |
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2007 David A. Mellis |
||||
|
||||
This library is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU Lesser General Public |
||||
License as published by the Free Software Foundation; either |
||||
version 2.1 of the License, or (at your option) any later version. |
||||
|
||||
This library 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 |
||||
Lesser General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Lesser General |
||||
Public License along with this library; if not, write to the |
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
||||
Boston, MA 02111-1307 USA |
||||
|
||||
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ |
||||
*/ |
||||
|
||||
#ifndef Pins_Arduino_h |
||||
#define Pins_Arduino_h |
||||
|
||||
#include <avr/pgmspace.h> |
||||
|
||||
// Workaround for wrong definitions in "iom32u4.h".
|
||||
// This should be fixed in the AVR toolchain.
|
||||
#undef UHCON |
||||
#undef UHINT |
||||
#undef UHIEN |
||||
#undef UHADDR |
||||
#undef UHFNUM |
||||
#undef UHFNUML |
||||
#undef UHFNUMH |
||||
#undef UHFLEN |
||||
#undef UPINRQX |
||||
#undef UPINTX |
||||
#undef UPNUM |
||||
#undef UPRST |
||||
#undef UPCONX |
||||
#undef UPCFG0X |
||||
#undef UPCFG1X |
||||
#undef UPSTAX |
||||
#undef UPCFG2X |
||||
#undef UPIENX |
||||
#undef UPDATX |
||||
#undef TCCR2A |
||||
#undef WGM20 |
||||
#undef WGM21 |
||||
#undef COM2B0 |
||||
#undef COM2B1 |
||||
#undef COM2A0 |
||||
#undef COM2A1 |
||||
#undef TCCR2B |
||||
#undef CS20 |
||||
#undef CS21 |
||||
#undef CS22 |
||||
#undef WGM22 |
||||
#undef FOC2B |
||||
#undef FOC2A |
||||
#undef TCNT2 |
||||
#undef TCNT2_0 |
||||
#undef TCNT2_1 |
||||
#undef TCNT2_2 |
||||
#undef TCNT2_3 |
||||
#undef TCNT2_4 |
||||
#undef TCNT2_5 |
||||
#undef TCNT2_6 |
||||
#undef TCNT2_7 |
||||
#undef OCR2A |
||||
#undef OCR2_0 |
||||
#undef OCR2_1 |
||||
#undef OCR2_2 |
||||
#undef OCR2_3 |
||||
#undef OCR2_4 |
||||
#undef OCR2_5 |
||||
#undef OCR2_6 |
||||
#undef OCR2_7 |
||||
#undef OCR2B |
||||
#undef OCR2_0 |
||||
#undef OCR2_1 |
||||
#undef OCR2_2 |
||||
#undef OCR2_3 |
||||
#undef OCR2_4 |
||||
#undef OCR2_5 |
||||
#undef OCR2_6 |
||||
#undef OCR2_7 |
||||
|
||||
#define NUM_DIGITAL_PINS 30 |
||||
#define NUM_ANALOG_INPUTS 12 |
||||
|
||||
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) |
||||
#define TXLED0 PORTD |= (1<<5) |
||||
#define TXLED1 PORTD &= ~(1<<5) |
||||
#define RXLED0 PORTB |= (1<<0) |
||||
#define RXLED1 PORTB &= ~(1<<0) |
||||
|
||||
static const uint8_t SDA = 2; |
||||
static const uint8_t SCL = 3; |
||||
#define LED_BUILTIN 13 |
||||
|
||||
// Map SPI port to 'new' pins D14..D17
|
||||
static const uint8_t SS = 17; |
||||
static const uint8_t MOSI = 16; |
||||
static const uint8_t MISO = 14; |
||||
static const uint8_t SCK = 15; |
||||
|
||||
// Mapping of analog pins as digital I/O
|
||||
// A6-A11 share with digital pins
|
||||
static const uint8_t ADC0 = 18; |
||||
static const uint8_t ADC1 = 19; |
||||
static const uint8_t ADC2 = 20; |
||||
static const uint8_t ADC3 = 21; |
||||
static const uint8_t ADC4 = 22; |
||||
static const uint8_t ADC5 = 23; |
||||
static const uint8_t ADC6 = 24; // D4
|
||||
static const uint8_t ADC7 = 25; // D6
|
||||
static const uint8_t ADC8 = 26; // D8
|
||||
static const uint8_t ADC9 = 27; // D9
|
||||
static const uint8_t ADC10 = 28; // D10
|
||||
static const uint8_t ADC11 = 29; // D12
|
||||
|
||||
#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) |
||||
#define digitalPinToPCICRbit(p) 0 |
||||
#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) |
||||
#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) |
||||
|
||||
// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
|
||||
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; |
||||
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) |
||||
|
||||
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) |
||||
|
||||
#ifdef ARDUINO_MAIN |
||||
|
||||
// On the Arduino board, digital pins are also used
|
||||
// for the analog output (software PWM). Analog input
|
||||
// pins are a separate set.
|
||||
|
||||
// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
|
||||
//
|
||||
// D0 PD2 RXD1/INT2
|
||||
// D1 PD3 TXD1/INT3
|
||||
// D2 PD1 SDA SDA/INT1
|
||||
// D3# PD0 PWM8/SCL OC0B/SCL/INT0
|
||||
// D4 A6 PD4 ADC8
|
||||
// D5# PC6 ??? OC3A/#OC4A
|
||||
// D6# A7 PD7 FastPWM #OC4D/ADC10
|
||||
// D7 PE6 INT6/AIN0
|
||||
//
|
||||
// D8 A8 PB4 ADC11/PCINT4
|
||||
// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
|
||||
// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
|
||||
// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
|
||||
// D12 A11 PD6 T1/#OC4D/ADC9
|
||||
// D13# PC7 PWM10 CLK0/OC4A
|
||||
//
|
||||
// A0 D18 PF7 ADC7
|
||||
// A1 D19 PF6 ADC6
|
||||
// A2 D20 PF5 ADC5
|
||||
// A3 D21 PF4 ADC4
|
||||
// A4 D22 PF1 ADC1
|
||||
// A5 D23 PF0 ADC0
|
||||
//
|
||||
// New pins D14..D17 to map SPI port to digital pins
|
||||
//
|
||||
// MISO D14 PB3 MISO,PCINT3
|
||||
// SCK D15 PB1 SCK,PCINT1
|
||||
// MOSI D16 PB2 MOSI,PCINT2
|
||||
// SS D17 PB0 RXLED,SS/PCINT0
|
||||
//
|
||||
// Connected LEDs on board for TX and RX
|
||||
// TXLED D24 PD5 XCK1
|
||||
// RXLED D17 PB0
|
||||
// HWB PE2 HWB
|
||||
|
||||
// these arrays map port names (e.g. port B) to the
|
||||
// appropriate addresses for various functions (e.g. reading
|
||||
// and writing)
|
||||
const uint16_t PROGMEM port_to_mode_PGM[] = { |
||||
NOT_A_PORT, |
||||
NOT_A_PORT, |
||||
(uint16_t) &DDRB, |
||||
(uint16_t) &DDRC, |
||||
(uint16_t) &DDRD, |
||||
(uint16_t) &DDRE, |
||||
(uint16_t) &DDRF, |
||||
}; |
||||
|
||||
const uint16_t PROGMEM port_to_output_PGM[] = { |
||||
NOT_A_PORT, |
||||
NOT_A_PORT, |
||||
(uint16_t) &PORTB, |
||||
(uint16_t) &PORTC, |
||||
(uint16_t) &PORTD, |
||||
(uint16_t) &PORTE, |
||||
(uint16_t) &PORTF, |
||||
}; |
||||
|
||||
const uint16_t PROGMEM port_to_input_PGM[] = { |
||||
NOT_A_PORT, |
||||
NOT_A_PORT, |
||||
(uint16_t) &PINB, |
||||
(uint16_t) &PINC, |
||||
(uint16_t) &PIND, |
||||
(uint16_t) &PINE, |
||||
(uint16_t) &PINF, |
||||
}; |
||||
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] = { |
||||
PD, // D0 - PD2
|
||||
PD, // D1 - PD3
|
||||
PD, // D2 - PD1
|
||||
PD, // D3 - PD0
|
||||
PD, // D4 - PD4
|
||||
PC, // D5 - PC6
|
||||
PD, // D6 - PD7
|
||||
PE, // D7 - PE6
|
||||
|
||||
PB, // D8 - PB4
|
||||
PB, // D9 - PB5
|
||||
PB, // D10 - PB6
|
||||
PB, // D11 - PB7
|
||||
PD, // D12 - PD6
|
||||
PC, // D13 - PC7
|
||||
|
||||
PB, // D14 - MISO - PB3
|
||||
PB, // D15 - SCK - PB1
|
||||
PB, // D16 - MOSI - PB2
|
||||
PB, // D17 - SS - PB0
|
||||
|
||||
PF, // D18 - A0 - PF7
|
||||
PF, // D19 - A1 - PF6
|
||||
PF, // D20 - A2 - PF5
|
||||
PF, // D21 - A3 - PF4
|
||||
PF, // D22 - A4 - PF1
|
||||
PF, // D23 - A5 - PF0
|
||||
|
||||
PD, // D24 - PD5
|
||||
PD, // D25 / D6 - A7 - PD7
|
||||
PB, // D26 / D8 - A8 - PB4
|
||||
PB, // D27 / D9 - A9 - PB5
|
||||
PB, // D28 / D10 - A10 - PB6
|
||||
PD, // D29 / D12 - A11 - PD6
|
||||
}; |
||||
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { |
||||
_BV(2), // D0 - PD2
|
||||
_BV(3), // D1 - PD3
|
||||
_BV(1), // D2 - PD1
|
||||
_BV(0), // D3 - PD0
|
||||
_BV(4), // D4 - PD4
|
||||
_BV(6), // D5 - PC6
|
||||
_BV(7), // D6 - PD7
|
||||
_BV(6), // D7 - PE6
|
||||
|
||||
_BV(4), // D8 - PB4
|
||||
_BV(5), // D9 - PB5
|
||||
_BV(6), // D10 - PB6
|
||||
_BV(7), // D11 - PB7
|
||||
_BV(6), // D12 - PD6
|
||||
_BV(7), // D13 - PC7
|
||||
|
||||
_BV(3), // D14 - MISO - PB3
|
||||
_BV(1), // D15 - SCK - PB1
|
||||
_BV(2), // D16 - MOSI - PB2
|
||||
_BV(0), // D17 - SS - PB0
|
||||
|
||||
_BV(7), // D18 - A0 - PF7
|
||||
_BV(6), // D19 - A1 - PF6
|
||||
_BV(5), // D20 - A2 - PF5
|
||||
_BV(4), // D21 - A3 - PF4
|
||||
_BV(1), // D22 - A4 - PF1
|
||||
_BV(0), // D23 - A5 - PF0
|
||||
|
||||
_BV(5), // D24 - PD5
|
||||
_BV(7), // D25 / D6 - A7 - PD7
|
||||
_BV(4), // D26 / D8 - A8 - PB4
|
||||
_BV(5), // D27 / D9 - A9 - PB5
|
||||
_BV(6), // D28 / D10 - A10 - PB6
|
||||
_BV(6), // D29 / D12 - A11 - PD6
|
||||
}; |
||||
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
TIMER0B, /* 3 */ |
||||
NOT_ON_TIMER, |
||||
TIMER3A, /* 5 */ |
||||
TIMER4D, /* 6 */ |
||||
NOT_ON_TIMER, |
||||
|
||||
NOT_ON_TIMER, |
||||
TIMER1A, /* 9 */ |
||||
TIMER1B, /* 10 */ |
||||
TIMER0A, /* 11 */ |
||||
|
||||
NOT_ON_TIMER, |
||||
TIMER4A, /* 13 */ |
||||
|
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
|
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
NOT_ON_TIMER, |
||||
}; |
||||
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { |
||||
7, // A0 PF7 ADC7
|
||||
6, // A1 PF6 ADC6
|
||||
5, // A2 PF5 ADC5
|
||||
4, // A3 PF4 ADC4
|
||||
1, // A4 PF1 ADC1
|
||||
0, // A5 PF0 ADC0
|
||||
8, // A6 D4 PD4 ADC8
|
||||
10, // A7 D6 PD7 ADC10
|
||||
11, // A8 D8 PB4 ADC11
|
||||
12, // A9 D9 PB5 ADC12
|
||||
13, // A10 D10 PB6 ADC13
|
||||
9 // A11 D12 PD6 ADC9
|
||||
}; |
||||
|
||||
#endif /* ARDUINO_MAIN */ |
||||
|
||||
// These serial port names are intended to allow libraries and architecture-neutral
|
||||
// sketches to automatically default to the correct port name for a particular type
|
||||
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
|
||||
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
|
||||
//
|
||||
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
|
||||
//
|
||||
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
|
||||
//
|
||||
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
|
||||
// pins are NOT connected to anything by default.
|
||||
#define SERIAL_PORT_MONITOR Serial |
||||
#define SERIAL_PORT_USBVIRTUAL Serial |
||||
#define SERIAL_PORT_HARDWARE Serial1 |
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1 |
||||
|
||||
#endif /* Pins_Arduino_h */ |
@ -0,0 +1,16 @@ |
||||
Helix |
||||
=== |
||||
|
||||
 |
||||
|
||||
A compact split ortholinear keyboard. |
||||
|
||||
Keyboard Maintainer: [Makoto Kurauchi](https://github.com/MakotoKurauchi/) [@pluis9](https://twitter.com/pluis9) |
||||
Hardware Supported: Helix PCB Alpha, Beta, Pro Micro |
||||
Hardware Availability: [PCB & Case Data](https://github.com/MakotoKurauchi/helix), [Yushakobo Shop](https://yushakobo.jp/shop/) |
||||
|
||||
Make example for this keyboard (after setting up your build environment): |
||||
|
||||
make helix:default |
||||
|
||||
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. |
@ -0,0 +1,103 @@ |
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com> |
||||
Copyright 2015 Jack Humbert |
||||
|
||||
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 REV1_CONFIG_H |
||||
#define REV1_CONFIG_H |
||||
|
||||
#include "../config.h" |
||||
|
||||
/* USB Device descriptor parameter */ |
||||
#define VENDOR_ID 0xFEED |
||||
#define PRODUCT_ID 0x3060 |
||||
#define DEVICE_VER 0x0001 |
||||
#define MANUFACTURER Yushakobo |
||||
#define PRODUCT Helix Alpha |
||||
#define DESCRIPTION A split keyboard for the cheap makers |
||||
|
||||
#define HELIX_ROWS 5 |
||||
|
||||
/* key matrix size */ |
||||
// Rows are doubled-up
|
||||
#if HELIX_ROWS == 3 |
||||
#define MATRIX_ROWS 6 |
||||
#define MATRIX_COLS 6 |
||||
#define MATRIX_ROW_PINS { D7, E6, B4 } |
||||
#elif HELIX_ROWS == 4 |
||||
#define MATRIX_ROWS 8 |
||||
#define MATRIX_COLS 6 |
||||
#define MATRIX_ROW_PINS { D7, E6, B4, B5 } |
||||
#elif HELIX_ROWS == 5 |
||||
#define MATRIX_ROWS 10 |
||||
#define MATRIX_COLS 6 |
||||
#define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 } |
||||
#else |
||||
#error "expected HELIX_ROWS 3 or 4 or 5" |
||||
#endif |
||||
|
||||
// wiring of each half
|
||||
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } |
||||
// #define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6 } //uncomment this line and comment line above if you need to reverse left-to-right key order
|
||||
|
||||
#define CATERINA_BOOTLOADER |
||||
|
||||
/* 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 DEBOUNCING_DELAY 5 |
||||
|
||||
/* 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)) \
|
||||
) |
||||
|
||||
/* ws2812 RGB LED */ |
||||
#define RGB_DI_PIN D3 |
||||
#define RGBLIGHT_TIMER |
||||
#define RGBLED_NUM 12 // Number of LEDs
|
||||
#define ws2812_PORTREG PORTD |
||||
#define ws2812_DDRREG DDRD |
||||
|
||||
/*
|
||||
* 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 |
@ -0,0 +1,54 @@ |
||||
/*
|
||||
This is the c configuration file for the keymap |
||||
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com> |
||||
Copyright 2015 Jack Humbert |
||||
|
||||
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_USER_H |
||||
#define CONFIG_USER_H |
||||
|
||||
#include "../../config.h" |
||||
|
||||
/* Use I2C or Serial */ |
||||
|
||||
#define USE_I2C |
||||
#define USE_SERIAL |
||||
//#define USE_MATRIX_I2C
|
||||
|
||||
/* Select hand configuration */ |
||||
|
||||
#define MASTER_LEFT |
||||
// #define _MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
#define SSD1306OLED |
||||
|
||||
#define USE_SERIAL_PD2 |
||||
|
||||
#define PREVENT_STUCK_MODIFIERS |
||||
#define TAPPING_FORCE_HOLD |
||||
#define TAPPING_TERM 100 |
||||
|
||||
|
||||
#undef RGBLED_NUM |
||||
#define RGBLIGHT_ANIMATIONS |
||||
#define RGBLED_NUM 6 |
||||
#define RGBLIGHT_HUE_STEP 10 |
||||
#define RGBLIGHT_SAT_STEP 17 |
||||
#define RGBLIGHT_VAL_STEP 17 |
||||
|
||||
#endif |
@ -0,0 +1,498 @@ |
||||
#include "helix.h" |
||||
#include "bootloader.h" |
||||
#include "action_layer.h" |
||||
#include "eeconfig.h" |
||||
#include "LUFA/Drivers/Peripheral/TWI.h" |
||||
#ifdef AUDIO_ENABLE |
||||
#include "audio.h" |
||||
#endif |
||||
#ifdef SSD1306OLED |
||||
#include "ssd1306.h" |
||||
#endif |
||||
|
||||
extern keymap_config_t keymap_config; |
||||
|
||||
//Following line allows macro to read current RGB settings
|
||||
extern rgblight_config_t rgblight_config; |
||||
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
#define _QWERTY 0 |
||||
#define _COLEMAK 1 |
||||
#define _DVORAK 2 |
||||
#define _LOWER 3 |
||||
#define _RAISE 4 |
||||
#define _ADJUST 16 |
||||
|
||||
enum custom_keycodes { |
||||
QWERTY = SAFE_RANGE, |
||||
COLEMAK, |
||||
DVORAK, |
||||
LOWER, |
||||
RAISE, |
||||
ADJUST, |
||||
BACKLIT, |
||||
RGBLED_TOGGLE, |
||||
RGBLED_STEP_MODE, |
||||
RGBLED_INCREASE_HUE, |
||||
RGBLED_DECREASE_HUE, |
||||
RGBLED_INCREASE_SAT, |
||||
RGBLED_DECREASE_SAT, |
||||
RGBLED_INCREASE_VAL, |
||||
RGBLED_DECREASE_VAL, |
||||
}; |
||||
|
||||
enum macro_keycodes { |
||||
KC_SAMPLEMACRO, |
||||
}; |
||||
|
||||
|
||||
// Fillers to make layering more clear
|
||||
#define _______ KC_TRNS |
||||
#define XXXXXXX KC_NO |
||||
//Macros
|
||||
#define M_SAMPLE M(KC_SAMPLEMACRO) |
||||
|
||||
#if HELIX_ROWS == 5 |
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | S | D | F | G | H | J | K | L | ; | " | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_QWERTY] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \
|
||||
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | R | S | T | D | H | N | E | I | O | " | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_COLEMAK] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL, \
|
||||
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Dvorak
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Tab | " | , | . | P | Y | F | G | C | R | L | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | O | E | U | I | D | H | T | N | S | / | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_DVORAK] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \
|
||||
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_LOWER] = KEYMAP( \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_RAISE] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | Reset| | | | | | | | | | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | | | | | | | | | | | | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_ADJUST] = KEYMAP( \
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||
_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
) |
||||
}; |
||||
|
||||
#elif HELIX_ROWS == 4 |
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | S | D | F | G | H | J | K | L | ; | " | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
|
||||
[_QWERTY] = KEYMAP( \
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \
|
||||
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | R | S | T | D | H | N | E | I | O | " | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_COLEMAK] = KEYMAP( \
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
|
||||
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Dvorak
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | O | E | U | I | D | H | T | N | S | / | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_DVORAK] = KEYMAP( \
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
|
||||
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_LOWER] = KEYMAP( \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_RAISE] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | | Reset| | | | | | | | | | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | | | | | | | | | | | | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_ADJUST] = KEYMAP( \
|
||||
_______, RESET, _______, M_SAMPLE, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
) |
||||
}; |
||||
|
||||
#else |
||||
#error "undefined keymaps" |
||||
#endif |
||||
|
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
|
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND); |
||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND); |
||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND); |
||||
float tone_plover[][2] = SONG(PLOVER_SOUND); |
||||
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); |
||||
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); |
||||
#endif |
||||
|
||||
// define variables for reactive RGB
|
||||
bool TOG_STATUS = false; |
||||
int RGB_current_mode; |
||||
|
||||
void persistent_default_layer_set(uint16_t default_layer) { |
||||
eeconfig_update_default_layer(default_layer); |
||||
default_layer_set(default_layer); |
||||
} |
||||
|
||||
// Setting ADJUST layer RGB back to default
|
||||
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { |
||||
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { |
||||
rgblight_mode(RGB_current_mode); |
||||
layer_on(layer3); |
||||
} else { |
||||
layer_off(layer3); |
||||
} |
||||
} |
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
||||
switch (keycode) { |
||||
case QWERTY: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_qwerty); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_QWERTY); |
||||
} |
||||
return false; |
||||
break; |
||||
case COLEMAK: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_colemak); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_COLEMAK); |
||||
} |
||||
return false; |
||||
break; |
||||
case DVORAK: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_dvorak); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_DVORAK); |
||||
} |
||||
return false; |
||||
break; |
||||
case LOWER: |
||||
if (record->event.pressed) { |
||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||
} else { |
||||
TOG_STATUS = !TOG_STATUS; |
||||
rgblight_mode(16); |
||||
} |
||||
layer_on(_LOWER); |
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); |
||||
} else { |
||||
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||
TOG_STATUS = false; |
||||
layer_off(_LOWER); |
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case RAISE: |
||||
if (record->event.pressed) { |
||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||
} else { |
||||
TOG_STATUS = !TOG_STATUS; |
||||
rgblight_mode(15); |
||||
} |
||||
layer_on(_RAISE); |
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); |
||||
} else { |
||||
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||
layer_off(_RAISE); |
||||
TOG_STATUS = false; |
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case ADJUST: |
||||
if (record->event.pressed) { |
||||
layer_on(_ADJUST); |
||||
} else { |
||||
layer_off(_ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case BACKLIT: |
||||
if (record->event.pressed) { |
||||
register_code(KC_RSFT); |
||||
#ifdef BACKLIGHT_ENABLE |
||||
backlight_step(); |
||||
#endif |
||||
} else { |
||||
unregister_code(KC_RSFT); |
||||
} |
||||
return false; |
||||
break; |
||||
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
|
||||
case RGB_MOD: |
||||
if (record->event.pressed) { |
||||
rgblight_mode(RGB_current_mode); |
||||
rgblight_step(); |
||||
RGB_current_mode = rgblight_config.mode; |
||||
} |
||||
return false; |
||||
break; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
void matrix_init_user(void) { |
||||
#ifdef AUDIO_ENABLE |
||||
startup_user(); |
||||
#endif |
||||
RGB_current_mode = rgblight_config.mode; |
||||
} |
||||
|
||||
//SSD1306 OLED init and update loop, make sure to add #define SSD1306OLED in config.h
|
||||
#ifdef SSD1306OLED |
||||
void matrix_master_OLED_init (void) { |
||||
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); |
||||
iota_gfx_init(0); // turns on the display
|
||||
} |
||||
|
||||
void matrix_scan_user(void) { |
||||
iota_gfx_task(); // this is what updates the display continuously
|
||||
} |
||||
#endif |
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
|
||||
void startup_user() |
||||
{ |
||||
_delay_ms(20); // gets rid of tick
|
||||
} |
||||
|
||||
void shutdown_user() |
||||
{ |
||||
_delay_ms(150); |
||||
stop_all_notes(); |
||||
} |
||||
|
||||
void music_on_user(void) |
||||
{ |
||||
music_scale_user(); |
||||
} |
||||
|
||||
void music_scale_user(void) |
||||
{ |
||||
PLAY_SONG(music_scale); |
||||
} |
||||
|
||||
#endif |
||||
|
||||
/*
|
||||
* Macro definition |
||||
*/ |
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) |
||||
{ |
||||
if (!eeconfig_is_enabled()) { |
||||
eeconfig_init(); |
||||
} |
||||
|
||||
switch (id) { |
||||
case KC_SAMPLEMACRO: |
||||
if (record->event.pressed){ |
||||
return MACRO (I(10), T(H), T(E), T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END); |
||||
} |
||||
|
||||
} |
||||
|
||||
return MACRO_NONE; |
||||
} |
@ -0,0 +1,25 @@ |
||||
SSD1306 OLED Display via I2C |
||||
====== |
||||
|
||||
Features |
||||
-------- |
||||
|
||||
Some features supported by the firmware: |
||||
|
||||
|
||||
* I2C connection between the two halves is required as the OLED display will use this connection as well. Note this |
||||
requires pull-up resistors on the data and clock lines. |
||||
* OLED display will connect from either side |
||||
|
||||
|
||||
Wiring |
||||
------ |
||||
|
||||
|
||||
Work in progress... |
||||
|
||||
|
||||
OLED Configuration |
||||
------------------------------- |
||||
|
||||
Work in progress... |
@ -0,0 +1,25 @@ |
||||
|
||||
# Build Options
|
||||
# change to "no" to disable the options, or define them in the Makefile in
|
||||
# the appropriate keymap folder that will get included automatically
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||
ONEHAND_ENABLE = no # Enable one-hand typing
|
||||
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
ifndef QUANTUM_DIR |
||||
include ../../../../Makefile
|
||||
endif |
@ -0,0 +1,37 @@ |
||||
/*
|
||||
This is the c configuration file for the keymap |
||||
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com> |
||||
Copyright 2015 Jack Humbert |
||||
|
||||
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_USER_H |
||||
#define CONFIG_USER_H |
||||
|
||||
#include "../../config.h" |
||||
|
||||
/* Use I2C or Serial, not both */ |
||||
|
||||
#define USE_SERIAL |
||||
// #define USE_I2C
|
||||
|
||||
/* Select hand configuration */ |
||||
|
||||
#define MASTER_LEFT |
||||
// #define _MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
#endif |
@ -0,0 +1,349 @@ |
||||
#include "helix.h" |
||||
#include "action_layer.h" |
||||
#include "eeconfig.h" |
||||
|
||||
extern keymap_config_t keymap_config; |
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
#define _QWERTY 0 |
||||
#define _COLEMAK 1 |
||||
#define _DVORAK 2 |
||||
#define _LOWER 3 |
||||
#define _RAISE 4 |
||||
#define _ADJUST 16 |
||||
|
||||
enum custom_keycodes { |
||||
QWERTY = SAFE_RANGE, |
||||
COLEMAK, |
||||
DVORAK, |
||||
LOWER, |
||||
RAISE, |
||||
ADJUST, |
||||
}; |
||||
|
||||
// Fillers to make layering more clear
|
||||
#define _______ KC_TRNS |
||||
#define XXXXXXX KC_NO |
||||
|
||||
#if HELIX_ROWS == 5 |
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | S | D | F | G | H | J | K | L | ; | " | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_QWERTY] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \
|
||||
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | R | S | T | D | H | N | E | I | O | " | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_COLEMAK] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL, \
|
||||
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Dvorak
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Tab | " | , | . | P | Y | F | G | C | R | L | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | O | E | U | I | D | H | T | N | S | / | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_DVORAK] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \
|
||||
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_LOWER] = KEYMAP( \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_RAISE] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | Reset| | | | | | | | | | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | | | | | | | | | | | | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_ADJUST] = KEYMAP( \
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||
_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
) |
||||
}; |
||||
|
||||
#elif HELIX_ROWS == 4 |
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | S | D | F | G | H | J | K | L | ; | " | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
|
||||
[_QWERTY] = KEYMAP( \
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \
|
||||
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | R | S | T | D | H | N | E | I | O | " | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_COLEMAK] = KEYMAP( \
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
|
||||
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Dvorak
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Esc | A | O | E | U | I | D | H | T | N | S | / | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_DVORAK] = KEYMAP( \
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
|
||||
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_LOWER] = KEYMAP( \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_RAISE] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-----------------------------------------------------------------------------------. |
||||
* | | Reset| | | | | | | | | | Del | |
||||
* |------+------+------+------+------+-------------+------+------+------+------+------| |
||||
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | |
||||
* |------+------+------+------+------+------|------+------+------+------+------+------| |
||||
* | | | | | | | | | | | | | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | | |
||||
* `-----------------------------------------------------------------------------------' |
||||
*/ |
||||
[_ADJUST] = KEYMAP( \
|
||||
_______, RESET, _______, M_SAMPLE, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
) |
||||
}; |
||||
|
||||
#else |
||||
#error "undefined keymaps" |
||||
#endif |
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND); |
||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND); |
||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND); |
||||
#endif |
||||
|
||||
void persistent_default_layer_set(uint16_t default_layer) { |
||||
eeconfig_update_default_layer(default_layer); |
||||
default_layer_set(default_layer); |
||||
} |
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
||||
switch (keycode) { |
||||
case QWERTY: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_qwerty); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_QWERTY); |
||||
} |
||||
return false; |
||||
break; |
||||
case COLEMAK: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_colemak); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_COLEMAK); |
||||
} |
||||
return false; |
||||
break; |
||||
case DVORAK: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_dvorak); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_DVORAK); |
||||
} |
||||
return false; |
||||
break; |
||||
case LOWER: |
||||
if (record->event.pressed) { |
||||
layer_on(_LOWER); |
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST); |
||||
} else { |
||||
layer_off(_LOWER); |
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case RAISE: |
||||
if (record->event.pressed) { |
||||
layer_on(_RAISE); |
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST); |
||||
} else { |
||||
layer_off(_RAISE); |
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case ADJUST: |
||||
if (record->event.pressed) { |
||||
layer_on(_ADJUST); |
||||
} else { |
||||
layer_off(_ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
} |
||||
return true; |
||||
} |
@ -0,0 +1,3 @@ |
||||
ifndef QUANTUM_DIR |
||||
include ../../../../Makefile
|
||||
endif |
@ -0,0 +1,307 @@ |
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@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 <avr/wdt.h> |
||||
#include <avr/interrupt.h> |
||||
#include <util/delay.h> |
||||
#include "print.h" |
||||
#include "debug.h" |
||||
#include "util.h" |
||||
#include "matrix.h" |
||||
#include "split_util.h" |
||||
#include "pro_micro.h" |
||||
#include "config.h" |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
# include "i2c.h" |
||||
#else // USE_SERIAL
|
||||
# include "serial.h" |
||||
#endif |
||||
|
||||
#ifndef DEBOUNCE |
||||
# define DEBOUNCE 5 |
||||
#endif |
||||
|
||||
#define ERROR_DISCONNECT_COUNT 5 |
||||
|
||||
static uint8_t debouncing = DEBOUNCE; |
||||
static const int ROWS_PER_HAND = MATRIX_ROWS/2; |
||||
static uint8_t error_count = 0; |
||||
|
||||
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; |
||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; |
||||
|
||||
/* 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(void); |
||||
static void init_cols(void); |
||||
static void unselect_rows(void); |
||||
static void select_row(uint8_t row); |
||||
|
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_init_kb(void) { |
||||
matrix_init_user(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_scan_kb(void) { |
||||
matrix_scan_user(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_init_user(void) { |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_scan_user(void) { |
||||
} |
||||
|
||||
inline |
||||
uint8_t matrix_rows(void) |
||||
{ |
||||
return MATRIX_ROWS; |
||||
} |
||||
|
||||
inline |
||||
uint8_t matrix_cols(void) |
||||
{ |
||||
return MATRIX_COLS; |
||||
} |
||||
|
||||
void matrix_init(void) |
||||
{ |
||||
debug_enable = true; |
||||
debug_matrix = true; |
||||
debug_mouse = true; |
||||
// initialize row and col
|
||||
unselect_rows(); |
||||
init_cols(); |
||||
|
||||
TX_RX_LED_INIT; |
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
||||
matrix[i] = 0; |
||||
matrix_debouncing[i] = 0; |
||||
} |
||||
|
||||
matrix_init_quantum(); |
||||
} |
||||
|
||||
uint8_t _matrix_scan(void) |
||||
{ |
||||
// Right hand is stored after the left in the matirx so, we need to offset it
|
||||
int offset = isLeftHand ? 0 : (ROWS_PER_HAND); |
||||
|
||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { |
||||
select_row(i); |
||||
_delay_us(30); // without this wait read unstable value.
|
||||
matrix_row_t cols = read_cols(); |
||||
if (matrix_debouncing[i+offset] != cols) { |
||||
matrix_debouncing[i+offset] = cols; |
||||
debouncing = DEBOUNCE; |
||||
} |
||||
unselect_rows(); |
||||
} |
||||
|
||||
if (debouncing) { |
||||
if (--debouncing) { |
||||
_delay_ms(1); |
||||
} else { |
||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { |
||||
matrix[i+offset] = matrix_debouncing[i+offset]; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
|
||||
// Get rows from other half over i2c
|
||||
int i2c_transaction(void) { |
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; |
||||
|
||||
int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); |
||||
if (err) goto i2c_error; |
||||
|
||||
// start of matrix stored at 0x00
|
||||
err = i2c_master_write(0x00); |
||||
if (err) goto i2c_error; |
||||
|
||||
// Start read
|
||||
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); |
||||
if (err) goto i2c_error; |
||||
|
||||
if (!err) { |
||||
int i; |
||||
for (i = 0; i < ROWS_PER_HAND-1; ++i) { |
||||
matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); |
||||
} |
||||
matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); |
||||
i2c_master_stop(); |
||||
} else { |
||||
i2c_error: // the cable is disconnceted, or something else went wrong
|
||||
i2c_reset_state(); |
||||
return err; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
#else // USE_SERIAL
|
||||
|
||||
int serial_transaction(void) { |
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; |
||||
|
||||
if (serial_update_buffers()) { |
||||
return 1; |
||||
} |
||||
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
matrix[slaveOffset+i] = serial_slave_buffer[i]; |
||||
} |
||||
return 0; |
||||
} |
||||
#endif |
||||
|
||||
uint8_t matrix_scan(void) |
||||
{ |
||||
int ret = _matrix_scan(); |
||||
|
||||
|
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
if( i2c_transaction() ) { |
||||
#else // USE_SERIAL
|
||||
if( serial_transaction() ) { |
||||
#endif |
||||
// turn on the indicator led when halves are disconnected
|
||||
TXLED1; |
||||
|
||||
error_count++; |
||||
|
||||
if (error_count > ERROR_DISCONNECT_COUNT) { |
||||
// reset other half if disconnected
|
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; |
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
matrix[slaveOffset+i] = 0; |
||||
} |
||||
} |
||||
} else { |
||||
// turn off the indicator led on no error
|
||||
TXLED0; |
||||
error_count = 0; |
||||
} |
||||
matrix_scan_quantum(); |
||||
return ret; |
||||
} |
||||
|
||||
void matrix_slave_scan(void) { |
||||
_matrix_scan(); |
||||
|
||||
int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2); |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
/* i2c_slave_buffer[i] = matrix[offset+i]; */ |
||||
i2c_slave_buffer[i] = matrix[offset+i]; |
||||
} |
||||
#else // USE_SERIAL
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
serial_slave_buffer[i] = matrix[offset+i]; |
||||
} |
||||
#endif |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
static void init_cols(void) |
||||
{ |
||||
for(int x = 0; x < MATRIX_COLS; x++) { |
||||
_SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); |
||||
_SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); |
||||
} |
||||
} |
||||
|
||||
static matrix_row_t read_cols(void) |
||||
{ |
||||
matrix_row_t result = 0; |
||||
for(int x = 0; x < MATRIX_COLS; x++) { |
||||
result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
static void unselect_rows(void) |
||||
{ |
||||
for(int x = 0; x < ROWS_PER_HAND; x++) { |
||||
_SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); |
||||
_SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); |
||||
} |
||||
} |
||||
|
||||
static void select_row(uint8_t row) |
||||
{ |
||||
_SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); |
||||
_SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); |
||||
} |
@ -0,0 +1,39 @@ |
||||
#include "helix.h" |
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
float tone_startup[][2] = SONG(STARTUP_SOUND); |
||||
float tone_goodbye[][2] = SONG(GOODBYE_SOUND); |
||||
#endif |
||||
|
||||
#ifdef SSD1306OLED |
||||
void led_set_kb(uint8_t usb_led) { |
||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
||||
led_set_user(usb_led); |
||||
} |
||||
#endif |
||||
|
||||
void matrix_init_kb(void) { |
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
_delay_ms(20); // gets rid of tick
|
||||
PLAY_SONG(tone_startup); |
||||
#endif |
||||
|
||||
// // green led on
|
||||
// DDRD |= (1<<5);
|
||||
// PORTD &= ~(1<<5);
|
||||
|
||||
// // orange led on
|
||||
// DDRB |= (1<<0);
|
||||
// PORTB &= ~(1<<0);
|
||||
|
||||
matrix_init_user(); |
||||
}; |
||||
|
||||
void shutdown_kb(void) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_goodbye); |
||||
_delay_ms(150); |
||||
stop_all_notes(); |
||||
#endif |
||||
} |
@ -0,0 +1,145 @@ |
||||
#ifndef REV1_H |
||||
#define REV1_CONFIG_H |
||||
|
||||
#include "../helix.h" |
||||
|
||||
//void promicro_bootloader_jmp(bool program);
|
||||
#include "quantum.h" |
||||
|
||||
|
||||
#ifdef USE_I2C |
||||
#include <stddef.h> |
||||
#ifdef __AVR__ |
||||
#include <avr/io.h> |
||||
#include <avr/interrupt.h> |
||||
#endif |
||||
#endif |
||||
|
||||
//void promicro_bootloader_jmp(bool program);
|
||||
|
||||
|
||||
#if HELIX_ROWS == 3 |
||||
#ifndef FLIP_HALF |
||||
// Standard Keymap
|
||||
// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05 }, \
|
||||
{ L10, L11, L12, L13, L14, L15 }, \
|
||||
{ L20, L21, L22, L23, L24, L25 }, \
|
||||
{ R05, R04, R03, R02, R01, R00 }, \
|
||||
{ R15, R14, R13, R12, R11, R10 }, \
|
||||
{ R25, R24, R23, R22, R21, R20 }, \
|
||||
} |
||||
#else |
||||
// Keymap with right side flipped
|
||||
// (TRRS jack on both halves are to the right)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05 }, \
|
||||
{ L10, L11, L12, L13, L14, L15 }, \
|
||||
{ L20, L21, L22, L23, L24, L25 }, \
|
||||
{ R00, R01, R02, R03, R04, R05 }, \
|
||||
{ R10, R11, R12, R13, R14, R15 }, \
|
||||
{ R20, R21, R22, R23, R24, R25 }, \
|
||||
} |
||||
#endif |
||||
#elif HELIX_ROWS == 4 |
||||
#ifndef FLIP_HALF |
||||
// Standard Keymap
|
||||
// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05 }, \
|
||||
{ L10, L11, L12, L13, L14, L15 }, \
|
||||
{ L20, L21, L22, L23, L24, L25 }, \
|
||||
{ L30, L31, L32, L33, L34, L35 }, \
|
||||
{ R05, R04, R03, R02, R01, R00 }, \
|
||||
{ R15, R14, R13, R12, R11, R10 }, \
|
||||
{ R25, R24, R23, R22, R21, R20 }, \
|
||||
{ R35, R34, R33, R32, R31, R30 } \
|
||||
} |
||||
#else |
||||
// Keymap with right side flipped
|
||||
// (TRRS jack on both halves are to the right)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05 }, \
|
||||
{ L10, L11, L12, L13, L14, L15 }, \
|
||||
{ L20, L21, L22, L23, L24, L25 }, \
|
||||
{ L30, L31, L32, L33, L34, L35 }, \
|
||||
{ R00, R01, R02, R03, R04, R05 }, \
|
||||
{ R10, R11, R12, R13, R14, R15 }, \
|
||||
{ R20, R21, R22, R23, R24, R25 }, \
|
||||
{ R30, R31, R32, R33, R34, R35 } \
|
||||
} |
||||
#endif |
||||
#elif HELIX_ROWS == 5 |
||||
#ifndef FLIP_HALF |
||||
// Standard Keymap
|
||||
// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \
|
||||
L40, L41, L42, L43, L44, L45, R40, R41, R42, R43, R44, R45 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05 }, \
|
||||
{ L10, L11, L12, L13, L14, L15 }, \
|
||||
{ L20, L21, L22, L23, L24, L25 }, \
|
||||
{ L30, L31, L32, L33, L34, L35 }, \
|
||||
{ L40, L41, L42, L43, L44, L45 }, \
|
||||
{ R05, R04, R03, R02, R01, R00 }, \
|
||||
{ R15, R14, R13, R12, R11, R10 }, \
|
||||
{ R25, R24, R23, R22, R21, R20 }, \
|
||||
{ R35, R34, R33, R32, R31, R30 }, \
|
||||
{ R45, R44, R43, R42, R41, R40 } \
|
||||
} |
||||
#else |
||||
// Keymap with right side flipped
|
||||
// (TRRS jack on both halves are to the right)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \
|
||||
L40, L41, L42, L43, L44, L45, R40, R41, R42, R43, R44, R45 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05 }, \
|
||||
{ L10, L11, L12, L13, L14, L15 }, \
|
||||
{ L20, L21, L22, L23, L24, L25 }, \
|
||||
{ L30, L31, L32, L33, L34, L35 }, \
|
||||
{ L40, L41, L42, L43, L44, L45 }, \
|
||||
{ R00, R01, R02, R03, R04, R05 }, \
|
||||
{ R10, R11, R12, R13, R14, R15 }, \
|
||||
{ R20, R21, R22, R23, R24, R25 }, \
|
||||
{ R30, R31, R32, R33, R34, R35 }, \
|
||||
{ R40, R41, R42, R43, R44, R45 } \
|
||||
} |
||||
#endif |
||||
#else |
||||
#error "expected HELIX_ROWS 3 or 4 or 5" |
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1,4 @@ |
||||
SRC += rev1/matrix.c \
|
||||
rev1/split_util.c
|
||||
|
||||
BACKLIGHT_ENABLE = no
|
@ -0,0 +1,86 @@ |
||||
#include <avr/io.h> |
||||
#include <avr/wdt.h> |
||||
#include <avr/power.h> |
||||
#include <avr/interrupt.h> |
||||
#include <util/delay.h> |
||||
#include <avr/eeprom.h> |
||||
#include "split_util.h" |
||||
#include "matrix.h" |
||||
#include "keyboard.h" |
||||
#include "config.h" |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
# include "i2c.h" |
||||
#else |
||||
# include "serial.h" |
||||
#endif |
||||
|
||||
volatile bool isLeftHand = true; |
||||
|
||||
static void setup_handedness(void) { |
||||
#ifdef EE_HANDS |
||||
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); |
||||
#else |
||||
// I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
|
||||
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) |
||||
isLeftHand = !has_usb(); |
||||
#else |
||||
isLeftHand = has_usb(); |
||||
#endif |
||||
#endif |
||||
} |
||||
|
||||
static void keyboard_master_setup(void) { |
||||
#ifdef USE_I2C |
||||
#ifdef SSD1306OLED |
||||
matrix_master_OLED_init (); |
||||
#endif |
||||
#endif |
||||
#ifdef USE_MATRIX_I2C |
||||
i2c_master_init(); |
||||
#else |
||||
serial_master_init(); |
||||
#endif |
||||
} |
||||
|
||||
static void keyboard_slave_setup(void) { |
||||
#ifdef USE_MATRIX_I2C |
||||
i2c_slave_init(SLAVE_I2C_ADDRESS); |
||||
#else |
||||
serial_slave_init(); |
||||
#endif |
||||
} |
||||
|
||||
bool has_usb(void) { |
||||
USBCON |= (1 << OTGPADE); //enables VBUS pad
|
||||
_delay_us(5); |
||||
return (USBSTA & (1<<VBUS)); //checks state of VBUS
|
||||
} |
||||
|
||||
void split_keyboard_setup(void) { |
||||
setup_handedness(); |
||||
|
||||
if (has_usb()) { |
||||
keyboard_master_setup(); |
||||
} else { |
||||
keyboard_slave_setup(); |
||||
} |
||||
sei(); |
||||
} |
||||
|
||||
void keyboard_slave_loop(void) { |
||||
matrix_init(); |
||||
|
||||
while (1) { |
||||
matrix_slave_scan(); |
||||
} |
||||
} |
||||
|
||||
// this code runs before the usb and keyboard is initialized
|
||||
void matrix_setup(void) { |
||||
split_keyboard_setup(); |
||||
|
||||
if (!has_usb()) { |
||||
keyboard_slave_loop(); |
||||
} |
||||
} |
@ -0,0 +1,24 @@ |
||||
#ifndef SPLIT_KEYBOARD_UTIL_H |
||||
#define SPLIT_KEYBOARD_UTIL_H |
||||
|
||||
#include <stdbool.h> |
||||
|
||||
#ifdef EE_HANDS |
||||
#define EECONFIG_BOOTMAGIC_END (uint8_t *)10 |
||||
#define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END |
||||
#endif |
||||
|
||||
#define SLAVE_I2C_ADDRESS 0x32 |
||||
|
||||
extern volatile bool isLeftHand; |
||||
|
||||
// slave version of matix scan, defined in matrix.c
|
||||
void matrix_slave_scan(void); |
||||
|
||||
void split_keyboard_setup(void); |
||||
bool has_usb(void); |
||||
void keyboard_slave_loop(void); |
||||
|
||||
void matrix_master_OLED_init (void); |
||||
|
||||
#endif |
@ -0,0 +1,97 @@ |
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com> |
||||
Copyright 2015 Jack Humbert |
||||
|
||||
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 REV2_CONFIG_H |
||||
#define REV2_CONFIG_H |
||||
|
||||
#include "../config.h" |
||||
|
||||
/* USB Device descriptor parameter */ |
||||
#define VENDOR_ID 0xFEED |
||||
#define PRODUCT_ID 0x3060 |
||||
#define DEVICE_VER 0x0001 |
||||
#define MANUFACTURER Yushakobo |
||||
#define PRODUCT Helix Beta |
||||
#define DESCRIPTION A split keyboard for the cheap makers |
||||
|
||||
#define HELIX_ROWS 5 |
||||
|
||||
/* key matrix size */ |
||||
// Rows are doubled-up
|
||||
#if HELIX_ROWS == 4 |
||||
#define MATRIX_ROWS 8 |
||||
#define MATRIX_COLS 7 |
||||
#define MATRIX_ROW_PINS { D4, C6, D7, E6 } |
||||
#elif HELIX_ROWS == 5 |
||||
#define MATRIX_ROWS 10 |
||||
#define MATRIX_COLS 7 |
||||
#define MATRIX_ROW_PINS { D4, C6, D7, E6, B4 } |
||||
#else |
||||
#error "expected HELIX_ROWS 4 or 5" |
||||
#endif |
||||
|
||||
// wiring of each half
|
||||
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } |
||||
// #define MATRIX_COL_PINS { B2, B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order
|
||||
|
||||
/* 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 DEBOUNCING_DELAY 5 |
||||
|
||||
/* 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)) \
|
||||
) |
||||
|
||||
/* ws2812 RGB LED */ |
||||
#define RGB_DI_PIN D3 |
||||
#define RGBLIGHT_TIMER |
||||
#define RGBLED_NUM 12 // Number of LEDs
|
||||
#define ws2812_PORTREG PORTD |
||||
#define ws2812_DDRREG DDRD |
||||
|
||||
/*
|
||||
* 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 |
@ -0,0 +1,54 @@ |
||||
/*
|
||||
This is the c configuration file for the keymap |
||||
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com> |
||||
Copyright 2015 Jack Humbert |
||||
|
||||
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_USER_H |
||||
#define CONFIG_USER_H |
||||
|
||||
#include "../../config.h" |
||||
|
||||
/* Use I2C or Serial */ |
||||
|
||||
#define USE_I2C |
||||
#define USE_SERIAL |
||||
//#define USE_MATRIX_I2C
|
||||
|
||||
/* Select hand configuration */ |
||||
|
||||
#define MASTER_LEFT |
||||
// #define MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
//#define SSD1306OLED
|
||||
|
||||
#define USE_SERIAL_PD2 |
||||
|
||||
#define PREVENT_STUCK_MODIFIERS |
||||
#define TAPPING_FORCE_HOLD |
||||
#define TAPPING_TERM 100 |
||||
|
||||
|
||||
#undef RGBLED_NUM |
||||
#define RGBLIGHT_ANIMATIONS |
||||
#define RGBLED_NUM 6 |
||||
#define RGBLIGHT_LIMIT_VAL 255 |
||||
#define RGBLIGHT_HUE_STEP 10 |
||||
#define RGBLIGHT_SAT_STEP 17 |
||||
#define RGBLIGHT_VAL_STEP 17 |
||||
#endif |
@ -0,0 +1,616 @@ |
||||
#include "helix.h" |
||||
#include "bootloader.h" |
||||
#include "action_layer.h" |
||||
#include "eeconfig.h" |
||||
#ifdef PROTOCOL_LUFA |
||||
#include "lufa.h" |
||||
#include "split_util.h" |
||||
#endif |
||||
#include "LUFA/Drivers/Peripheral/TWI.h" |
||||
#ifdef AUDIO_ENABLE |
||||
#include "audio.h" |
||||
#endif |
||||
#ifdef SSD1306OLED |
||||
#include "ssd1306.h" |
||||
#endif |
||||
|
||||
extern keymap_config_t keymap_config; |
||||
|
||||
#ifdef RGBLIGHT_ENABLE |
||||
//Following line allows macro to read current RGB settings
|
||||
extern rgblight_config_t rgblight_config; |
||||
#endif |
||||
|
||||
extern uint8_t is_master; |
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
#define _QWERTY 0 |
||||
#define _COLEMAK 1 |
||||
#define _DVORAK 2 |
||||
#define _LOWER 3 |
||||
#define _RAISE 4 |
||||
#define _ADJUST 16 |
||||
|
||||
enum custom_keycodes { |
||||
QWERTY = SAFE_RANGE, |
||||
COLEMAK, |
||||
DVORAK, |
||||
LOWER, |
||||
RAISE, |
||||
ADJUST, |
||||
BACKLIT, |
||||
EISU, |
||||
KANA, |
||||
RGBRST |
||||
}; |
||||
|
||||
enum macro_keycodes { |
||||
KC_SAMPLEMACRO, |
||||
}; |
||||
|
||||
|
||||
// Fillers to make layering more clear
|
||||
#define _______ KC_TRNS |
||||
#define XXXXXXX KC_NO |
||||
//Macros
|
||||
#define M_SAMPLE M(KC_SAMPLEMACRO) |
||||
|
||||
#if HELIX_ROWS == 5 |
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | [ | ] | N | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_QWERTY] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
|
||||
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | [ | ] | K | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_COLEMAK] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
|
||||
KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Dvorak
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Ctrl | A | O | E | U | I | | D | H | T | N | S | / | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | Shift| ; | Q | J | K | X | [ | ] | B | M | W | V | Z |Enter | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_DVORAK] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \
|
||||
KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_LBRC, KC_RBRC, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
||||
ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | ( | ) | F12 | | | Home | End | | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_LOWER] = KEYMAP( \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_LPRN, KC_RPRN, KC_F12, _______, _______, KC_HOME, KC_END, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | | | F12 | | |PageDn|PageUp| | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_RAISE] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, KC_F12, _______, _______, KC_PGDN, KC_PGUP, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | Reset|RGBRST| | | | | | | | | | Del | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | | |Aud on|Audoff| Mac | | Win |Qwerty|Colemk|Dvorak| | | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | |RGB ON| HUE+ | SAT+ | VAL+ | |
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | MODE | HUE- | SAT- | VAL- | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_ADJUST] = KEYMAP( \
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||
_______, RESET, RGBRST, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \
|
||||
) |
||||
}; |
||||
|
||||
#elif HELIX_ROWS == 4 |
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------| |
||||
* |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_QWERTY] = KEYMAP( \
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
|
||||
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | |
||||
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------| |
||||
* |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_COLEMAK] = KEYMAP( \
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
|
||||
KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Dvorak
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Ctrl | A | O | E | U | I | | D | H | T | N | S | / | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | |
||||
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------| |
||||
* |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_DVORAK] = KEYMAP( \
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \
|
||||
KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
||||
ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
), |
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | | F12 | | | Home | End | | |
||||
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_LOWER] = KEYMAP( \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_HOME, KC_END, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | F7 | F8 | F9 | F10 | F11 | | F12 | | |PageDn|PageUp| | |
||||
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | Next | Vol- | Vol+ | Play | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_RAISE] = KEYMAP( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_PGDN, KC_PGUP, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
), |
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-----------------------------------------. ,-----------------------------------------. |
||||
* | | Reset| | | | | | | | | | | Del | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | | |Aud on|Audoff| Mac | | Win |Qwerty|Colemk|Dvorak| | | |
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------| |
||||
* | | | | | | | | | |RGB ON| HUE+ | SAT+ | VAL+ | |
||||
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------| |
||||
* | | | | | | | | | | | MODE | HUE- | SAT- | VAL- | |
||||
* `-------------------------------------------------------------------------------------------------' |
||||
*/ |
||||
[_ADJUST] = KEYMAP( \
|
||||
_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \
|
||||
) |
||||
}; |
||||
|
||||
#else |
||||
#error "undefined keymaps" |
||||
#endif |
||||
|
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
|
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND); |
||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND); |
||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND); |
||||
float tone_plover[][2] = SONG(PLOVER_SOUND); |
||||
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); |
||||
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); |
||||
#endif |
||||
|
||||
// define variables for reactive RGB
|
||||
bool TOG_STATUS = false; |
||||
int RGB_current_mode; |
||||
|
||||
void persistent_default_layer_set(uint16_t default_layer) { |
||||
eeconfig_update_default_layer(default_layer); |
||||
default_layer_set(default_layer); |
||||
} |
||||
|
||||
// Setting ADJUST layer RGB back to default
|
||||
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { |
||||
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { |
||||
#ifdef RGBLIGHT_ENABLE |
||||
//rgblight_mode(RGB_current_mode);
|
||||
#endif |
||||
layer_on(layer3); |
||||
} else { |
||||
layer_off(layer3); |
||||
} |
||||
} |
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
||||
switch (keycode) { |
||||
case QWERTY: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_qwerty); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_QWERTY); |
||||
} |
||||
return false; |
||||
break; |
||||
case COLEMAK: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_colemak); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_COLEMAK); |
||||
} |
||||
return false; |
||||
break; |
||||
case DVORAK: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_dvorak); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_DVORAK); |
||||
} |
||||
return false; |
||||
break; |
||||
case LOWER: |
||||
if (record->event.pressed) { |
||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||
} else { |
||||
TOG_STATUS = !TOG_STATUS; |
||||
#ifdef RGBLIGHT_ENABLE |
||||
//rgblight_mode(16);
|
||||
#endif |
||||
} |
||||
layer_on(_LOWER); |
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); |
||||
} else { |
||||
#ifdef RGBLIGHT_ENABLE |
||||
//rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||
#endif |
||||
TOG_STATUS = false; |
||||
layer_off(_LOWER); |
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case RAISE: |
||||
if (record->event.pressed) { |
||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||
} else { |
||||
TOG_STATUS = !TOG_STATUS; |
||||
#ifdef RGBLIGHT_ENABLE |
||||
//rgblight_mode(15);
|
||||
#endif |
||||
} |
||||
layer_on(_RAISE); |
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); |
||||
} else { |
||||
#ifdef RGBLIGHT_ENABLE |
||||
//rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||
#endif |
||||
layer_off(_RAISE); |
||||
TOG_STATUS = false; |
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case ADJUST: |
||||
if (record->event.pressed) { |
||||
layer_on(_ADJUST); |
||||
} else { |
||||
layer_off(_ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
|
||||
case RGB_MOD: |
||||
#ifdef RGBLIGHT_ENABLE |
||||
if (record->event.pressed) { |
||||
rgblight_mode(RGB_current_mode); |
||||
rgblight_step(); |
||||
RGB_current_mode = rgblight_config.mode; |
||||
} |
||||
#endif |
||||
return false; |
||||
break; |
||||
case EISU: |
||||
if (record->event.pressed) { |
||||
if(keymap_config.swap_lalt_lgui==false){ |
||||
register_code(KC_LANG2); |
||||
}else{ |
||||
SEND_STRING(SS_LALT("`")); |
||||
} |
||||
} else { |
||||
unregister_code(KC_LANG2); |
||||
} |
||||
return false; |
||||
break; |
||||
case KANA: |
||||
if (record->event.pressed) { |
||||
if(keymap_config.swap_lalt_lgui==false){ |
||||
register_code(KC_LANG1); |
||||
}else{ |
||||
SEND_STRING(SS_LALT("`")); |
||||
} |
||||
} else { |
||||
unregister_code(KC_LANG1); |
||||
} |
||||
return false; |
||||
break; |
||||
case RGBRST: |
||||
#ifdef RGBLIGHT_ENABLE |
||||
if (record->event.pressed) { |
||||
eeconfig_update_rgblight_default(); |
||||
rgblight_enable(); |
||||
RGB_current_mode = rgblight_config.mode; |
||||
} |
||||
#endif |
||||
break; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
void matrix_init_user(void) { |
||||
#ifdef AUDIO_ENABLE |
||||
startup_user(); |
||||
#endif |
||||
#ifdef RGBLIGHT_ENABLE |
||||
RGB_current_mode = rgblight_config.mode; |
||||
#endif |
||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
||||
#ifdef SSD1306OLED |
||||
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); |
||||
iota_gfx_init(!has_usb()); // turns on the display
|
||||
#endif |
||||
} |
||||
|
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
|
||||
void startup_user() |
||||
{ |
||||
_delay_ms(20); // gets rid of tick
|
||||
} |
||||
|
||||
void shutdown_user() |
||||
{ |
||||
_delay_ms(150); |
||||
stop_all_notes(); |
||||
} |
||||
|
||||
void music_on_user(void) |
||||
{ |
||||
music_scale_user(); |
||||
} |
||||
|
||||
void music_scale_user(void) |
||||
{ |
||||
PLAY_SONG(music_scale); |
||||
} |
||||
|
||||
#endif |
||||
|
||||
|
||||
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
|
||||
#ifdef SSD1306OLED |
||||
|
||||
void matrix_scan_user(void) { |
||||
iota_gfx_task(); // this is what updates the display continuously
|
||||
} |
||||
|
||||
void matrix_update(struct CharacterMatrix *dest, |
||||
const struct CharacterMatrix *source) { |
||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) { |
||||
memcpy(dest->display, source->display, sizeof(dest->display)); |
||||
dest->dirty = true; |
||||
} |
||||
} |
||||
|
||||
//assign the right code to your layers for OLED display
|
||||
#define L_BASE 0 |
||||
#define L_LOWER 8 |
||||
#define L_RAISE 16 |
||||
#define L_FNLAYER 64 |
||||
#define L_NUMLAY 128 |
||||
#define L_NLOWER 136 |
||||
#define L_NFNLAYER 192 |
||||
#define L_MOUSECURSOR 256 |
||||
#define L_ADJUST 65536 |
||||
#define L_ADJUST_TRI 65560 |
||||
|
||||
static void render_logo(struct CharacterMatrix *matrix) { |
||||
|
||||
static char logo[]={ |
||||
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, |
||||
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, |
||||
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, |
||||
0}; |
||||
matrix_write(matrix, logo); |
||||
//matrix_write_P(&matrix, PSTR(" Split keyboard kit"));
|
||||
} |
||||
|
||||
|
||||
|
||||
void render_status(struct CharacterMatrix *matrix) { |
||||
|
||||
// Render to mode icon
|
||||
static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; |
||||
if(keymap_config.swap_lalt_lgui==false){ |
||||
matrix_write(matrix, logo[0][0]); |
||||
matrix_write_P(matrix, PSTR("\n")); |
||||
matrix_write(matrix, logo[0][1]); |
||||
}else{ |
||||
matrix_write(matrix, logo[1][0]); |
||||
matrix_write_P(matrix, PSTR("\n")); |
||||
matrix_write(matrix, logo[1][1]); |
||||
} |
||||
|
||||
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
||||
char buf[40]; |
||||
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); |
||||
matrix_write_P(matrix, PSTR("\nLayer: ")); |
||||
switch (layer_state) { |
||||
case L_BASE: |
||||
matrix_write_P(matrix, PSTR("Default")); |
||||
break; |
||||
case L_RAISE: |
||||
matrix_write_P(matrix, PSTR("Raise")); |
||||
break; |
||||
case L_LOWER: |
||||
matrix_write_P(matrix, PSTR("Lower")); |
||||
break; |
||||
case L_ADJUST: |
||||
case L_ADJUST_TRI: |
||||
matrix_write_P(matrix, PSTR("Adjust")); |
||||
break; |
||||
default: |
||||
matrix_write(matrix, buf); |
||||
} |
||||
|
||||
// Host Keyboard LED Status
|
||||
char led[40]; |
||||
snprintf(led, sizeof(led), "\n%s %s %s", |
||||
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", |
||||
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", |
||||
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); |
||||
matrix_write(matrix, led); |
||||
} |
||||
|
||||
|
||||
void iota_gfx_task_user(void) { |
||||
struct CharacterMatrix matrix; |
||||
|
||||
#if DEBUG_TO_SCREEN |
||||
if (debug_enable) { |
||||
return; |
||||
} |
||||
#endif |
||||
|
||||
matrix_clear(&matrix); |
||||
if(is_master){ |
||||
render_status(&matrix); |
||||
}else{ |
||||
render_logo(&matrix); |
||||
} |
||||
matrix_update(&display, &matrix); |
||||
} |
||||
|
||||
#endif |
@ -0,0 +1,25 @@ |
||||
SSD1306 OLED Display via I2C |
||||
====== |
||||
|
||||
Features |
||||
-------- |
||||
|
||||
Some features supported by the firmware: |
||||
|
||||
|
||||
* I2C connection between the two halves is required as the OLED display will use this connection as well. Note this |
||||
requires pull-up resistors on the data and clock lines. |
||||
* OLED display will connect from either side |
||||
|
||||
|
||||
Wiring |
||||
------ |
||||
|
||||
|
||||
Work in progress... |
||||
|
||||
|
||||
OLED Configuration |
||||
------------------------------- |
||||
|
||||
Work in progress... |
@ -0,0 +1,25 @@ |
||||
|
||||
# Build Options
|
||||
# change to "no" to disable the options, or define them in the Makefile in
|
||||
# the appropriate keymap folder that will get included automatically
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||
ONEHAND_ENABLE = no # Enable one-hand typing
|
||||
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
ifndef QUANTUM_DIR |
||||
include ../../../../Makefile
|
||||
endif |
@ -0,0 +1,350 @@ |
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@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 <avr/wdt.h> |
||||
#include <avr/interrupt.h> |
||||
#include <util/delay.h> |
||||
#include "print.h" |
||||
#include "debug.h" |
||||
#include "util.h" |
||||
#include "matrix.h" |
||||
#include "split_util.h" |
||||
#include "pro_micro.h" |
||||
#include "config.h" |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
# include "i2c.h" |
||||
#else // USE_SERIAL
|
||||
# include "serial.h" |
||||
#endif |
||||
|
||||
#ifndef DEBOUNCE |
||||
# define DEBOUNCE 5 |
||||
#endif |
||||
|
||||
#define ERROR_DISCONNECT_COUNT 5 |
||||
|
||||
static uint8_t debouncing = DEBOUNCE; |
||||
static const int ROWS_PER_HAND = MATRIX_ROWS/2; |
||||
static uint8_t error_count = 0; |
||||
uint8_t is_master = 0 ; |
||||
|
||||
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; |
||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; |
||||
|
||||
/* 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(void); |
||||
static void init_cols(void); |
||||
static void unselect_rows(void); |
||||
static void select_row(uint8_t row); |
||||
static uint8_t matrix_master_scan(void); |
||||
|
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_init_kb(void) { |
||||
matrix_init_user(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_scan_kb(void) { |
||||
matrix_scan_user(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_init_user(void) { |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_scan_user(void) { |
||||
} |
||||
|
||||
inline |
||||
uint8_t matrix_rows(void) |
||||
{ |
||||
return MATRIX_ROWS; |
||||
} |
||||
|
||||
inline |
||||
uint8_t matrix_cols(void) |
||||
{ |
||||
return MATRIX_COLS; |
||||
} |
||||
|
||||
void matrix_init(void) |
||||
{ |
||||
debug_enable = true; |
||||
debug_matrix = true; |
||||
debug_mouse = true; |
||||
// initialize row and col
|
||||
unselect_rows(); |
||||
init_cols(); |
||||
|
||||
TX_RX_LED_INIT; |
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
||||
matrix[i] = 0; |
||||
matrix_debouncing[i] = 0; |
||||
} |
||||
|
||||
is_master = has_usb(); |
||||
|
||||
matrix_init_quantum(); |
||||
} |
||||
|
||||
uint8_t _matrix_scan(void) |
||||
{ |
||||
// Right hand is stored after the left in the matirx so, we need to offset it
|
||||
int offset = isLeftHand ? 0 : (ROWS_PER_HAND); |
||||
|
||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { |
||||
select_row(i); |
||||
_delay_us(30); // without this wait read unstable value.
|
||||
matrix_row_t cols = read_cols(); |
||||
if (matrix_debouncing[i+offset] != cols) { |
||||
matrix_debouncing[i+offset] = cols; |
||||
debouncing = DEBOUNCE; |
||||
} |
||||
unselect_rows(); |
||||
} |
||||
|
||||
if (debouncing) { |
||||
if (--debouncing) { |
||||
_delay_ms(1); |
||||
} else { |
||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { |
||||
matrix[i+offset] = matrix_debouncing[i+offset]; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
|
||||
// Get rows from other half over i2c
|
||||
int i2c_transaction(void) { |
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; |
||||
|
||||
int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); |
||||
if (err) goto i2c_error; |
||||
|
||||
// start of matrix stored at 0x00
|
||||
err = i2c_master_write(0x00); |
||||
if (err) goto i2c_error; |
||||
|
||||
// Start read
|
||||
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); |
||||
if (err) goto i2c_error; |
||||
|
||||
if (!err) { |
||||
int i; |
||||
for (i = 0; i < ROWS_PER_HAND-1; ++i) { |
||||
matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); |
||||
} |
||||
matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); |
||||
i2c_master_stop(); |
||||
} else { |
||||
i2c_error: // the cable is disconnceted, or something else went wrong
|
||||
i2c_reset_state(); |
||||
return err; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
#else // USE_SERIAL
|
||||
|
||||
int serial_transaction(void) { |
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; |
||||
int ret=serial_update_buffers(); |
||||
if (ret ) { |
||||
if(ret==2)RXLED1; |
||||
return 1; |
||||
} |
||||
RXLED0; |
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
matrix[slaveOffset+i] = serial_slave_buffer[i]; |
||||
} |
||||
return 0; |
||||
} |
||||
#endif |
||||
|
||||
uint8_t matrix_scan(void) |
||||
{ |
||||
if (is_master) { |
||||
matrix_master_scan(); |
||||
}else{ |
||||
matrix_slave_scan(); |
||||
|
||||
// if(serial_slave_DATA_CORRUPT()){
|
||||
// TXLED0;
|
||||
int offset = (isLeftHand) ? ROWS_PER_HAND : 0; |
||||
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
matrix[offset+i] = serial_master_buffer[i]; |
||||
} |
||||
|
||||
// }else{
|
||||
// TXLED1;
|
||||
// }
|
||||
|
||||
matrix_scan_quantum(); |
||||
} |
||||
return 1; |
||||
} |
||||
|
||||
|
||||
uint8_t matrix_master_scan(void) { |
||||
|
||||
int ret = _matrix_scan(); |
||||
|
||||
#ifndef KEYBOARD_helix_rev1 |
||||
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
// for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
/* i2c_slave_buffer[i] = matrix[offset+i]; */ |
||||
// i2c_slave_buffer[i] = matrix[offset+i];
|
||||
// }
|
||||
#else // USE_SERIAL
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
serial_master_buffer[i] = matrix[offset+i]; |
||||
} |
||||
#endif |
||||
#endif |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
if( i2c_transaction() ) { |
||||
#else // USE_SERIAL
|
||||
if( serial_transaction() ) { |
||||
#endif |
||||
// turn on the indicator led when halves are disconnected
|
||||
TXLED1; |
||||
|
||||
error_count++; |
||||
|
||||
if (error_count > ERROR_DISCONNECT_COUNT) { |
||||
// reset other half if disconnected
|
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; |
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
matrix[slaveOffset+i] = 0; |
||||
} |
||||
} |
||||
} else { |
||||
// turn off the indicator led on no error
|
||||
TXLED0; |
||||
error_count = 0; |
||||
} |
||||
matrix_scan_quantum(); |
||||
return ret; |
||||
} |
||||
|
||||
void matrix_slave_scan(void) { |
||||
_matrix_scan(); |
||||
|
||||
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
/* i2c_slave_buffer[i] = matrix[offset+i]; */ |
||||
i2c_slave_buffer[i] = matrix[offset+i]; |
||||
} |
||||
#else // USE_SERIAL
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) { |
||||
serial_slave_buffer[i] = matrix[offset+i]; |
||||
} |
||||
#endif |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
static void init_cols(void) |
||||
{ |
||||
for(int x = 0; x < MATRIX_COLS; x++) { |
||||
_SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); |
||||
_SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); |
||||
} |
||||
} |
||||
|
||||
static matrix_row_t read_cols(void) |
||||
{ |
||||
matrix_row_t result = 0; |
||||
for(int x = 0; x < MATRIX_COLS; x++) { |
||||
result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
static void unselect_rows(void) |
||||
{ |
||||
for(int x = 0; x < ROWS_PER_HAND; x++) { |
||||
_SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); |
||||
_SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); |
||||
} |
||||
} |
||||
|
||||
static void select_row(uint8_t row) |
||||
{ |
||||
_SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); |
||||
_SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); |
||||
} |
@ -0,0 +1,32 @@ |
||||
#include "helix.h" |
||||
|
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
float tone_startup[][2] = SONG(STARTUP_SOUND); |
||||
float tone_goodbye[][2] = SONG(GOODBYE_SOUND); |
||||
#endif |
||||
|
||||
#ifdef SSD1306OLED |
||||
void led_set_kb(uint8_t usb_led) { |
||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
||||
//led_set_user(usb_led);
|
||||
} |
||||
#endif |
||||
|
||||
void matrix_init_kb(void) { |
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
_delay_ms(20); // gets rid of tick
|
||||
PLAY_SONG(tone_startup); |
||||
#endif |
||||
|
||||
matrix_init_user(); |
||||
}; |
||||
|
||||
void shutdown_kb(void) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_goodbye); |
||||
_delay_ms(150); |
||||
stop_all_notes(); |
||||
#endif |
||||
} |
@ -0,0 +1,115 @@ |
||||
#ifndef REV2_H |
||||
#define REV2_CONFIG_H |
||||
|
||||
#include "../helix.h" |
||||
|
||||
//void promicro_bootloader_jmp(bool program);
|
||||
#include "quantum.h" |
||||
|
||||
#ifdef RGBLIGHT_ENABLE |
||||
//rgb led driver
|
||||
#include "ws2812.h" |
||||
#endif |
||||
|
||||
#ifdef USE_I2C |
||||
#include <stddef.h> |
||||
#ifdef __AVR__ |
||||
#include <avr/io.h> |
||||
#include <avr/interrupt.h> |
||||
#endif |
||||
#endif |
||||
|
||||
//void promicro_bootloader_jmp(bool program);
|
||||
|
||||
|
||||
#if HELIX_ROWS == 4 |
||||
#ifndef FLIP_HALF |
||||
// Standard Keymap
|
||||
// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05, KC_NO }, \
|
||||
{ L10, L11, L12, L13, L14, L15, KC_NO }, \
|
||||
{ L20, L21, L22, L23, L24, L25, KC_NO }, \
|
||||
{ L30, L31, L32, L33, L34, L35, L36 }, \
|
||||
{ R05, R04, R03, R02, R01, R00, KC_NO }, \
|
||||
{ R15, R14, R13, R12, R11, R10, KC_NO }, \
|
||||
{ R25, R24, R23, R22, R21, R20, KC_NO }, \
|
||||
{ R35, R34, R33, R32, R31, R30, R36 }, \
|
||||
} |
||||
#else |
||||
// Keymap with right side flipped
|
||||
// (TRRS jack on both halves are to the right)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05, KC_NO }, \
|
||||
{ L10, L11, L12, L13, L14, L15, KC_NO }, \
|
||||
{ L20, L21, L22, L23, L24, L25, KC_NO }, \
|
||||
{ L30, L31, L32, L33, L34, L35, L36 }, \
|
||||
{ KC_NO, R00, R01, R02, R03, R04, R05 }, \
|
||||
{ KC_NO, R10, R11, R12, R13, R14, R15 }, \
|
||||
{ KC_NO, R20, R21, R22, R23, R24, R25 }, \
|
||||
{ R36, R30, R31, R32, R33, R34, R35 }, \
|
||||
} |
||||
#endif |
||||
#elif HELIX_ROWS == 5 |
||||
#ifndef FLIP_HALF |
||||
// Standard Keymap
|
||||
// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35, \
|
||||
L40, L41, L42, L43, L44, L45, L46, R46, R40, R41, R42, R43, R44, R45 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05, KC_NO }, \
|
||||
{ L10, L11, L12, L13, L14, L15, KC_NO }, \
|
||||
{ L20, L21, L22, L23, L24, L25, KC_NO }, \
|
||||
{ L30, L31, L32, L33, L34, L35, L36 }, \
|
||||
{ L40, L41, L42, L43, L44, L45, L46 }, \
|
||||
{ R05, R04, R03, R02, R01, R00, KC_NO }, \
|
||||
{ R15, R14, R13, R12, R11, R10, KC_NO }, \
|
||||
{ R25, R24, R23, R22, R21, R20, KC_NO }, \
|
||||
{ R35, R34, R33, R32, R31, R30, R36 }, \
|
||||
{ R45, R44, R43, R42, R41, R40, R46 } \
|
||||
} |
||||
#else |
||||
// Keymap with right side flipped
|
||||
// (TRRS jack on both halves are to the right)
|
||||
#define KEYMAP( \ |
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35, \
|
||||
L40, L41, L42, L43, L44, L45, L46, R46, R40, R41, R42, R43, R44, R45 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05, KC_NO }, \
|
||||
{ L10, L11, L12, L13, L14, L15, KC_NO }, \
|
||||
{ L20, L21, L22, L23, L24, L25, KC_NO }, \
|
||||
{ L30, L31, L32, L33, L34, L35, L36 }, \
|
||||
{ L40, L41, L42, L43, L44, L45, L46 }, \
|
||||
{ KC_NO, R00, R01, R02, R03, R04, R05 }, \
|
||||
{ KC_NO, R10, R11, R12, R13, R14, R15 }, \
|
||||
{ KC_NO, R20, R21, R22, R23, R24, R25 }, \
|
||||
{ R36, R30, R31, R32, R33, R34, R35 }, \
|
||||
{ R46, R40, R41, R42, R43, R44, R45 } \
|
||||
} |
||||
#endif |
||||
#else |
||||
#error "expected HELIX_ROWS 4 or 5" |
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1,3 @@ |
||||
SRC += rev2/matrix.c \
|
||||
rev2/split_util.c \
|
||||
ws2812.c
|
@ -0,0 +1,71 @@ |
||||
#include <avr/io.h> |
||||
#include <avr/wdt.h> |
||||
#include <avr/power.h> |
||||
#include <avr/interrupt.h> |
||||
#include <util/delay.h> |
||||
#include <avr/eeprom.h> |
||||
#include "split_util.h" |
||||
#include "matrix.h" |
||||
#include "keyboard.h" |
||||
#include "config.h" |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
# include "i2c.h" |
||||
#else |
||||
# include "serial.h" |
||||
#endif |
||||
|
||||
volatile bool isLeftHand = true; |
||||
|
||||
static void setup_handedness(void) { |
||||
#ifdef EE_HANDS |
||||
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); |
||||
#else |
||||
// I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
|
||||
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) |
||||
isLeftHand = !has_usb(); |
||||
#else |
||||
isLeftHand = has_usb(); |
||||
#endif |
||||
#endif |
||||
} |
||||
|
||||
static void keyboard_master_setup(void) { |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
i2c_master_init(); |
||||
#else |
||||
serial_master_init(); |
||||
#endif |
||||
} |
||||
|
||||
static void keyboard_slave_setup(void) { |
||||
|
||||
#ifdef USE_MATRIX_I2C |
||||
i2c_slave_init(SLAVE_I2C_ADDRESS); |
||||
#else |
||||
serial_slave_init(); |
||||
#endif |
||||
} |
||||
|
||||
bool has_usb(void) { |
||||
USBCON |= (1 << OTGPADE); //enables VBUS pad
|
||||
_delay_us(5); |
||||
return (USBSTA & (1<<VBUS)); //checks state of VBUS
|
||||
} |
||||
|
||||
void split_keyboard_setup(void) { |
||||
setup_handedness(); |
||||
|
||||
if (has_usb()) { |
||||
keyboard_master_setup(); |
||||
} else { |
||||
keyboard_slave_setup(); |
||||
} |
||||
sei(); |
||||
} |
||||
|
||||
// this code runs before the usb and keyboard is initialized
|
||||
void matrix_setup(void) { |
||||
split_keyboard_setup(); |
||||
} |
@ -0,0 +1,23 @@ |
||||
#ifndef SPLIT_KEYBOARD_UTIL_H |
||||
#define SPLIT_KEYBOARD_UTIL_H |
||||
|
||||
#include <stdbool.h> |
||||
|
||||
#ifdef EE_HANDS |
||||
#define EECONFIG_BOOTMAGIC_END (uint8_t *)10 |
||||
#define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END |
||||
#endif |
||||
|
||||
#define SLAVE_I2C_ADDRESS 0x32 |
||||
|
||||
extern volatile bool isLeftHand; |
||||
|
||||
// slave version of matix scan, defined in matrix.c
|
||||
void matrix_slave_scan(void); |
||||
|
||||
void split_keyboard_setup(void); |
||||
bool has_usb(void); |
||||
|
||||
void matrix_master_OLED_init (void); |
||||
|
||||
#endif |
@ -0,0 +1,73 @@ |
||||
SRC += i2c.c \
|
||||
serial.c \
|
||||
ssd1306.c
|
||||
|
||||
# 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)
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
BOOTLOADER = caterina
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
# Build Options
|
||||
# change to "no" to disable the options, or define them in the Makefile in
|
||||
# the appropriate keymap folder that will get included automatically
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||
SUBPROJECT_rev1 = no
|
||||
USE_I2C = yes
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
CUSTOM_MATRIX = yes
|
||||
|
||||
DEFAULT_FOLDER = helix/rev2
|
@ -0,0 +1,238 @@ |
||||
/*
|
||||
* WARNING: be careful changing this code, it is very timing dependent |
||||
*/ |
||||
|
||||
#ifndef F_CPU |
||||
#define F_CPU 16000000 |
||||
#endif |
||||
|
||||
#include <avr/io.h> |
||||
#include <avr/interrupt.h> |
||||
#include <util/delay.h> |
||||
#include <stdbool.h> |
||||
#include "serial.h" |
||||
|
||||
#ifdef USE_SERIAL |
||||
|
||||
// Serial pulse period in microseconds. Its probably a bad idea to lower this
|
||||
// value.
|
||||
#define SERIAL_DELAY 24 |
||||
|
||||
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; |
||||
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; |
||||
|
||||
#define SLAVE_DATA_CORRUPT (1<<0) |
||||
volatile uint8_t status = 0; |
||||
|
||||
inline static |
||||
void serial_delay(void) { |
||||
_delay_us(SERIAL_DELAY); |
||||
} |
||||
void serial_delay_short(void) { |
||||
_delay_us(SERIAL_DELAY-1); |
||||
} |
||||
inline static |
||||
void serial_output(void) { |
||||
SERIAL_PIN_DDR |= SERIAL_PIN_MASK; |
||||
} |
||||
|
||||
// make the serial pin an input with pull-up resistor
|
||||
inline static |
||||
void serial_input(void) { |
||||
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; |
||||
SERIAL_PIN_PORT |= SERIAL_PIN_MASK; |
||||
} |
||||
|
||||
inline static |
||||
uint8_t serial_read_pin(void) { |
||||
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); |
||||
} |
||||
|
||||
inline static |
||||
void serial_low(void) { |
||||
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; |
||||
} |
||||
|
||||
inline static |
||||
void serial_high(void) { |
||||
SERIAL_PIN_PORT |= SERIAL_PIN_MASK; |
||||
} |
||||
|
||||
void serial_master_init(void) { |
||||
serial_output(); |
||||
serial_high(); |
||||
} |
||||
|
||||
void serial_slave_init(void) { |
||||
serial_input(); |
||||
|
||||
#ifndef USE_SERIAL_PD2 |
||||
// Enable INT0
|
||||
EIMSK |= _BV(INT0); |
||||
// Trigger on falling edge of INT0
|
||||
EICRA &= ~(_BV(ISC00) | _BV(ISC01)); |
||||
#else |
||||
// Enable INT2
|
||||
EIMSK |= _BV(INT2); |
||||
// Trigger on falling edge of INT2
|
||||
EICRA &= ~(_BV(ISC20) | _BV(ISC21)); |
||||
#endif |
||||
} |
||||
|
||||
// Used by the master to synchronize timing with the slave.
|
||||
static |
||||
void sync_recv(void) { |
||||
serial_input(); |
||||
// This shouldn't hang if the slave disconnects because the
|
||||
// serial line will float to high if the slave does disconnect.
|
||||
while (!serial_read_pin()); |
||||
//serial_delay();
|
||||
_delay_us(SERIAL_DELAY-5); |
||||
} |
||||
|
||||
// Used by the slave to send a synchronization signal to the master.
|
||||
static |
||||
void sync_send(void) { |
||||
serial_output(); |
||||
|
||||
serial_low(); |
||||
serial_delay(); |
||||
|
||||
serial_high(); |
||||
} |
||||
|
||||
// Reads a byte from the serial line
|
||||
static |
||||
uint8_t serial_read_byte(void) { |
||||
uint8_t byte = 0; |
||||
serial_input(); |
||||
for ( uint8_t i = 0; i < 8; ++i) { |
||||
byte = (byte << 1) | serial_read_pin(); |
||||
serial_delay(); |
||||
_delay_us(1); |
||||
} |
||||
|
||||
return byte; |
||||
} |
||||
|
||||
// Sends a byte with MSB ordering
|
||||
static |
||||
void serial_write_byte(uint8_t data) { |
||||
uint8_t b = 8; |
||||
serial_output(); |
||||
while( b-- ) { |
||||
if(data & (1 << b)) { |
||||
serial_high(); |
||||
} else { |
||||
serial_low(); |
||||
} |
||||
serial_delay(); |
||||
} |
||||
} |
||||
|
||||
// interrupt handle to be used by the slave device
|
||||
ISR(SERIAL_PIN_INTERRUPT) { |
||||
sync_send(); |
||||
|
||||
uint8_t checksum = 0; |
||||
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { |
||||
serial_write_byte(serial_slave_buffer[i]); |
||||
sync_send(); |
||||
checksum += serial_slave_buffer[i]; |
||||
} |
||||
serial_write_byte(checksum); |
||||
sync_send(); |
||||
|
||||
// wait for the sync to finish sending
|
||||
serial_delay(); |
||||
|
||||
// read the middle of pulses
|
||||
_delay_us(SERIAL_DELAY/2); |
||||
|
||||
uint8_t checksum_computed = 0; |
||||
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { |
||||
serial_master_buffer[i] = serial_read_byte(); |
||||
sync_send(); |
||||
checksum_computed += serial_master_buffer[i]; |
||||
} |
||||
uint8_t checksum_received = serial_read_byte(); |
||||
sync_send(); |
||||
|
||||
serial_input(); // end transaction
|
||||
|
||||
if ( checksum_computed != checksum_received ) { |
||||
status |= SLAVE_DATA_CORRUPT; |
||||
} else { |
||||
status &= ~SLAVE_DATA_CORRUPT; |
||||
} |
||||
} |
||||
|
||||
inline |
||||
bool serial_slave_DATA_CORRUPT(void) { |
||||
return status & SLAVE_DATA_CORRUPT; |
||||
} |
||||
|
||||
// Copies the serial_slave_buffer to the master and sends the
|
||||
// serial_master_buffer to the slave.
|
||||
//
|
||||
// Returns:
|
||||
// 0 => no error
|
||||
// 1 => slave did not respond
|
||||
int serial_update_buffers(void) { |
||||
// this code is very time dependent, so we need to disable interrupts
|
||||
cli(); |
||||
|
||||
// signal to the slave that we want to start a transaction
|
||||
serial_output(); |
||||
serial_low(); |
||||
_delay_us(1); |
||||
|
||||
// wait for the slaves response
|
||||
serial_input(); |
||||
serial_high(); |
||||
_delay_us(SERIAL_DELAY); |
||||
|
||||
// check if the slave is present
|
||||
if (serial_read_pin()) { |
||||
// slave failed to pull the line low, assume not present
|
||||
sei(); |
||||
return 1; |
||||
} |
||||
|
||||
// if the slave is present syncronize with it
|
||||
sync_recv(); |
||||
|
||||
uint8_t checksum_computed = 0; |
||||
// receive data from the slave
|
||||
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { |
||||
serial_slave_buffer[i] = serial_read_byte(); |
||||
sync_recv(); |
||||
checksum_computed += serial_slave_buffer[i]; |
||||
} |
||||
uint8_t checksum_received = serial_read_byte(); |
||||
sync_recv(); |
||||
|
||||
if (checksum_computed != checksum_received) { |
||||
sei(); |
||||
return 2; |
||||
} |
||||
|
||||
uint8_t checksum = 0; |
||||
// send data to the slave
|
||||
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { |
||||
serial_write_byte(serial_master_buffer[i]); |
||||
sync_recv(); |
||||
checksum += serial_master_buffer[i]; |
||||
} |
||||
serial_write_byte(checksum); |
||||
sync_recv(); |
||||
|
||||
// always, release the line when not in use
|
||||
serial_output(); |
||||
serial_high(); |
||||
|
||||
sei(); |
||||
return 0; |
||||
} |
||||
|
||||
#endif |
@ -0,0 +1,36 @@ |
||||
#ifndef MY_SERIAL_H |
||||
#define MY_SERIAL_H |
||||
|
||||
#include "config.h" |
||||
#include <stdbool.h> |
||||
|
||||
/* TODO: some defines for interrupt setup */ |
||||
#define SERIAL_PIN_DDR DDRD |
||||
#define SERIAL_PIN_PORT PORTD |
||||
#define SERIAL_PIN_INPUT PIND |
||||
|
||||
#ifndef USE_SERIAL_PD2 |
||||
#define SERIAL_PIN_MASK _BV(PD0) |
||||
#define SERIAL_PIN_INTERRUPT INT0_vect |
||||
#else |
||||
#define SERIAL_PIN_MASK _BV(PD2) |
||||
#define SERIAL_PIN_INTERRUPT INT2_vect |
||||
#endif |
||||
|
||||
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 |
||||
#ifdef KEYBOARD_helix_rev1 |
||||
#define SERIAL_MASTER_BUFFER_LENGTH 1 |
||||
#else |
||||
#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 |
||||
#endif |
||||
|
||||
// Buffers for master - slave communication
|
||||
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; |
||||
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; |
||||
|
||||
void serial_master_init(void); |
||||
void serial_slave_init(void); |
||||
int serial_update_buffers(void); |
||||
bool serial_slave_data_corrupt(void); |
||||
|
||||
#endif |
@ -0,0 +1,324 @@ |
||||
#ifdef SSD1306OLED |
||||
|
||||
#include "ssd1306.h" |
||||
#include "i2c.h" |
||||
#include <string.h> |
||||
#include "print.h" |
||||
#include "common/glcdfont.c" |
||||
#ifdef ADAFRUIT_BLE_ENABLE |
||||
#include "adafruit_ble.h" |
||||
#endif |
||||
#ifdef PROTOCOL_LUFA |
||||
#include "lufa.h" |
||||
#endif |
||||
#include "sendchar.h" |
||||
#include "timer.h" |
||||
|
||||
// Set this to 1 to help diagnose early startup problems
|
||||
// when testing power-on with ble. Turn it off otherwise,
|
||||
// as the latency of printing most of the debug info messes
|
||||
// with the matrix scan, causing keys to drop.
|
||||
#define DEBUG_TO_SCREEN 0 |
||||
|
||||
//static uint16_t last_battery_update;
|
||||
//static uint32_t vbat;
|
||||
//#define BatteryUpdateInterval 10000 /* milliseconds */
|
||||
#define ScreenOffInterval 300000 /* milliseconds */ |
||||
#if DEBUG_TO_SCREEN |
||||
static uint8_t displaying; |
||||
#endif |
||||
static uint16_t last_flush; |
||||
|
||||
// Write command sequence.
|
||||
// Returns true on success.
|
||||
static inline bool _send_cmd1(uint8_t cmd) { |
||||
bool res = false; |
||||
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) { |
||||
xprintf("failed to start write to %d\n", SSD1306_ADDRESS); |
||||
goto done; |
||||
} |
||||
|
||||
if (i2c_master_write(0x0 /* command byte follows */)) { |
||||
print("failed to write control byte\n"); |
||||
|
||||
goto done; |
||||
} |
||||
|
||||
if (i2c_master_write(cmd)) { |
||||
xprintf("failed to write command %d\n", cmd); |
||||
goto done; |
||||
} |
||||
res = true; |
||||
done: |
||||
i2c_master_stop(); |
||||
return res; |
||||
} |
||||
|
||||
// Write 2-byte command sequence.
|
||||
// Returns true on success
|
||||
static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { |
||||
if (!_send_cmd1(cmd)) { |
||||
return false; |
||||
} |
||||
return _send_cmd1(opr); |
||||
} |
||||
|
||||
// Write 3-byte command sequence.
|
||||
// Returns true on success
|
||||
static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { |
||||
if (!_send_cmd1(cmd)) { |
||||
return false; |
||||
} |
||||
if (!_send_cmd1(opr1)) { |
||||
return false; |
||||
} |
||||
return _send_cmd1(opr2); |
||||
} |
||||
|
||||
#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} |
||||
#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} |
||||
#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} |
||||
|
||||
static void clear_display(void) { |
||||
matrix_clear(&display); |
||||
|
||||
// Clear all of the display bits (there can be random noise
|
||||
// in the RAM on startup)
|
||||
send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); |
||||
send_cmd3(ColumnAddr, 0, DisplayWidth - 1); |
||||
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) { |
||||
goto done; |
||||
} |
||||
if (i2c_master_write(0x40)) { |
||||
// Data mode
|
||||
goto done; |
||||
} |
||||
for (uint8_t row = 0; row < MatrixRows; ++row) { |
||||
for (uint8_t col = 0; col < DisplayWidth; ++col) { |
||||
i2c_master_write(0); |
||||
} |
||||
} |
||||
|
||||
display.dirty = false; |
||||
|
||||
done: |
||||
i2c_master_stop(); |
||||
} |
||||
|
||||
#if DEBUG_TO_SCREEN |
||||
#undef sendchar |
||||
static int8_t capture_sendchar(uint8_t c) { |
||||
sendchar(c); |
||||
iota_gfx_write_char(c); |
||||
|
||||
if (!displaying) { |
||||
iota_gfx_flush(); |
||||
} |
||||
return 0; |
||||
} |
||||
#endif |
||||
|
||||
bool iota_gfx_init(bool rotate) { |
||||
bool success = false; |
||||
|
||||
send_cmd1(DisplayOff); |
||||
send_cmd2(SetDisplayClockDiv, 0x80); |
||||
send_cmd2(SetMultiPlex, DisplayHeight - 1); |
||||
|
||||
send_cmd2(SetDisplayOffset, 0); |
||||
|
||||
|
||||
send_cmd1(SetStartLine | 0x0); |
||||
send_cmd2(SetChargePump, 0x14 /* Enable */); |
||||
send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); |
||||
|
||||
if(rotate){ |
||||
// the following Flip the display orientation 180 degrees
|
||||
send_cmd1(SegRemap); |
||||
send_cmd1(ComScanInc); |
||||
}else{ |
||||
// Flips the display orientation 0 degrees
|
||||
send_cmd1(SegRemap | 0x1); |
||||
send_cmd1(ComScanDec); |
||||
} |
||||
|
||||
send_cmd2(SetComPins, 0x2); |
||||
send_cmd2(SetContrast, 0x8f); |
||||
send_cmd2(SetPreCharge, 0xf1); |
||||
send_cmd2(SetVComDetect, 0x40); |
||||
send_cmd1(DisplayAllOnResume); |
||||
send_cmd1(NormalDisplay); |
||||
send_cmd1(DeActivateScroll); |
||||
send_cmd1(DisplayOn); |
||||
|
||||
send_cmd2(SetContrast, 0); // Dim
|
||||
|
||||
clear_display(); |
||||
|
||||
success = true; |
||||
|
||||
iota_gfx_flush(); |
||||
|
||||
#if DEBUG_TO_SCREEN |
||||
print_set_sendchar(capture_sendchar); |
||||
#endif |
||||
|
||||
done: |
||||
return success; |
||||
} |
||||
|
||||
bool iota_gfx_off(void) { |
||||
bool success = false; |
||||
|
||||
send_cmd1(DisplayOff); |
||||
success = true; |
||||
|
||||
done: |
||||
return success; |
||||
} |
||||
|
||||
bool iota_gfx_on(void) { |
||||
bool success = false; |
||||
|
||||
send_cmd1(DisplayOn); |
||||
success = true; |
||||
|
||||
done: |
||||
return success; |
||||
} |
||||
|
||||
void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { |
||||
*matrix->cursor = c; |
||||
++matrix->cursor; |
||||
|
||||
if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { |
||||
// We went off the end; scroll the display upwards by one line
|
||||
memmove(&matrix->display[0], &matrix->display[1], |
||||
MatrixCols * (MatrixRows - 1)); |
||||
matrix->cursor = &matrix->display[MatrixRows - 1][0]; |
||||
memset(matrix->cursor, ' ', MatrixCols); |
||||
} |
||||
} |
||||
|
||||
void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { |
||||
matrix->dirty = true; |
||||
|
||||
if (c == '\n') { |
||||
// Clear to end of line from the cursor and then move to the
|
||||
// start of the next line
|
||||
uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; |
||||
|
||||
while (cursor_col++ < MatrixCols) { |
||||
matrix_write_char_inner(matrix, ' '); |
||||
} |
||||
return; |
||||
} |
||||
|
||||
matrix_write_char_inner(matrix, c); |
||||
} |
||||
|
||||
void iota_gfx_write_char(uint8_t c) { |
||||
matrix_write_char(&display, c); |
||||
} |
||||
|
||||
void matrix_write(struct CharacterMatrix *matrix, const char *data) { |
||||
const char *end = data + strlen(data); |
||||
while (data < end) { |
||||
matrix_write_char(matrix, *data); |
||||
++data; |
||||
} |
||||
} |
||||
|
||||
void iota_gfx_write(const char *data) { |
||||
matrix_write(&display, data); |
||||
} |
||||
|
||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { |
||||
while (true) { |
||||
uint8_t c = pgm_read_byte(data); |
||||
if (c == 0) { |
||||
return; |
||||
} |
||||
matrix_write_char(matrix, c); |
||||
++data; |
||||
} |
||||
} |
||||
|
||||
void iota_gfx_write_P(const char *data) { |
||||
matrix_write_P(&display, data); |
||||
} |
||||
|
||||
void matrix_clear(struct CharacterMatrix *matrix) { |
||||
memset(matrix->display, ' ', sizeof(matrix->display)); |
||||
matrix->cursor = &matrix->display[0][0]; |
||||
matrix->dirty = true; |
||||
} |
||||
|
||||
void iota_gfx_clear_screen(void) { |
||||
matrix_clear(&display); |
||||
} |
||||
|
||||
void matrix_render(struct CharacterMatrix *matrix) { |
||||
last_flush = timer_read(); |
||||
iota_gfx_on(); |
||||
#if DEBUG_TO_SCREEN |
||||
++displaying; |
||||
#endif |
||||
|
||||
// Move to the home position
|
||||
send_cmd3(PageAddr, 0, MatrixRows - 1); |
||||
send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); |
||||
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) { |
||||
goto done; |
||||
} |
||||
if (i2c_master_write(0x40)) { |
||||
// Data mode
|
||||
goto done; |
||||
} |
||||
|
||||
for (uint8_t row = 0; row < MatrixRows; ++row) { |
||||
for (uint8_t col = 0; col < MatrixCols; ++col) { |
||||
const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth); |
||||
|
||||
for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) { |
||||
uint8_t colBits = pgm_read_byte(glyph + glyphCol); |
||||
i2c_master_write(colBits); |
||||
} |
||||
|
||||
// 1 column of space between chars (it's not included in the glyph)
|
||||
//i2c_master_write(0);
|
||||
} |
||||
} |
||||
|
||||
matrix->dirty = false; |
||||
|
||||
done: |
||||
i2c_master_stop(); |
||||
#if DEBUG_TO_SCREEN |
||||
--displaying; |
||||
#endif |
||||
} |
||||
|
||||
void iota_gfx_flush(void) { |
||||
matrix_render(&display); |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void iota_gfx_task_user(void) { |
||||
} |
||||
|
||||
void iota_gfx_task(void) { |
||||
iota_gfx_task_user(); |
||||
|
||||
if (display.dirty) { |
||||
iota_gfx_flush(); |
||||
} |
||||
|
||||
if (timer_elapsed(last_flush) > ScreenOffInterval) { |
||||
iota_gfx_off(); |
||||
} |
||||
} |
||||
#endif |
@ -0,0 +1,93 @@ |
||||
#ifndef SSD1306_H |
||||
#define SSD1306_H |
||||
|
||||
#include <stdbool.h> |
||||
#include <stdio.h> |
||||
#include "pincontrol.h" |
||||
#include "config.h" |
||||
|
||||
enum ssd1306_cmds { |
||||
DisplayOff = 0xAE, |
||||
DisplayOn = 0xAF, |
||||
|
||||
SetContrast = 0x81, |
||||
DisplayAllOnResume = 0xA4, |
||||
|
||||
DisplayAllOn = 0xA5, |
||||
NormalDisplay = 0xA6, |
||||
InvertDisplay = 0xA7, |
||||
SetDisplayOffset = 0xD3, |
||||
SetComPins = 0xda, |
||||
SetVComDetect = 0xdb, |
||||
SetDisplayClockDiv = 0xD5, |
||||
SetPreCharge = 0xd9, |
||||
SetMultiPlex = 0xa8, |
||||
SetLowColumn = 0x00, |
||||
SetHighColumn = 0x10, |
||||
SetStartLine = 0x40, |
||||
|
||||
SetMemoryMode = 0x20, |
||||
ColumnAddr = 0x21, |
||||
PageAddr = 0x22, |
||||
|
||||
ComScanInc = 0xc0, |
||||
ComScanDec = 0xc8, |
||||
SegRemap = 0xa0, |
||||
SetChargePump = 0x8d, |
||||
ExternalVcc = 0x01, |
||||
SwitchCapVcc = 0x02, |
||||
|
||||
ActivateScroll = 0x2f, |
||||
DeActivateScroll = 0x2e, |
||||
SetVerticalScrollArea = 0xa3, |
||||
RightHorizontalScroll = 0x26, |
||||
LeftHorizontalScroll = 0x27, |
||||
VerticalAndRightHorizontalScroll = 0x29, |
||||
VerticalAndLeftHorizontalScroll = 0x2a, |
||||
}; |
||||
|
||||
// Controls the SSD1306 128x32 OLED display via i2c
|
||||
|
||||
#ifndef SSD1306_ADDRESS |
||||
#define SSD1306_ADDRESS 0x3C |
||||
#endif |
||||
|
||||
#define DisplayHeight 32 |
||||
#define DisplayWidth 128 |
||||
|
||||
#define FontHeight 8 |
||||
#define FontWidth 6 |
||||
|
||||
#define MatrixRows (DisplayHeight / FontHeight) |
||||
#define MatrixCols (DisplayWidth / FontWidth) |
||||
|
||||
struct CharacterMatrix { |
||||
uint8_t display[MatrixRows][MatrixCols]; |
||||
uint8_t *cursor; |
||||
bool dirty; |
||||
}; |
||||
|
||||
struct CharacterMatrix display; |
||||
|
||||
bool iota_gfx_init(bool rotate); |
||||
void iota_gfx_task(void); |
||||
bool iota_gfx_off(void); |
||||
bool iota_gfx_on(void); |
||||
void iota_gfx_flush(void); |
||||
void iota_gfx_write_char(uint8_t c); |
||||
void iota_gfx_write(const char *data); |
||||
void iota_gfx_write_P(const char *data); |
||||
void iota_gfx_clear_screen(void); |
||||
|
||||
void iota_gfx_task_user(void); |
||||
|
||||
void matrix_clear(struct CharacterMatrix *matrix); |
||||
void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); |
||||
void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); |
||||
void matrix_write(struct CharacterMatrix *matrix, const char *data); |
||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data); |
||||
void matrix_render(struct CharacterMatrix *matrix); |
||||
|
||||
|
||||
|
||||
#endif |
@ -0,0 +1,41 @@ |
||||
/*
|
||||
Copyright 2017 Danny Nguyen <danny@hexwire.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_USER_H |
||||
#define CONFIG_USER_H |
||||
|
||||
#include "config_common.h" |
||||
|
||||
/* Use I2C or Serial, not both */ |
||||
|
||||
#define USE_SERIAL |
||||
// #define USE_I2C
|
||||
|
||||
/* Select hand configuration */ |
||||
|
||||
#define MASTER_LEFT |
||||
// #define MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
#undef RGBLED_NUM |
||||
#define RGBLIGHT_ANIMATIONS |
||||
#define RGBLED_NUM 12 |
||||
#define RGBLIGHT_HUE_STEP 8 |
||||
#define RGBLIGHT_SAT_STEP 8 |
||||
#define RGBLIGHT_VAL_STEP 8 |
||||
|
||||
#endif |
@ -0,0 +1,297 @@ |
||||
#include "iris.h" |
||||
#include "action_layer.h" |
||||
#include "eeconfig.h" |
||||
|
||||
extern keymap_config_t keymap_config; |
||||
|
||||
|
||||
//Heavily modified keymap. Some features:
|
||||
//Multiple layouts, I use dvorak as main.
|
||||
//Nordic(swedish) signs
|
||||
//Symbols, numpad, arrows/navigation reachable under the alpas via the layers
|
||||
//Mirrored ctl, alt and shift to be able to use both hands when doing commands
|
||||
//Gaming layer, qwerty with space on left half.
|
||||
|
||||
#define _QWERTY 2 |
||||
#define _DVORAK 0 |
||||
#define _COLEMAK 1 |
||||
#define _WORKMAN 3 |
||||
#define _GAMING 4 |
||||
#define _NUMPAD 5 |
||||
#define _LOWER 6 |
||||
#define _RAISE 7 |
||||
|
||||
#define _ADJUST 16 |
||||
|
||||
enum custom_keycodes { |
||||
QWERTY = SAFE_RANGE, |
||||
DVORAK, |
||||
COLEMAK, |
||||
WORKMAN, |
||||
GAMING, |
||||
NUMPAD, |
||||
LOWER, |
||||
RAISE, |
||||
ADJUST, |
||||
}; |
||||
|
||||
#define KC_ KC_TRNS |
||||
#define _______ KC_TRNS |
||||
#define KC_XXXX KC_NO |
||||
|
||||
#define KC_Sw2 RALT(KC_2) // Nordic @
|
||||
#define KC_Sw3 RALT(KC_3) // Nordic something
|
||||
#define KC_Sw4 RALT(KC_4) // Nordic something
|
||||
#define KC_Sw5 RALT(KC_5) // Nordic something
|
||||
#define KC_Sw6 RALT(KC_6) // ...
|
||||
#define KC_Sw7 RALT(KC_7) |
||||
#define KC_Sw8 RALT(KC_8) |
||||
#define KC_Sw9 RALT(KC_9) |
||||
#define KC_Sw0 RALT(KC_0) |
||||
#define KC_Tild RALT(KC_RBRC) |
||||
#define KC_Bsls RALT(KC_MINS) |
||||
#define KC_Bar RALT(KC_NUBS) |
||||
#define KC_Less S(KC_NUBS) |
||||
#define KC_CATDEL LCTL(LALT(KC_DEL)) // Ctrl alt del
|
||||
#define KC_TSKMGR LCTL(S(KC_ESC)) // Ctrl shift esc
|
||||
#define KC_NUMP TG(_NUMPAD) // Toggle layer NUMPAD for use in KC_keymaps
|
||||
#define KC_Close RALT(KC_F4) // Alt F4
|
||||
#define KC_Great S(KC_NUBS) |
||||
#define KC_MEH1 MEH(KC_1) |
||||
#define KC_MEH2 MEH(KC_2) |
||||
#define KC_MEH3 MEH(KC_3) |
||||
#define KC_MEH4 MEH(KC_4) |
||||
#define KC_MEH5 MEH(KC_5) |
||||
|
||||
#define KC_LOWR LOWER |
||||
#define KC_RASE RAISE |
||||
#define KC_RST RESET |
||||
#define KC_BL_S BL_STEP |
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||
|
||||
[_QWERTY] = KC_KEYMAP( |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
TAB , Q , W , E , R , T , Y , U , I , O , P ,LBRC, |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
LCTL, A , S , D , F , G , H , J , K , L ,SCLN,QUOT, |
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
LSFT, Z , X , C , V , B ,NUMP, ENT , N , M ,COMM,DOT ,SLSH,RSFT, |
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
LALT,LOWR,BSPC, SPC ,RASE,LALT |
||||
// `----+----+----' `----+----+----'
|
||||
), |
||||
|
||||
[_GAMING] = KC_KEYMAP( |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,ESC , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
TAB , Q , W , E , R , T , Y , U , I , O , P ,DEL, |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
LCTL, A , S , D , F , G , H , J , K , L ,SCLN,RCTL, |
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
LSFT, Z , X , C , V , B , Y , ENT , N , M ,COMM,DOT ,SLSH,RSFT, |
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
LALT,LOWR,SPC, BSPC ,RASE,LALT |
||||
// `----+----+----' `----+----+----'
|
||||
), |
||||
|
||||
[_DVORAK] = KC_KEYMAP( |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
DEL ,APP ,VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
TAB ,LBRC,QUOT,SCLN, P , Y , F , G , C , R , L ,DEL, |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
LCTL, A , O , E , U , I , D , H , T , N , S ,RCTL, |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
LSFT,DOT , Q , J , K , X ,NUMP, ENT , B , M , W , V , Z ,RSFT, |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
LALT,LOWR,BSPC, SPC ,RASE,LALT |
||||
// `----+----+----' `----+----+----'
|
||||
), |
||||
|
||||
[_COLEMAK] = KC_KEYMAP( |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
TAB , Q , W , F , P , G , J , L , U , Y ,LBRC,QUOT, |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
LCTL, A , R , S , T , D , H , N , E , I , O ,SCLN, |
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
LSFT, Z , X , C , V , B ,NUMP, ENT , K , M ,COMM, DOT,SLSH,RSFT, |
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
LALT,LOWR,BSPC, SPC ,RASE,LALT |
||||
// `----+----+----' `----+----+----'
|
||||
), |
||||
|
||||
[_WORKMAN] = KC_KEYMAP( |
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
TAB , Q , W , R , W , B , J , F , U , P ,LBRC,SCLN, |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
LCTL, A , S , H , T , G , Y , N , E , O , I ,RCTL, |
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
LSFT, Z , X , M , C , V ,NUMP, ENT , K , L ,QUOT, DOT,SLSH,RSFT, |
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
LALT,LOWR,BSPC, SPC ,RASE,LALT |
||||
// `----+----+----' `----+----+----'
|
||||
),
|
||||
|
||||
[_NUMPAD] = KC_KEYMAP(
|
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
,MEH1,BTN2,MS_U,BTN1,CATDEL, PIPE, P7 , P8 , P9 ,SLSH, , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
,MEH4,MS_L,MS_D,MS_R,TSKMGR, COMM, P4 , P5 , P6 ,MINS, , |
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
,MEH5,ACL0,ACL1,ACL2,MEH3, , PENT,DOT , P1 , P2 , P3 , P0 , , |
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
LALT,LOWR,BSPC, , P0 ,NLCK |
||||
// `----+----+----' `----+----+----'
|
||||
), |
||||
|
||||
|
||||
[_LOWER] = KC_KEYMAP(
|
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
,CAPS,PGUP, UP ,PGDN, ESC, RCBR,EXLM,ASTR,LPRN,UNDS, , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
,HOME,LEFT,DOWN,RGHT, END, RPRN,QUES,Sw8 ,Sw9 ,LABK, , |
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
, ENT, , , , DEL, , ,RABK,NUBS,Sw7 ,Sw0 ,Great, , |
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
, , , , ,
|
||||
// `----+----+----' `----+----+----'
|
||||
), |
||||
|
||||
[_RAISE] = KC_KEYMAP(
|
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
TILD,EXLM,GRV ,EQL, DLR ,PERC, Sw3 ,Sw5 ,Sw6 ,Sw0 ,RPRN, , |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
,Bar ,Sw2 ,HASH, AT ,PERC, PIPE, 7 , 8 , 9 ,PMNS,PSLS, |
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
,Bsls,Tild,SLSH,AMPR,BSLS, COMM, 4 , 5 , 6 ,PPLS,PAST, |
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
,PIPE,Sw4 ,PLUS,CIRC,TILD, , PENT,DOT , 1 , 2 , 3 , 0 ,PEQL, |
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
, ,DEL , , ,
|
||||
// `----+----+----' `----+----+----'
|
||||
), |
||||
|
||||
[_ADJUST] = KEYMAP(
|
||||
//,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------.
|
||||
GAMING , DVORAK, WORKMAN, COLEMAK, QWERTY , KC_RST, _______, _______, _______, _______, KC_PWR, RESET, |
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||
_______, _______, _______,LGUI(KC_UP),_______,LALT(KC_F4), _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, |
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||
_______, _______,LGUI(KC_LEFT),LGUI(KC_DOWN),LGUI(KC_RGHT),_______, _______, DEBUG , RGB_HUD, RGB_SAD, RGB_VAD, BL_STEP, |
||||
//|--------+--------+--------+--------+--------+--------+--------. ,--------|--------+--------+--------+--------+--------+--------|
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||
//`--------+--------+--------+----+---+--------+--------+--------/ \--------+--------+--------+---+----+--------+--------+--------'
|
||||
_______, _______, _______, _______, _______, _______ |
||||
// `--------+--------+--------' `--------+--------+--------'
|
||||
) |
||||
|
||||
}; |
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND); |
||||
#endif |
||||
|
||||
void persistent_default_layer_set(uint16_t default_layer) { |
||||
eeconfig_update_default_layer(default_layer); |
||||
default_layer_set(default_layer); |
||||
} |
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
||||
switch (keycode) { |
||||
case QWERTY: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
PLAY_SONG(tone_qwerty); |
||||
#endif |
||||
persistent_default_layer_set(1UL<<_QWERTY); |
||||
} |
||||
return false; |
||||
break; |
||||
case DVORAK: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
// PLAY_SONG(tone_qwerty);
|
||||
#endif |
||||
persistent_default_layer_set(1UL<<_DVORAK); |
||||
} |
||||
return false; |
||||
break; |
||||
case NUMPAD: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
// PLAY_SONG(tone_qwerty);
|
||||
#endif |
||||
persistent_default_layer_set(1UL<<_NUMPAD); |
||||
} |
||||
return false; |
||||
break; |
||||
case COLEMAK: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
// PLAY_SONG(tone_qwerty);
|
||||
#endif |
||||
persistent_default_layer_set(1UL<<_COLEMAK); |
||||
} |
||||
return false; |
||||
break; |
||||
case WORKMAN: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
// PLAY_SONG(tone_qwerty);
|
||||
#endif |
||||
persistent_default_layer_set(1UL<<_WORKMAN); |
||||
} |
||||
return false; |
||||
break; |
||||
case GAMING: |
||||
if (record->event.pressed) { |
||||
#ifdef AUDIO_ENABLE |
||||
// PLAY_SONG(tone_qwerty);
|
||||
#endif |
||||
persistent_default_layer_set(1UL<<_GAMING); |
||||
} |
||||
return false; |
||||
break; |
||||
case LOWER: |
||||
if (record->event.pressed) { |
||||
layer_on(_LOWER); |
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST); |
||||
} else { |
||||
layer_off(_LOWER); |
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case RAISE: |
||||
if (record->event.pressed) { |
||||
layer_on(_RAISE); |
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST); |
||||
} else { |
||||
layer_off(_RAISE); |
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
case ADJUST: |
||||
if (record->event.pressed) { |
||||
layer_on(_ADJUST); |
||||
} else { |
||||
layer_off(_ADJUST); |
||||
} |
||||
return false; |
||||
break; |
||||
} |
||||
return true; |
||||
} |
@ -0,0 +1,6 @@ |
||||
RGBLIGHT_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = yes
|
||||
|
||||
ifndef QUANTUM_DIR |
||||
include ../../../../Makefile
|
||||
endif |
@ -0,0 +1 @@ |
||||
TAP_DANCE_ENABLE = yes
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue