diff options
-rw-r--r-- | keyboards/handwired/dactyl/config.h | 67 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/dactyl.c | 80 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/dactyl.h | 74 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/i2cmaster.h | 178 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/keymaps/default/keymap.c | 183 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/keymaps/default/readme.md | 10 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/keymaps/dvorak/keymap.c | 183 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/keymaps/dvorak/readme.md | 9 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/keymaps/erincalling/keymap.c | 162 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/keymaps/erincalling/readme.md | 6 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/matrix.c | 393 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/readme.md | 37 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/rules.mk | 86 | ||||
-rw-r--r-- | keyboards/handwired/dactyl/twimaster.c | 207 |
14 files changed, 1675 insertions, 0 deletions
diff --git a/keyboards/handwired/dactyl/config.h b/keyboards/handwired/dactyl/config.h new file mode 100644 index 0000000000..8129b0a670 --- /dev/null +++ b/keyboards/handwired/dactyl/config.h @@ -0,0 +1,67 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com> +Copyright 2017 Erin Call <hello@erincall.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 DACTYL_CONFIG_H +#define DACTYL_CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x1308 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Adereth +#define PRODUCT Dactyl +#define DESCRIPTION An ortholinear, split, 3D-curved keyboard with thumb clusters. + +/* key matrix size + * At this time, "row" in the dactyl's code actually means "column" on the + * physical keyboard. It's confusing. I'm sorry. Blame Jack Humbert :P + */ +#define MATRIX_ROWS 12 +#define MATRIX_COLS 6 + +#define MOUSEKEY_INTERVAL 20 +#define MOUSEKEY_DELAY 0 +#define MOUSEKEY_TIME_TO_MAX 60 +#define MOUSEKEY_MAX_SPEED 7 +#define MOUSEKEY_WHEEL_DELAY 0 + +#define TAPPING_TOGGLE 1 + +#define TAPPING_TERM 200 +#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.) + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \ + keyboard_report->mods == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \ +) + +/* fix space cadet rollover issue */ +#define DISABLE_SPACE_CADET_ROLLOVER + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 15 + +#define PREVENT_STUCK_MODIFIERS + +#define USB_MAX_POWER_CONSUMPTION 500 + +#endif diff --git a/keyboards/handwired/dactyl/dactyl.c b/keyboards/handwired/dactyl/dactyl.c new file mode 100644 index 0000000000..3f59154fdc --- /dev/null +++ b/keyboards/handwired/dactyl/dactyl.c @@ -0,0 +1,80 @@ +#include "dactyl.h" +#include "i2cmaster.h" + + +bool i2c_initialized = 0; +uint8_t mcp23018_status = 0x20; + +void matrix_init_kb(void) { + DDRB &= ~(1<<4); // set B(4) as input + PORTB &= ~(1<<4); // set B(4) internal pull-up disabled + + // unused pins - C7, D4, D5, D7, E6 + // set as input with internal pull-up enabled + DDRC &= ~(1<<7); + DDRD &= ~(1<<5 | 1<<4); + DDRE &= ~(1<<6); + PORTC |= (1<<7); + PORTD |= (1<<5 | 1<<4); + PORTE |= (1<<6); + + matrix_init_user(); +} + +uint8_t init_mcp23018(void) { + mcp23018_status = 0x20; + + // I2C subsystem + + if (i2c_initialized == 0) { + i2c_init(); // on pins D(1,0) + i2c_initialized = true; + _delay_ms(1000); + } + + // set pin direction + // - unused : input : 1 + // - input : input : 1 + // - driving : output : 0 + mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(IODIRA); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out; + i2c_stop(); + + // set pull-up + // - unused : on : 1 + // - input : on : 1 + // - driving : off : 0 + mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(GPPUA); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out; + +out: + i2c_stop(); + + return mcp23018_status; +} + +#ifdef ONEHAND_ENABLE +__attribute__ ((weak)) +// swap-hands action needs a matrix to define the swap +const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + /* Left hand, matrix positions */ + {{0,11}, {1,11}, {2,11}, {3,11}, {4,11}, {5,11}}, + {{0,10}, {1,10}, {2,10}, {3,10}, {4,10}, {5,10}}, + {{0,9}, {1,9}, {2,9}, {3,9}, {4,9}, {5,9}}, + {{0,8}, {1,8}, {2,8}, {3,8}, {4,8}, {5,8}}, + {{0,7}, {1,7}, {2,7}, {3,7}, {4,7}, {5,7}}, + {{0,6}, {1,6}, {2,6}, {3,6}, {4,6}, {5,6}}, + + /* Right hand, matrix positions */ + {{0,5}, {1,5}, {2,5}, {3,5}, {4,5}, {5,5}}, + {{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}}, + {{0,3}, {1,3}, {2,3}, {3,3}, {4,3}, {5,3}}, + {{0,2}, {1,2}, {2,2}, {3,2}, {4,2}, {5,2}}, + {{0,1}, {1,1}, {2,1}, {3,1}, {4,1}, {5,1}}, + {{0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}}, +}; +#endif diff --git a/keyboards/handwired/dactyl/dactyl.h b/keyboards/handwired/dactyl/dactyl.h new file mode 100644 index 0000000000..aa573ebd2a --- /dev/null +++ b/keyboards/handwired/dactyl/dactyl.h @@ -0,0 +1,74 @@ +#ifndef DACTYL_H +#define DACTYL_H + +#include "quantum.h" +#include <stdint.h> +#include <stdbool.h> +#include "i2cmaster.h" +#include <util/delay.h> + +#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) +#define CPU_16MHz 0x00 + +// I2C aliases and register addresses (see "mcp23018.md") +#define I2C_ADDR 0b0100000 +#define I2C_ADDR_WRITE ( (I2C_ADDR<<1) | I2C_WRITE ) +#define I2C_ADDR_READ ( (I2C_ADDR<<1) | I2C_READ ) +#define IODIRA 0x00 // i/o direction register +#define IODIRB 0x01 +#define GPPUA 0x0C // GPIO pull-up resistor register +#define GPPUB 0x0D +#define GPIOA 0x12 // general purpose i/o port register (write modifies OLAT) +#define GPIOB 0x13 +#define OLATA 0x14 // output latch register +#define OLATB 0x15 + +extern uint8_t mcp23018_status; + +void init_dactyl(void); +uint8_t init_mcp23018(void); + +#define KEYMAP( \ + \ + /* left hand, spatial positions */ \ + k00,k01,k02,k03,k04,k05, \ + k10,k11,k12,k13,k14,k15, \ + k20,k21,k22,k23,k24,k25, \ + k30,k31,k32,k33,k34,k35, \ + k40,k41,k42,k43,k44, \ + k55,k50, \ + k54, \ + k53,k52,k51, \ + \ + /* right hand, spatial positions */ \ + k06,k07,k08,k09,k0A,k0B, \ + k16,k17,k18,k19,k1A,k1B, \ + k26,k27,k28,k29,k2A,k2B, \ + k36,k37,k38,k39,k3A,k3B, \ + k47,k48,k49,k4A,k4B, \ + k5B,k56, \ + k57, \ + k5A,k59,k58 ) \ + \ + /* matrix positions */ \ + { \ + { k00, k10, k20, k30, k40, k50 }, \ + { k01, k11, k21, k31, k41, k51 }, \ + { k02, k12, k22, k32, k42, k52 }, \ + { k03, k13, k23, k33, k43, k53 }, \ + { k04, k14, k24, k34, k44, k54 }, \ + { k05, k15, k25, k35, KC_NO, k55 }, \ + \ + { k06, k16, k26, k36, KC_NO, k56 }, \ + { k07, k17, k27, k37, k47, k57 }, \ + { k08, k18, k28, k38, k48, k58 }, \ + { k09, k19, k29, k39, k49, k59 }, \ + { k0A, k1A, k2A, k3A, k4A, k5A }, \ + { k0B, k1B, k2B, k3B, k4B, k5B } \ + } + + + +#define LAYOUT_dactyl KEYMAP + +#endif diff --git a/keyboards/handwired/dactyl/i2cmaster.h b/keyboards/handwired/dactyl/i2cmaster.h new file mode 100644 index 0000000000..3917b9e6c0 --- /dev/null +++ b/keyboards/handwired/dactyl/i2cmaster.h @@ -0,0 +1,178 @@ +#ifndef _I2CMASTER_H +#define _I2CMASTER_H 1 +/************************************************************************* +* Title: C include file for the I2C master interface +* (i2cmaster.S or twimaster.c) +* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury +* File: $Id: i2cmaster.h,v 1.10 2005/03/06 22:39:57 Peter Exp $ +* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3 +* Target: any AVR device +* Usage: see Doxygen manual +**************************************************************************/ + +#ifdef DOXYGEN +/** + @defgroup pfleury_ic2master I2C Master library + @code #include <i2cmaster.h> @endcode + + @brief I2C (TWI) Master Software Library + + Basic routines for communicating with I2C slave devices. This single master + implementation is limited to one bus master on the I2C bus. + + This I2c library is implemented as a compact assembler software implementation of the I2C protocol + which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c). + Since the API for these two implementations is exactly the same, an application can be linked either against the + software I2C implementation or the hardware I2C implementation. + + Use 4.7k pull-up resistor on the SDA and SCL pin. + + Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module + i2cmaster.S to your target when using the software I2C implementation ! + + Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion. + + @note + The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted + to GNU assembler and AVR-GCC C call interface. + Replaced the incorrect quarter period delays found in AVR300 with + half period delays. + + @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury + + @par API Usage Example + The following code shows typical usage of this library, see example test_i2cmaster.c + + @code + + #include <i2cmaster.h> + + + #define Dev24C02 0xA2 // device address of EEPROM 24C02, see datasheet + + int main(void) + { + unsigned char ret; + + i2c_init(); // initialize I2C library + + // write 0x75 to EEPROM address 5 (Byte Write) + i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode + i2c_write(0x05); // write address = 5 + i2c_write(0x75); // write value 0x75 to EEPROM + i2c_stop(); // set stop conditon = release bus + + + // read previously written value back from EEPROM address 5 + i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode + + i2c_write(0x05); // write address = 5 + i2c_rep_start(Dev24C02+I2C_READ); // set device address and read mode + + ret = i2c_readNak(); // read one byte from EEPROM + i2c_stop(); + + for(;;); + } + @endcode + +*/ +#endif /* DOXYGEN */ + +/**@{*/ + +#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304 +#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !" +#endif + +#include <avr/io.h> + +/** defines the data direction (reading from I2C device) in i2c_start(),i2c_rep_start() */ +#define I2C_READ 1 + +/** defines the data direction (writing to I2C device) in i2c_start(),i2c_rep_start() */ +#define I2C_WRITE 0 + + +/** + @brief initialize the I2C master interace. Need to be called only once + @param void + @return none + */ +extern void i2c_init(void); + + +/** + @brief Terminates the data transfer and releases the I2C bus + @param void + @return none + */ +extern void i2c_stop(void); + + +/** + @brief Issues a start condition and sends address and transfer direction + + @param addr address and transfer direction of I2C device + @retval 0 device accessible + @retval 1 failed to access device + */ +extern unsigned char i2c_start(unsigned char addr); + + +/** + @brief Issues a repeated start condition and sends address and transfer direction + + @param addr address and transfer direction of I2C device + @retval 0 device accessible + @retval 1 failed to access device + */ +extern unsigned char i2c_rep_start(unsigned char addr); + + +/** + @brief Issues a start condition and sends address and transfer direction + + If device is busy, use ack polling to wait until device ready + @param addr address and transfer direction of I2C device + @return none + */ +extern void i2c_start_wait(unsigned char addr); + + +/** + @brief Send one byte to I2C device + @param data byte to be transfered + @retval 0 write successful + @retval 1 write failed + */ +extern unsigned char i2c_write(unsigned char data); + + +/** + @brief read one byte from the I2C device, request more data from device + @return byte read from I2C device + */ +extern unsigned char i2c_readAck(void); + +/** + @brief read one byte from the I2C device, read is followed by a stop condition + @return byte read from I2C device + */ +extern unsigned char i2c_readNak(void); + +/** + @brief read one byte from the I2C device + + Implemented as a macro, which calls either i2c_readAck or i2c_readNak + + @param ack 1 send ack, request more data from device<br> + 0 send nak, read is followed by a stop condition + @return byte read from I2C device + */ +extern unsigned char i2c_read(unsigned char ack); +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); + + +/**@}*/ +#endif diff --git a/keyboards/handwired/dactyl/keymaps/default/keymap.c b/keyboards/handwired/dactyl/keymaps/default/keymap.c new file mode 100644 index 0000000000..0d414d85b2 --- /dev/null +++ b/keyboards/handwired/dactyl/keymaps/default/keymap.c @@ -0,0 +1,183 @@ +#include "dactyl.h" +#include "debug.h" +#include "action_layer.h" +#include "version.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, // ensure these codes start after the highest keycode defined in Quantum + VRSN, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,-----------------------------------------. ,-----------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Del | Q | W | E | R | T | | Y | U | I | O | P | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | BkSp | A | S | D | F | G | | H | J | K | L |; / L2|'/Cmd | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * |LShift|Z/Ctrl| X | C | V | B | | N | M | , | . |//Ctrl|RShift| + * |------+------+------+------+------+------' `------+------+------+------+------+------| + * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | LGui | | Alt | ^/Esc| + * ,------|------|------| |------+------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `--------------------' + */ +[BASE] = LAYOUT_dactyl( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, + KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, + LT(SYMB,KC_GRV), KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT, + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPC, KC_BSPC, KC_END, + // right hand + KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), GUI_T(KC_QUOT), + KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, KC_FN1, + KC_RALT, CTL_T(KC_ESC), + KC_PGUP, + KC_PGDN, KC_TAB, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,-----------------------------------------. ,-----------------------------------------. + * |Versn | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | ! | @ | { | } | | | | Up | 7 | 8 | 9 | * | F12 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | # | $ | ( | ) | ` | | Down | 4 | 5 | 6 | + | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | % | ^ | [ | ] | ~ | | & | 1 | 2 | 3 | \ | | + * |------+------+------+------+------+------' `------+------+------+------+------+------| + * |RESET | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = LAYOUT_dactyl( + // left hand + VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + KC_TRNS, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, + KC_TRNS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, + KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS, KC_DOT, KC_0, KC_EQL, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | MsUp | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | |MsLeft|MsDown|MsRght| | | | | | | | Play | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | Prev | Next | | | + * |------+------+------+------+------+------' `------+------+------+------+------+------| + * | | | | Lclk | Rclk | | VolUp| VolDn| Mute | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | |Brwser| + * | | |------| |------| |Back | + * | | | | | | | | + * `--------------------' `--------------------' + * + */ +// MEDIA AND MOUSE +[MDIA] = LAYOUT_dactyl( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + 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_MPLY, + KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, + KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_WBAK +), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +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) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + break; + case 1: + if (record->event.pressed) { // For resetting EEPROM + eeconfig_init(); + } + break; + } + return MACRO_NONE; +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; + } + return true; +} + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + +}; + + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) {}; diff --git a/keyboards/handwired/dactyl/keymaps/default/readme.md b/keyboards/handwired/dactyl/keymaps/default/readme.md new file mode 100644 index 0000000000..e393e396e3 --- /dev/null +++ b/keyboards/handwired/dactyl/keymaps/default/readme.md @@ -0,0 +1,10 @@ +# Dactyl Default Configuration + +## Changelog + +* Nov 2017: + * Copied and adapted from the Ergodox EZ equivalent + * Notable differences: + - Don't try to have the columns that don't exist, naturally + - Removed RGB keys, since there are no RGB LEDs in the Dactyl (as designed, at least) + diff --git a/keyboards/handwired/dactyl/keymaps/dvorak/keymap.c b/keyboards/handwired/dactyl/keymaps/dvorak/keymap.c new file mode 100644 index 0000000000..a0b98b993d --- /dev/null +++ b/keyboards/handwired/dactyl/keymaps/dvorak/keymap.c @@ -0,0 +1,183 @@ +#include "dactyl.h" +#include "debug.h" +#include "action_layer.h" +#include "version.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, // ensure these codes start after the highest keycode defined in Quantum + VRSN, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,-----------------------------------------. ,-----------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Del | '" | , | . | P | Y | | F | G | C | R | L | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | BkSp | A | O | E | U | I | | D | H | T | N | S/L2 |//Cmd | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * |LShift|;/Ctrl| Q | J | K | X | | B | M | W | V |Z/Ctrl|RShift| + * |------+------+------+------+------+------' `------+------+------+------+------+------| + * |Grv/L1| = |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | LGui | | Alt | ^/Esc| + * ,------|------|------| |------+------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `--------------------' + */ +[BASE] = LAYOUT_dactyl( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, + KC_DELT, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, + KC_BSPC, KC_A, KC_O, KC_E, KC_U, KC_I, + KC_LSFT, CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, + LT(SYMB,KC_GRV), KC_EQL, LALT(KC_LSFT), KC_LEFT, KC_RGHT, + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPC, KC_BSPC, KC_END, + // right hand + KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS, + KC_D, KC_H, KC_T, KC_N, LT(MDIA, KC_S), GUI_T(KC_SLSH), + KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_RSFT, + KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, KC_FN1, + KC_RALT, CTL_T(KC_ESC), + KC_PGUP, + KC_PGDN, KC_TAB, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,-----------------------------------------. ,-----------------------------------------. + * |Versn | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | ! | @ | { | } | | | | Up | 7 | 8 | 9 | * | F12 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | # | $ | ( | ) | ` | | Down | 4 | 5 | 6 | + | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | % | ^ | [ | ] | ~ | | & | 1 | 2 | 3 | \ | | + * |------+------+------+------+------+------' `------+------+------+------+------+------| + * |RESET | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = LAYOUT_dactyl( + // left hand + VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + KC_TRNS, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, + KC_TRNS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, + KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS, KC_DOT, KC_0, KC_EQL, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | MsUp | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | |MsLeft|MsDown|MsRght| | | | | | | | Play | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | Prev | Next | | | + * |------+------+------+------+------+------' `------+------+------+------+------+------| + * | | | | Lclk | Rclk | | VolUp| VolDn| Mute | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | |Brwser| + * | | |------| |------| |Back | + * | | | | | | | | + * `--------------------' `--------------------' + * + */ +// MEDIA AND MOUSE +[MDIA] = LAYOUT_dactyl( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + 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_MPLY, + KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, + KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_WBAK +), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +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) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + break; + case |