diff options
author | peepeetee <43021794+peepeetee@users.noreply.github.com> | 2021-08-21 22:53:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-22 13:53:49 +1000 |
commit | 78ccd9c201199444bc06161b05ee8d7ba9c31613 (patch) | |
tree | 726d9e55d8cde510fe72bc1fb9bb2a7dabdbecc2 /keyboards/ktec/ergodone | |
parent | c70abc8d047319830e369ae4e14cd43bae3bd3b8 (diff) |
Organize KPrepublic, K.T.E.C, xiudi boards into directories (#12159)
* reset; redoing my steps; and recommit
* include xd002/.noci
Diffstat (limited to 'keyboards/ktec/ergodone')
28 files changed, 3491 insertions, 0 deletions
diff --git a/keyboards/ktec/ergodone/config.h b/keyboards/ktec/ergodone/config.h new file mode 100644 index 0000000000..39e0ae8c75 --- /dev/null +++ b/keyboards/ktec/ergodone/config.h @@ -0,0 +1,81 @@ +#ifndef ERGODOX_ERGODONE_CONFIG_H +#define ERGODOX_ERGODONE_CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x1209 +#define PRODUCT_ID 0x2328 +// The official ErgoDone VID and PID are documented at http://pid.codes/1209/2328/. +#define DEVICE_VER 0x0001 +#define MANUFACTURER K.T.E.C. +#define PRODUCT ErgoDone + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 14 + +#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 if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +#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.) + +/* 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() ( \ + get_mods() == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \ + get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \ +) + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +#define LED_BRIGHTNESS_LO 15 +#define LED_BRIGHTNESS_HI 255 + +/* fix space cadet rollover issue */ +#define DISABLE_SPACE_CADET_ROLLOVER + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +#define USB_MAX_POWER_CONSUMPTION 500 + +/* NKRO */ +#ifndef FORCE_NKRO + #define FORCE_NKRO // Depends on NKRO_ENABLE. +#endif + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION +//#define DEBUG_MATRIX_SCAN_RATE + +#endif diff --git a/keyboards/ktec/ergodone/ergodone.c b/keyboards/ktec/ergodone/ergodone.c new file mode 100644 index 0000000000..e0579408e5 --- /dev/null +++ b/keyboards/ktec/ergodone/ergodone.c @@ -0,0 +1,54 @@ +#include "ergodone.h" + +extern inline void ergodox_board_led_on(void); +extern inline void ergodox_right_led_1_on(void); +extern inline void ergodox_right_led_2_on(void); +extern inline void ergodox_right_led_3_on(void); +extern inline void ergodox_right_led_on(uint8_t led); + +extern inline void ergodox_board_led_off(void); +extern inline void ergodox_right_led_1_off(void); +extern inline void ergodox_right_led_2_off(void); +extern inline void ergodox_right_led_3_off(void); +extern inline void ergodox_right_led_off(uint8_t led); + +extern inline void ergodox_led_all_off(void); + +void ergodox_led_init(void); +void ergodox_blink_all_leds(void); + +void matrix_init_kb(void) { + ergodox_led_init(); + ergodox_blink_all_leds(); + matrix_init_user(); +} + +void ergodox_led_init(void) + { + DDRB |= (1<<PB5 | 1<<PB6 | 1<<PB3); + PORTB &= ~(1<<PB5 | 1<<PB6 | 1<<PB3); + DDRB |= (1<<PB0); + PORTB |= (1<<PB0); + DDRD |= (1<<PB5); + PORTD |= (1<<PB5); +} + +void ergodox_blink_all_leds(void) +{ + ergodox_led_all_off(); + ergodox_led_all_set(LED_BRIGHTNESS_HI); + ergodox_right_led_1_on(); + _delay_ms(50); + ergodox_right_led_2_on(); + _delay_ms(50); + ergodox_right_led_3_on(); + _delay_ms(50); + ergodox_right_led_1_off(); + _delay_ms(50); + ergodox_right_led_2_off(); + _delay_ms(50); + ergodox_right_led_3_off(); + //ergodox_led_all_on(); + //_delay_ms(333); + ergodox_led_all_off(); +} diff --git a/keyboards/ktec/ergodone/ergodone.h b/keyboards/ktec/ergodone/ergodone.h new file mode 100644 index 0000000000..f88280fa2a --- /dev/null +++ b/keyboards/ktec/ergodone/ergodone.h @@ -0,0 +1,182 @@ +#ifndef ERGODOX_ERGODONE_H +#define ERGODOX_ERGODONE_H + +#include "quantum.h" +#include <stdint.h> +#include <stdbool.h> + +#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) +#define CPU_16MHz 0x00 + +void init_ergodox(void); + +inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<PB5); PORTB &= ~(1<<PB5); } +inline void ergodox_right_led_1_on(void) { DDRB |= (1<<PB5); PORTB |= (1<<PB5); } +inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<PB6); PORTB &= ~(1<<PB6); } +inline void ergodox_right_led_2_on(void) { DDRB |= (1<<PB6); PORTB |= (1<<PB6); } +inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<PB3); PORTB &= ~(1<<PB3); } +inline void ergodox_right_led_3_on(void) { DDRB |= (1<<PB3); PORTB |= (1<<PB3); } +inline void ergodox_right_led_on(uint8_t l) { + switch (l) { + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + case 3: + ergodox_right_led_3_on(); + break; + default: + break; + } +} + +inline void ergodox_right_led_off(uint8_t l) { + switch (l) { + case 1: + ergodox_right_led_1_off(); + break; + case 2: + ergodox_right_led_2_off(); + break; + case 3: + ergodox_right_led_3_off(); + break; + default: + break; + } +} +inline void ergodox_board_led_off(void) { DDRB &= ~(1<<PB0); PORTB |= (1<<PB0); } +inline void ergodox_board_led_on(void) { DDRB |= (1<<PB0); PORTB &= ~(1<<PB0); } +inline void ergodox_led_all_on(void) { + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); + ergodox_board_led_on(); +} +inline void ergodox_led_all_off(void) { + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + ergodox_board_led_off(); +} +inline void ergodox_right_led_1_set(uint8_t n) {} +inline void ergodox_right_led_2_set(uint8_t n) {} +inline void ergodox_right_led_3_set(uint8_t n) {} +inline void ergodox_right_led_set(uint8_t l, uint8_t n) {} +inline void ergodox_led_all_set(uint8_t n) {} + +/* + * LEFT HAND: LINES 76-83 + * RIGHT HAND: LINES 85-92 + */ +#define LAYOUT_ergodox( \ + \ + k00,k01,k02,k03,k04,k05,k06, \ + k10,k11,k12,k13,k14,k15,k16, \ + k20,k21,k22,k23,k24,k25, \ + k30,k31,k32,k33,k34,k35,k36, \ + k40,k41,k42,k43,k44, \ + k55,k56, \ + k54, \ + k53,k52,k51, \ + \ + k07,k08,k09,k0A,k0B,k0C,k0D, \ + k17,k18,k19,k1A,k1B,k1C,k1D, \ + k28,k29,k2A,k2B,k2C,k2D, \ + k37,k38,k39,k3A,k3B,k3C,k3D, \ + k49,k4A,k4B,k4C,k4D, \ + k57,k58, \ + k59, \ + k5C,k5B,k5A ) \ + \ + /* matrix positions */ \ + { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D }, \ + { k20, k21, k22, k23, k24, k25, KC_NO, KC_NO, k28, k29, k2A, k2B, k2C, k2D }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D }, \ + { k40, k41, k42, k43, k44, KC_NO, KC_NO, KC_NO, KC_NO, k49, k4A, k4B, k4C, k4D }, \ + { KC_NO, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B, k5C, KC_NO } \ + } + +/* + * LEFT HAND: LINES 110-117 + * RIGHT HAND: LINES 119-126 + */ +#define LAYOUT_ergodox_80( \ + \ + k00,k01,k02,k03,k04,k05,k06, \ + k10,k11,k12,k13,k14,k15,k16, \ + k20,k21,k22,k23,k24,k25, \ + k30,k31,k32,k33,k34,k35,k36, \ + k40,k41,k42,k43,k44, \ + k55,k56, \ + k45,k46,k54, \ + k53,k52,k51, \ + \ + k07,k08,k09,k0A,k0B,k0C,k0D, \ + k17,k18,k19,k1A,k1B,k1C,k1D, \ + k28,k29,k2A,k2B,k2C,k2D, \ + k37,k38,k39,k3A,k3B,k3C,k3D, \ + k49,k4A,k4B,k4C,k4D, \ + k57,k58, \ + k59,k47,k48, \ + k5C,k5B,k5A ) \ + \ + /* matrix positions */ \ + { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D }, \ + { k20, k21, k22, k23, k24, k25, KC_NO, KC_NO, k28, k29, k2A, k2B, k2C, k2D }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D }, \ + { k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4A, k4B, k4C, k4D }, \ + { KC_NO, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B, k5C, KC_NO } \ + } + +/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */ +#define LAYOUT_ergodox_pretty( \ + \ + L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \ + L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \ + L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \ + L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \ + L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \ + L55,L56, R50,R51, \ + L54, R52, \ + L53,L52,L51, R55,R54,R53 ) \ + \ + /* matrix positions */ \ + { \ + { L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06 }, \ + { L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16 }, \ + { L20,L21,L22,L23,L24,L25,KC_NO, KC_NO,R21,R22,R23,R24,R25,R26 }, \ + { L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36 }, \ + { L40,L41,L42,L43,L44,KC_NO,KC_NO, KC_NO,KC_NO,R42,R43,R44,R45,R46 }, \ + { KC_NO,L51,L52,L53,L54,L55,L56, R50,R51,R52,R53,R54,R55,KC_NO } \ + } + +/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */ +#define LAYOUT_ergodox_pretty_80( \ + \ + L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \ + L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \ + L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \ + L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \ + L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \ + L55,L56, R50,R51, \ + L45,L46,L54, R52,R40,R41, \ + L53,L52,L51, R55,R54,R53 ) \ + \ + /* matrix positions */ \ + { \ + { L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06 }, \ + { L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16 }, \ + { L20,L21,L22,L23,L24,L25,KC_NO, KC_NO,R21,R22,R23,R24,R25,R26 }, \ + { L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36 }, \ + { L40,L41,L42,L43,L44,L45,L46, R40,R41,R42,R43,R44,R45,R46 }, \ + { KC_NO,L51,L52,L53,L54,L55,L56, R50,R51,R52,R53,R54,R55,KC_NO } \ + } + +#endif diff --git a/keyboards/ktec/ergodone/expander.c b/keyboards/ktec/ergodone/expander.c new file mode 100644 index 0000000000..0c8a2289c5 --- /dev/null +++ b/keyboards/ktec/ergodone/expander.c @@ -0,0 +1,120 @@ +#include <stdbool.h> +#include "action.h" +#include "i2cmaster.h" +#include "expander.h" +#include "debug.h" + +static uint8_t expander_status = 0; +static uint8_t expander_input = 0; + +void expander_config(void); +uint8_t expander_write(uint8_t reg, uint8_t data); +uint8_t expander_read(uint8_t reg, uint8_t *data); + +void expander_init(void) +{ + i2c_init(); + expander_scan(); +} + +void expander_scan(void) +{ + dprintf("expander status: %d ... ", expander_status); + uint8_t ret = i2c_start(EXPANDER_ADDR | I2C_WRITE); + if (ret == 0) { + i2c_stop(); + if (expander_status == 0) { + dprintf("attached\n"); + expander_status = 1; + expander_config(); + clear_keyboard(); + } + } + else { + if (expander_status == 1) { + dprintf("detached\n"); + expander_status = 0; + clear_keyboard(); + } + } + dprintf("%d\n", expander_status); +} + +void expander_read_cols(void) +{ + expander_read(EXPANDER_REG_GPIOA, &expander_input); +} + +uint8_t expander_get_col(uint8_t col) +{ + if (col > 4) { + col++; + } + return expander_input & (1<<col) ? 1 : 0; +} + +matrix_row_t expander_read_row(void) +{ + expander_read_cols(); + + /* make cols */ + matrix_row_t cols = 0; + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + if (expander_get_col(col)) { + cols |= (1UL << (MATRIX_COLS - 1 - col)); + } + } + + return cols; +} + +void expander_unselect_rows(void) +{ + expander_write(EXPANDER_REG_IODIRB, 0xFF); +} + +void expander_select_row(uint8_t row) +{ + expander_write(EXPANDER_REG_IODIRB, ~(1<<(row+1))); +} + +void expander_config(void) +{ + expander_write(EXPANDER_REG_IPOLA, 0xFF); + expander_write(EXPANDER_REG_GPPUA, 0xFF); + expander_write(EXPANDER_REG_IODIRB, 0xFF); +} + +uint8_t expander_write(uint8_t reg, uint8_t data) +{ + if (expander_status == 0) { + return 0; + } + uint8_t ret; + ret = i2c_start(EXPANDER_ADDR | I2C_WRITE); + if (ret) goto stop; + ret = i2c_write(reg); + if (ret) goto stop; + ret = i2c_write(data); + stop: + i2c_stop(); + return ret; +} + +uint8_t expander_read(uint8_t reg, uint8_t *data) +{ + if (expander_status == 0) { + return 0; + } + uint8_t ret; + ret = i2c_start(EXPANDER_ADDR | I2C_WRITE); + if (ret) goto stop; + ret = i2c_write(reg); + if (ret) goto stop; + ret = i2c_rep_start(EXPANDER_ADDR | I2C_READ); + if (ret) goto stop; + *data = i2c_readNak(); + stop: + i2c_stop(); + return ret; +} diff --git a/keyboards/ktec/ergodone/expander.h b/keyboards/ktec/ergodone/expander.h new file mode 100644 index 0000000000..8676fed693 --- /dev/null +++ b/keyboards/ktec/ergodone/expander.h @@ -0,0 +1,48 @@ +#ifndef EXPANDER_H +#define EXPANDER_H + +#include <stdint.h> +#include "matrix.h" + +#define MCP23017 +#define MCP23017_A0 0 +#define MCP23017_A1 0 +#define MCP23017_A2 0 + +#ifdef MCP23017 +#define EXPANDER_ADDR ((0x20|(MCP23017_A0<<0)|(MCP23017_A1<<1)|(MCP23017_A2<<2)) << 1) +enum EXPANDER_REG_BANK0 { + EXPANDER_REG_IODIRA = 0, + EXPANDER_REG_IODIRB, + EXPANDER_REG_IPOLA, + EXPANDER_REG_IPOLB, + EXPANDER_REG_GPINTENA, + EXPANDER_REG_GPINTENB, + EXPANDER_REG_DEFVALA, + EXPANDER_REG_DEFVALB, + EXPANDER_REG_INTCONA, + EXPANDER_REG_INTCONB, + EXPANDER_REG_IOCONA, + EXPANDER_REG_IOCONB, + EXPANDER_REG_GPPUA, + EXPANDER_REG_GPPUB, + EXPANDER_REG_INTFA, + EXPANDER_REG_INTFB, + EXPANDER_REG_INTCAPA, + EXPANDER_REG_INTCAPB, + EXPANDER_REG_GPIOA, + EXPANDER_REG_GPIOB, + EXPANDER_REG_OLATA, + EXPANDER_REG_OLATB +}; +#endif + +void expander_init(void); +void expander_scan(void); +void expander_read_cols(void); +uint8_t expander_get_col(uint8_t col); +matrix_row_t expander_read_row(void); +void expander_unselect_rows(void); +void expander_select_row(uint8_t row); + +#endif diff --git a/keyboards/ktec/ergodone/i2cmaster.h b/keyboards/ktec/ergodone/i2cmaster.h new file mode 100644 index 0000000000..3917b9e6c0 --- /dev/null +++ b/keyboards/ktec/ergodone/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/ktec/ergodone/info.json b/keyboards/ktec/ergodone/info.json new file mode 100644 index 0000000000..33128758ac --- /dev/null +++ b/keyboards/ktec/ergodone/info.json @@ -0,0 +1,107 @@ +{ + "keyboard_name": "Ergodone", + "maintainer": "Yu He", + "width": 17, + "height": 8, + + "layouts": { + "LAYOUT_ergodox": { + + "layout": [ + {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, + {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, + {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25}, + {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5}, + {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125}, + + {"x":6, "y":5}, {"x":7, "y":5}, + {"x":7, "y":6}, + {"x":5, "y":6, "h":2}, {"x":6, "y":6, "h":2}, {"x":7, "y":7}, + + + {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5}, + {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5}, + {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5}, + {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5}, + {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375}, + + + {"x":9, "y":5}, {"x":10, "y":5}, + {"x":9, "y":6}, + {"x":9, "y":7}, {"x":10, "y":6, "h":2}, {"x":11, "y":6, "h":2} + ] + }, + "LAYOUT_ergodox_pretty": { + "layout": [ + {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, + {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5}, + + {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, + {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5}, + + {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25}, + {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5}, + + {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5}, + {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5}, + + {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125}, + {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375}, + + {"x":6, "y":5}, {"x":7, "y":5}, {"x":9, "y":5}, {"x":10, "y":5}, + {"x":7, "y":6}, {"x":9, "y":6}, + {"x":5, "y":6, "h":2}, {"x":6, "y":6, "h":2}, {"x":7, "y":7}, {"x":9, "y":7}, {"x":10, "y":6, "h":2}, {"x":11, "y":6, "h":2} + ] + }, + "LAYOUT_ergodox_80": { + + "layout": [ + {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, + {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, + {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25}, + {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5}, + {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125}, + + {"x":6, "y":5}, {"x":7, "y":5}, + + {"x":5, "y":6}, {"x":6, "y":6}, {"x":7, "y":6}, + {"x":5, "y":7}, {"x":6, "y":7}, {"x":7, "y":7}, + + + {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5}, + {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5}, + {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5}, + {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5}, + {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375}, + + + {"x":9, "y":5}, {"x":10, "y":5}, + {"x":9, "y":6}, {"x":10, "y":6}, {"x":11, "y":6}, + {"x":9, "y":7}, {"x":10, "y":7}, {"x":11, "y":7} + ] + }, + "LAYOUT_ergodox_pretty_80": { + + "layout": [ + {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, + {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5}, + + {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, + {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5}, + + {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25}, + {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5}, + + {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5}, + {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5}, + + {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125}, + {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375}, + + {"x":6, "y":5}, {"x":7, "y":5}, {"x":9, "y":5}, {"x":10, "y":5}, + {"x":5, "y":6}, {"x":6, "y":6}, {"x":7, "y":6}, {"x":9, "y":6}, {"x":10, "y":6}, {"x":11, "y":6}, + {"x":5, "y":7}, {"x":6, "y":7}, {"x":7, "y":7}, {"x":9, "y":7}, {"x":10, "y":7}, {"x":11, "y":7} + ] + } + } +} diff --git a/keyboards/ktec/ergodone/keymaps/art/keymap.c b/keyboards/ktec/ergodone/keymaps/art/keymap.c new file mode 100644 index 0000000000..7fcbd5b615 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/art/keymap.c @@ -0,0 +1,446 @@ +#include "art.h" +#include "sendstring_workman_zxcvm.h" + +bool is_win = true; + +enum custom_keycodes { + keyboardSpecificKeyCode = NEW_SAFE_RANGE //not used +}; + +void led_show_current_os(void) { + if (is_win) { + ergodox_right_led_1_on(); + wait_ms(50); + ergodox_right_led_1_off(); + wait_ms(50); + ergodox_right_led_1_on(); + wait_ms(50); + ergodox_right_led_1_off(); + wait_ms(50); + ergodox_right_led_1_on(); + wait_ms(50); + ergodox_right_led_1_off(); + wait_ms(50); + } else { + ergodox_right_led_3_on(); + wait_ms(50); + ergodox_right_led_3_off(); + wait_ms(50); + ergodox_right_led_3_on(); + wait_ms(50); + ergodox_right_led_3_off(); + wait_ms(50); + ergodox_right_led_3_on(); + wait_ms(50); + ergodox_right_led_3_off(); + wait_ms(50); + } +} + +void matrix_init_user(void) { + led_show_current_os(); +} + +void led_set_user(uint8_t usb_led) { + if (usb_led & (1<<USB_LED_CAPS_LOCK)) { + ergodox_right_led_2_on(); + } else { + ergodox_right_led_2_off(); + } +} + + + +layer_state_t layer_state_set_user(layer_state_t state) { + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_3_off(); + switch (get_highest_layer(state)) { + case NAV: + case CTRL_NAV: + case SHIFT_NAV: + ergodox_right_led_1_on(); + break; + case FKEYS: + ergodox_right_led_3_on(); + break; + } + return state; +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Base qwerty layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ` ~ | 1 | 2 | 3 | 4 | 5 | ESC | | - _ | 6 | 7 | 8 | 9 | 0 | ] | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | E | R | T | ??? | | = | Y | U | I | O | P | [ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Caps | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | + * |--------+------+------+------+------+------| FKEYS| | FKEYS|------+------+------+------+------+--------| + * | LShift | Z | X | C | V | B | | | | N | M | , | . | / git| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |LCtrl |Media\| Win |Alt | NAV | | Home | End |Workmn| | RCtrl| + * `----------------------------------' `----------------------------------' + * ,-------------. ,---------------. + * | Del | Ins | | Left | Right | + * ,------|------|------| |------+--------+------. + * | | | PgUp | |SFT_NV| | | + * | Space|BSpace|------| |------| NAV |Enter | + * | | | PgDn | |CTR_NV| | | + * `--------------------' `----------------------' + */ +[QWERTY] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESCAPE, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, XXXXXXX, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, TT(FKEYS), + KC_LCTRL, LT(MEDIA, KC_BSLASH), KC_LWIN, KC_LALT, LT(NAV, KC_RIGHT), + + KC_DEL, KC_INS, + KC_PGUP, + KC_SPC, LT(COMBOS,KC_BSPC), KC_PGDOWN, + + // -----------------------------------------------------right hand----------------------------------------------------- + KC_MINS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RBRC, + KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + TT(FKEYS), KC_N, KC_M, KC_COMM, KC_DOT, LT(GIT,KC_SLSH), KC_RSFT, + KC_HOME, KC_END, DF(WORKMAN), KC_RALT, KC_RCTRL, + + KC_LEFT, KC_RIGHT, + LT(SHIFT_NAV, KC_UP), + LT(CTRL_NAV, KC_DOWN), MO(NAV), KC_ENT +), + /* Workman + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | Q | D | R | W | B | | | | J | F | U | P | ; | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | A | S | H | T | G |------| |------| Y | N | E | O | I | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | Z | X | C | V | M | | | | K | L | , | . | / | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | |QWERTY| | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,---------------. + * | | | | | | + * ,------|------|------| |------+--------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `----------------------' + */ +[WORKMAN] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, KC_Q, KC_D, KC_R, KC_W, KC_B, _______, + _______, KC_A, KC_S, KC_H, KC_T, KC_G, + _______, KC_Z, KC_X, KC_C, KC_V, KC_M, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______, + + // -----------------------------------------------------right hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, KC_J, KC_F, KC_U, KC_P, KC_SCLN, _______, + KC_Y, KC_N, KC_E, KC_O, KC_I, _______, + _______, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______, + _______, _______, DF(QWERTY), _______, _______, + + _______, _______, + _______, + _______, _______, _______ +), + +[FKEYS] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______, + // -----------------------------------------------------right hand----------------------------------------------------- + _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + _______, _______, _______, _______, _______, _______, KC_F12, + _______, _______, _______, _______, _______, KC_PSCREEN, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______ +), + +[NAV] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + _______, LALT(KC_F1), LALT(KC_F2), LALT(KC_F3), LALT(KC_F4), LALT(KC_F5), _______, + _______, _______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, + _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDOWN, + _______, _______, _______, _______, KC_LALT, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, KC_DEL, _______, + // -----------------------------------------------------right hand----------------------------------------------------- + _______, LALT(KC_F6), LALT(KC_F7), LALT(KC_F8), LALT(KC_F9), LALT(KC_F10), LALT(KC_F11), + _______, _______, _______, _______, _______, _______, LALT(KC_F12), + _______, CTR_ALT, KC_RSFT, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______ +), + +[CTRL_NAV] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, CTL_ALT(KC_HOME), CTL_ALT(KC_UP), CTL_ALT(KC_END), CTL_ALT(KC_PGUP), _______, + _______, _______, CTL_ALT(KC_LEFT), CTL_ALT(KC_DOWN), CTL_ALT(KC_RIGHT),CTL_ALT(KC_PGDOWN), + _______, _______, CTL_ALT(KC_X), CTL_ALT(KC_C), CTL_ALT(KC_V), _______, _______, + _______, _______, _______, _______, _______, + + CTL_ALT(KC_DEL), _______, + _______, + _______, CTL_ALT(KC_BSPC), CTL_ALT(KC_DEL), + // -----------------------------------------------------right hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + CTL_ALT(KC_HOME), CTL_ALT(KC_END), _______, _______, _______, + + CTL_ALT(KC_LEFT), CTL_ALT(KC_RIGHT), + KC_RSFT, + _______, _______, _______ +), + +[SHIFT_NAV] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, LSFT(KC_HOME), LSFT(KC_UP), LSFT(KC_END), LSFT(KC_PGUP), _______, + _______, _______, LSFT(KC_LEFT), LSFT(KC_DOWN), LSFT(KC_RIGHT), LSFT(KC_PGDOWN), + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______, + + + // -----------------------------------------------------right hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + LSFT(KC_HOME), LSFT(KC_END), _______, _______, _______, + + LSFT(KC_LEFT), LSFT(KC_RIGHT), + _______, + CTR_ALT, _______, _______ +), + +[COMBOS] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + TILD_BLOCK, PRESCRIPTION, _______, _______, FOURS, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, ADMINS, SARCASM, _______, CTRL_CTV, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______, + + // -----------------------------------------------------right hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, CTRL_LCTV, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______ +), + +// [STRINGS] = LAYOUT_ergodox( +// // -----------------------------------------------------left hand----------------------------------------------------- +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, + +// _______, _______, +// _______, +// _______, _______, _______, + +// // -----------------------------------------------------right hand----------------------------------------------------- +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, + +// _______, _______, +// _______, +// _______, _______, _______ +// ), + +[MEDIA] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_MPRV, KC_VOLU, KC_MNXT, _______, _______, + _______, _______, _______, KC_VOLD, _______, _______, + _______, _______, _______, KC_MUTE, KC_MPLY, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______, + + // -----------------------------------------------------right hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, TOG_OS, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______ +), + +[GIT] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, G_DIFF, G_RST, _______, G_BRCH, _______, + _______, G_ADD, G_S, _______, _______, _______, + _______, _______, _______, G_C, _______, G_MERG, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______, + + // -----------------------------------------------------right hand----------------------------------------------------- + _______, _______, _______, _______, _______, _______, _______, + _______, _______, G_FTCH, _______, G_P, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, G_LOG, _______, G_DEV, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______ +), + +[GIT_C] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, G_CHEC, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + + XXXXXXX, XXXXXXX, + XXXXXXX, + XXXXXXX, KC_BSPC, XXXXXXX, + + // -----------------------------------------------------right hand----------------------------------------------------- + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, G_COMM, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + + XXXXXXX, XXXXXXX, + XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX +), + +[GIT_S] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, G_STSH, G_SHOW, G_STAT, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + + XXXXXXX, XXXXXXX, + XXXXXXX, + XXXXXXX, KC_BSPC, XXXXXXX, + + // -----------------------------------------------------right hand----------------------------------------------------- + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, G_COMM, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + + XXXXXXX, XXXXXXX, + XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX +), + + +/* Numpad + * + * ,--------------------------------------------------. + * | | | | | | / | | + * |------+------+------+------+------+------+--------| + * | | | 7 | 8 | 9 | * | | + * | |------+------+------+------+------+--------| + * |------| | 4 | 5 | 6 | - | Enter | + * | |------+------+------+------+------+--------| + * | | | 1 | 2 | 3 | + | Enter | + * `-------------+------+------+------+------+--------' + * | | 0 | . | Calc | Calc | + * `----------------------------------' + */ + +// [] = LAYOUT_ergodox( +// // -----------------------------------------------------left hand----------------------------------------------------- +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, + +// _______, _______, +// _______, +// _______, _______, _______, + +// // -----------------------------------------------------right hand----------------------------------------------------- +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, + +// _______, _______, +// _______, +// _______, _______, _______ +// ), + +}; + +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + + } + return true; +} diff --git a/keyboards/ktec/ergodone/keymaps/default/keymap.c b/keyboards/ktec/ergodone/keymaps/default/keymap.c new file mode 100644 index 0000000000..2fc5344011 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/default/keymap.c @@ -0,0 +1,199 @@ +#include QMK_KEYBOARD_H +#include "version.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, // can always be here + EPRM, + VRSN, + RGB_SLD +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd | + * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | LGui | | Alt |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = LAYOUT_ergodox( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), + 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, ALL_T(KC_NO), + 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_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(SYMB), 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), + MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, TT(SYMB), + KC_LALT, CTL_T(KC_ESC), + KC_PGUP, + KC_PGDN,KC_TAB, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,---------------------------------------------------. ,--------------------------------------------------. + * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | EPRM | | | | | | | . | 0 | = | | + * `-----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * |Animat| | |Toggle|Solid | + * ,------|------|------| |------+------+------. + * |Bright|Bright| | | |Hue- |Hue+ | + * |ness- |ness+ |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = LAYOUT_ergodox( + // left hand + VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + RGB_MOD,KC_TRNS, + KC_TRNS, + RGB_VAD,RGB_VAI,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, 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_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + RGB_TOG, RGB_SLD, + KC_TRNS, + KC_TRNS, RGB_HUD, RGB_HUI +), +/* 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_ergodox( + KC_TRNS, 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_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_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_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, 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 +), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // dynamically generate these. + case EPRM: + if (record->event.pressed) { + eeconfig_init(); + } + return false; + break; + case VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; + case RGB_SLD: + if (record->event.pressed) { + #ifdef RGBLIGHT_ENABLE + rgblight_mode(1); + #endif + } + 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) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboards/ktec/ergodone/keymaps/default/readme.md b/keyboards/ktec/ergodone/keymaps/default/readme.md new file mode 100644 index 0000000000..1150a4f709 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/default/readme.md @@ -0,0 +1,15 @@ +# ErgoDox EZ Default Configuration + +## Changelog + +* Dec 2016: + * Added LED keys + * Refreshed layout graphic, comes from http://configure.ergodox-ez.com now. +* Sep 22, 2016: + * Created a new key in layer 1 (bottom-corner key) that resets the EEPROM. +* Feb 2, 2016 (V1.1): + * Made the right-hand quote key double as Cmd/Win on hold. So you get ' when you tap it, " when you tap it with Shift, and Cmd or Win when you hold it. You can then use it as a modifier, or just press and hold it for a moment (and then let go) to send a single Cmd or Win keystroke (handy for opening the Start menu on Windows). + +This is what we ship with out of the factory. :) The image says it all: + +![Default](https://i.imgur.com/Be53jH7.png)
\ No newline at end of file diff --git a/keyboards/ktec/ergodone/keymaps/eozaki/keymap.c b/keyboards/ktec/ergodone/keymaps/eozaki/keymap.c new file mode 100644 index 0000000000..09854ee89c --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/eozaki/keymap.c @@ -0,0 +1,201 @@ +#include QMK_KEYBOARD_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, // can always be here + EPRM, + VRSN, + RGB_SLD +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | ~ | | ' | 6 | 7 | 8 | 9 | 0 | = | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Del | Q | W | E | R | T | ~ | | " | Y | U | I | O | P | - | + * |--------+------+------+------+------+------| ` | | |------+------+------+------+------+--------| + * | Ctrl | A | S | D | F | G |------| |------| H | J | K | L | ; | \ | + * |--------+------+------+------+------+------| { | | } |------+------+------+------+------+--------| + * | LAlt | Z | X | C | V | B | [ | | ] | N | M | , | . | / | LShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | LT-1 | F4 | F5 | F6 | F11 | | Left | Down | Up | Right| RAlt | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | L1 | Prev | | Vol+ | L2 | + * ,------|------|------| |------+--------+------. + * | | | Play | | Vol- | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | Next | | Mute | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = LAYOUT_ergodox( // layer 0 : default + // left hand + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_GRV, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, + LT(SYMB, KC_F2), KC_F4, KC_F5, KC_F6, KC_F11, + TG(SYMB), KC_MPRV, + KC_MPLY, + KC_SPC,KC_BSPC,KC_MNXT, + // right hand + KC_QUOT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, + LSFT(KC_QUOT), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, + KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),KC_BSLS, + KC_RBRC, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_LSFT, + KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_RALT, + KC_VOLU, TG(MDIA), + KC_VOLD, + KC_MUTE,KC_TAB, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,---------------------------------------------------. ,--------------------------------------------------. + * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | EPRM | | | | | | | . | 0 | = | | + * `-----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * |Animat| | |Toggle|Solid | + * ,------|------|------| |------+------+------. + * |Bright|Bright| | | |Hue- |Hue+ | + * |ness- |ness+ |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = LAYOUT_ergodox( + // left hand + VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + RGB_MOD,KC_TRNS, + KC_TRNS, + RGB_VAD,RGB_VAI,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, 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_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + RGB_TOG, RGB_SLD, + KC_TRNS, + KC_TRNS, RGB_HUD, RGB_HUI +), +/* 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_ergodox( + KC_TRNS, 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_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_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_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, 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 +), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // dynamically generate these. + case EPRM: + if (record->event.pressed) { + eeconfig_init(); + } + return false; + break; + case VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; + case RGB_SLD: + if (record->event.pressed) { + #ifdef RGBLIGHT_ENABLE + rgblight_mode(1); + #endif + } + 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) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboards/ktec/ergodone/keymaps/eozaki/readme.md b/keyboards/ktec/ergodone/keymaps/eozaki/readme.md new file mode 100644 index 0000000000..bfde2b2c8e --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/eozaki/readme.md @@ -0,0 +1,13 @@ +# ErgoDox EZ Based Configuration + +## Changelog + +* Aug 2018: + * New custom L0 layout. +* Dec 2016: + * Added LED keys + * Refreshed layout graphic, comes from http://configure.ergodox-ez.com now. +* Sep 22, 2016: + * Created a new key in layer 1 (bottom-corner key) that resets the EEPROM. +* Feb 2, 2016 (V1.1): + * Made the right-hand quote key double as Cmd/Win on hold. So you get ' when you tap it, " when you tap it with Shift, and Cmd or Win when you hold it. You can then use it as a modifier, or just press and hold it for a moment (and then let go) to send a single Cmd or Win keystroke (handy for opening the Start menu on Windows). diff --git a/keyboards/ktec/ergodone/keymaps/erovia/config.h b/keyboards/ktec/ergodone/keymaps/erovia/config.h new file mode 100644 index 0000000000..60c6ad4a12 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/erovia/config.h @@ -0,0 +1,3 @@ +#pragma once + +#define DISABLE_SPACE_CADET_ROLLOVER diff --git a/keyboards/ktec/ergodone/keymaps/erovia/keymap.c b/keyboards/ktec/ergodone/keymaps/erovia/keymap.c new file mode 100644 index 0000000000..279c8a57c1 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/erovia/keymap.c @@ -0,0 +1,229 @@ +#include QMK_KEYBOARD_H +#include "version.h" +#include "bootmagic.h" + +#define QWERTY 0 // qwerty layer +#define COLEMAK 1 // colemak layer +#define FN 2 // function layer + +enum custom_keycodes { + QWRTY = SAFE_RANGE, // can always be here + CLMK, + VRSN, + FNCTN +}; + +/* false: Caps Lock LED is off + true: Caps Lock LED is on */ +bool CAPS_LED = false; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Qwerty layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | Copy | | Paste| 6 | 7 | 8 | 9 | 0 | Sleep | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | E | R | T | Mute | | { | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | [ |------+------+------+------+------+--------| + * | Esc | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | + * |--------+------+------+------+------+------| Fn1 | | } |------+------+------+------+------+--------| + * | LShift | Z | X | C | V | B | | | ] | N | M | , | . | / | RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |LCtrl | LGui | LAlt | Left | Right| | Down | Up | - | = | RCtrl | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | Caps | LGui | | Ins | Del | + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[QWERTY] = LAYOUT_ergodox( // layer 0 : qwerty + // left hand + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_COPY, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MUTE, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, TT(FN), + KC_LCTL, KC_LGUI, KC_LALT, KC_LEFT, KC_RGHT, + KC_CAPS, KC_LGUI, + KC_HOME, + KC_SPC, KC_BSPC, KC_END, + // right hand + KC_PASTE, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SLEP, + KC_LBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOTE, + KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, + KC_DOWN, KC_UP, KC_MINS, KC_EQL, KC_RCTL, + KC_INS, KC_DEL, + KC_PGUP, + KC_PGDN, KC_TAB, KC_ENT +), +/* Keymap 1: Colemak layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | Copy | | Paste| 6 | 7 | 8 | 9 | 0 | Sleep | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | F | P | B | Mute | | { | J | L | U | Y | ; | \ | + * |--------+------+------+------+------+------| | | [ |------+------+------+------+------+--------| + * | Esc | A | R | S | T | G |------| |------| M | N | E | I | O | ' | + * |--------+------+------+------+------+------| Fn1 | | } |------+------+------+------+------+--------| + * | LShift | Z | X | C | D | V | | | ] | K | H | , | . | / | RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |LCtrl | LGui | LAlt | Left | Right| | Down | Up | - | = | RCtrl | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | Caps | LGui | | Ins | Del | + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `----------------------' + */ +[COLEMAK] = LAYOUT_ergodox( // layer 1 : colemak + // left hand + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_COPY, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_MUTE, + KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_G, + KC_LSPO, KC_Z, KC_X, KC_C, KC_D, KC_V, TT(FN), + KC_LCTL, KC_LGUI, KC_LALT, KC_LEFT, KC_RGHT, + KC_CAPS, KC_LGUI, + KC_HOME, + KC_SPC, KC_BSPC, KC_END, + // right hand + KC_PASTE, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SLEP, + KC_LBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOTE, + KC_RBRC, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, + KC_DOWN, KC_UP, KC_MINS, KC_EQL, KC_RCTL, + KC_INS, KC_DEL, + KC_PGUP, + KC_PGDN, KC_TAB, KC_ENT +), +/* Keymap 2: Function Layer + * + * ,---------------------------------------------------. ,--------------------------------------------------. + * |Version | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | | + * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | | | | Prev | Play | Next | | | | | | | | | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | |VolDn | VolUp|------| |------| |QWRTY | CLMK | | | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | | | | | + * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `-----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// Functions +[FN] = LAYOUT_ergodox( + // left hand + VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, + 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, + // right hand + KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, QWRTY, CLMK, 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 +), +}; + +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; + case QWRTY: + if (record->event.pressed) { + set_single_persistent_default_layer(QWERTY); + } + return false; + break; + case CLMK: + if (record->event.pressed) { + set_single_persistent_default_layer(COLEMAK); + } + return false; + break; + case KC_CAPS: + if (record->event.pressed) { + // Turn LED1 On/Off for Caps Lock + if (CAPS_LED) { + ergodox_right_led_1_off(); + CAPS_LED = false; + } else { + ergodox_right_led_1_on(); + CAPS_LED = true; + } + } + return true; + break; + } + return true; +}; + +// Set LED according to the default layer +void default_layer_led_set(void) { + switch (biton32(eeconfig_read_default_layer())) { + case COLEMAK: + // LED2 for COLEMAK + ergodox_right_led_2_on(); + break; + case QWERTY: + // LED3 for QWERTY + ergodox_right_led_3_on(); + break; + }; +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + default_layer_led_set(); +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + ergodox_led_all_off(); + switch (biton32(state)) { + case FN: + // Red led on Pro Micro for Fn layer + ergodox_board_led_on(); + break; + }; + + if (CAPS_LED) { + ergodox_right_led_1_on(); + } + + default_layer_led_set(); + + return state; +}; + +void suspend_power_down_user(void) { + ergodox_led_all_off(); +}; + +void suspend_wakeup_init_user(void) { + default_layer_led_set(); +}; diff --git a/keyboards/ktec/ergodone/keymaps/erovia/readme.md b/keyboards/ktec/ergodone/keymaps/erovia/readme.md new file mode 100644 index 0000000000..160c875983 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/erovia/readme.md @@ -0,0 +1,76 @@ +# Erovia's ErdoDone Keymap + +My personal ErgoDone keymap based on the *default* keymap. + +**Features** + +* Qwerty and Colemak Mod-DH support +* Space Cadet Shift +* LED indicator for: active layout, CapsLock, Function layer + +## QWERTY (Normal) Layer +``` +,--------------------------------------------------. ,--------------------------------------------------. +| ` | 1 | 2 | 3 | 4 | 5 | Copy | | Paste| 6 | 7 | 8 | 9 | 0 | Sleep | +|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| +| Tab | Q | W | E | R | T | Mute | | { | Y | U | I | O | P | \ | +|--------+------+------+------+------+------| | | [ |------+------+------+------+------+--------| +| Esc | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | +|--------+------+------+------+------+------| Fn1 | | } |------+------+------+------+------+--------| +| LShift | Z | X | C | V | B | | | ] | N | M | , | . | / | RShift | +`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + |LCtrl | LGui | LAlt | Left | Right| | Down | Up | - | = | RCtrl | + `----------------------------------' `----------------------------------' + ,-------------. ,-------------. + | Caps | LGui | | Ins | Del | + ,------|------|------| |------+--------+------. + | | | Home | | PgUp | | | + | Space|Backsp|------| |------| Tab |Enter | + | |ace | End | | PgDn | | | + `--------------------' `----------------------' +``` + +## Colemak Layer +Switch from `Fn1` layer. +``` +,--------------------------------------------------. ,--------------------------------------------------. +| ` | 1 | 2 | 3 | 4 | 5 | Copy | | Paste| 6 | 7 | 8 | 9 | 0 | Sleep | +|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| +| Tab | Q | W | F | P | B | Mute | | { | J | L | U | Y | ; | \ | +|--------+------+------+------+------+------| | | [ |------+------+------+------+------+--------| +| Esc | A | R | S | T | G |------| |------| M | N | E | I | O | ' | +|--------+------+------+------+------+------| Fn1 | | } |------+------+------+------+------+--------| +| LShift | Z | X | C | D | V | | | ] | K | H | , | . | / | RShift | +`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + |LCtrl | LGui | LAlt | Left | Right| | Down | Up | - | = | RCtrl | + `----------------------------------' `----------------------------------' + ,-------------. ,-------------. + | Caps | LGui | | Ins | Del | + ,------|------|------| |------+--------+------. + | | | Home | | PgUp | | | + | Space|Backsp|------| |------| Tab |Enter | + | |ace | End | | PgDn | | | + `--------------------' `----------------------' +``` + +## Function Layer +``` +,---------------------------------------------------. ,--------------------------------------------------. +|Version | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | | +|---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| +| | | | Prev | Play | Next | | | | | | | | | | +|---------+------+------+------+------+------| | | |------+------+------+------+------+--------| +| | | | |VolDn | VolUp|------| |------| |QWRTY | CLMK | | | | +|---------+------+------+------+------+------| | | |------+------+------+------+------+--------| +| | | | | | | | | | | | | | | | +`---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + | | | | | | | | | | | | + `-----------------------------------' `----------------------------------' + ,-------------. ,-------------. + | | | | | | + ,------|------|------| |------+------+------. + | | | | | | | | + | | |------| |------| | | + | | | | | | | | + `--------------------' `--------------------' +``` diff --git a/keyboards/ktec/ergodone/keymaps/erovia/rules.mk b/keyboards/ktec/ergodone/keymaps/erovia/rules.mk new file mode 100644 index 0000000000..f7b7da719e --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/erovia/rules.mk @@ -0,0 +1 @@ +COMMAND_ENABLE = no # Commands for debug and configuration diff --git a/keyboards/ktec/ergodone/keymaps/kloki/keymap.c b/keyboards/ktec/ergodone/keymaps/kloki/keymap.c new file mode 100644 index 0000000000..87e96d20fd --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/kloki/keymap.c @@ -0,0 +1,219 @@ +#include QMK_KEYBOARD_H +#include "debug.h" +#include "action_layer.h" +#include "version.h" + +#define BASE 0 // default layer +#define QW 1 // qwerty +#define SYMB 2 // symbols +#define NUM 3 // media keys + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, // can always be here + EPRM, + VRSN, + RGB_SLD +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | SHIFT| | SYM | 6 | 7 | 8 | 9 | 0 | Bck | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | D | R | W | B | `~ | | "' | J | F | U | P | : | \ | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Ctr/Es | A | S | H | T | G |------| |------| Y | N | E | O | I | Enter | + * |--------+------+------+------+------+------| = + | | -_ |------+------+------+------+------+--------| + * | LShift | Z | X | M | C | V | | | | K | L | , | . | / | RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |MEH | Gui |AltShf| Left | Right| | DOWN | UP | [ | ] | ~SYM | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | ESC |Home | | PgUp | QW | + * ,------|------|------| |------+--------+------. + * | | ENT | End | | PgDn | | | + * | Space| WIN |------| |------| Tab |Back | + * | SYM | | SCTR | | SALT | SYM | | + * `--------------------' `----------------------' + */ + +[BASE] = LAYOUT_ergodox( // layer 0 : default + // left hand + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LSFT, + KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_GRV, + CTL_T(KC_ESC), KC_A, KC_S, KC_H, KC_T, KC_G, + KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_EQL, + KC_MEH, KC_LGUI, KC_LALT, KC_LEFT,KC_RGHT, + KC_ESC, KC_HOME, + KC_END, + LT(SYMB, KC_SPC), LGUI_T(KC_ENT), S(KC_LGUI), + // right hand + TG(NUM), KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_QUOT, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSLS, + KC_Y, KC_N, KC_E, KC_O, KC_I , KC_ENT, + KC_MINS, KC_K, KC_L, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, + KC_DOWN,KC_UP, KC_LBRC,KC_RBRC, MO(SYMB), + KC_PGUP, TG(QW), + KC_PGDN, + S(KC_LALT),LT(SYMB, KC_TAB), KC_BSPC + ), + +[QW] = LAYOUT_ergodox( + _______, _______, _______, _______, _______, _______, _______, + _______, KC_Q, KC_W, KC_E, KC_R, KC_T, _______, + _______, KC_A, KC_S, KC_D, KC_F, KC_G, + _______, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______, + // right hand + _______, _______, _______, _______, _______, _______, _______, + _______, KC_Y, KC_U, KC_I , KC_O, KC_P, _______, + KC_H, KC_J, KC_K , KC_L, KC_SCLN, _______, + _______, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______ +), +/* Keymap 1: Symbol Layer + * + * ,---------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | DEL | + * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | * | | | | < | H | U | PU | * | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| > | L | D | R | + | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | E | D | PD | \ | | + * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `-----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = LAYOUT_ergodox( + // left hand + _______,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, + _______,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_ASTR,_______, + _______,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + _______,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,_______, + // right hand + _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL, + _______, KC_LABK, KC_HOME, KC_UP, KC_PGUP, KC_ASTR, _______, + KC_RABK, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PLUS, _______, + _______, KC_AMPR, KC_END, KC_DOWN, KC_PGDN, KC_BSLS, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______ +), +/* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | L | MsUp | R | | | | | | 4 | 5 | 6 | | TAB | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | |MsLeft|MsDown|MsRght| |------| |------| | 1 | 2 | 3 | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | 0 | 0 | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[NUM] = LAYOUT_ergodox( + _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_BTN1, KC_MS_U, KC_BTN2, _______, _______, + _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______, + // right hand + _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_4, KC_5 , KC_6, _______, KC_TAB, + _______, KC_1, KC_2 , KC_3, _______, _______, + _______, _______, _______, KC_0, KC_0, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______ +), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // dynamically generate these. + case EPRM: + if (record->event.pressed) { + eeconfig_init(); + } + return false; + break; + case VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; + case RGB_SLD: + if (record->event.pressed) { + #ifdef RGBLIGHT_ENABLE + rgblight_mode(1); + #endif + } + 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) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + case 1: + ergodox_board_led_on(); + break; + case 3: + ergodox_board_led_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboards/ktec/ergodone/keymaps/kloki/readme.md b/keyboards/ktec/ergodone/keymaps/kloki/readme.md new file mode 100644 index 0000000000..a9ebaba67e --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/kloki/readme.md @@ -0,0 +1,7 @@ +# Kloki's ergodone layout + +-workman +-qwerty layer +-num layer +-overloaded modifier +-a lot of duplicated keys to make common shortcuts work
\ No newline at end of file diff --git a/keyboards/ktec/ergodone/keymaps/vega/keymap.c b/keyboards/ktec/ergodone/keymaps/vega/keymap.c new file mode 100644 index 0000000000..ee6c56bf95 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/vega/keymap.c @@ -0,0 +1,555 @@ +#include QMK_KEYBOARD_H + +enum layer_names { + BASE, + GREL, + GREU, + SYMB, + MATH, + QWER, + FNLR +}; + +enum unicode_names { + //MATH + neq, //≠ + intgrl, //∫ + angl, //∠ + imply, //⇒ + equiv, //⇔ + porp, //∝ + exists, //∃ + nexists, //∄ + forall, //∀ + and, //∧ + or, //∨ + xor, //⊕ + apeql, //≅ + root, //√ + not, //¬ + sum, //∑ + plsminus, //± + infin, //∞ + emtyset, //∅ + Mn, //ℕ + Mz, //ℤ + Mq, //ℚ + Mr, //ℝ + Mc, //ℂ + eleof, //∈ + member, //∋ + neleof, //∉ + nmember, //∌ + subsetof, //⊂ + suprsetof, //⊃ + intersection, //∩ + Munion, //∪ + + //SYMB + arwl, + arwu, + arwr, + arwd, + + uxclm, + cent, + degree, + trade, + copy, + numero, + sect, + mdot, + rang, + + + lshade, + mshade, + dshade, + + fire, + water, + cleft, + baster, + neteen, + floppy, + + boxemp, + boxchk, + boxX, + + bbstr, + bbstl, + bbml, + bbmr, + bbmb, + bbrtr, + bbrbr, + bbrtl, + bbrbl, + bbsbr, + bbsbl, + bbmbr, + bbmbl, + + Agrave, + Aacute, + Acircm, + Atilde, + Abreve, + Adiaer, + Adacut, + + // not all ogham letters, as I + // actually intend to use them for hex + OS, + Oa, + Ob, + Oc, + Od, + Oe, + Of, + Og, + Oh, + Oi, + OA, + OB, + OC, + OD, + OE, + OF, + Os, + OED, + Ox, + gnd, + sqr, + sine, + opt, + + geq, + leq, + brkup, + brkdn, + perup, + perdn, + + //GREEL + rone, // 1:: ⅰ + rtwo, + rthree, + rfour, // 4:: ⅳ + rfive, // 5:: ⅴ + rsix, // 6:: ⅵ + rseven, // 7:: ⅶ + reight, // 8:: ⅷ + rnine, // 9:: ⅸ + rten, // 0:: ⅹ + gq, // q:: θ + gw, // w:: ω + ge, // e:: ε + gr, // r:: ρ + gt, // t:: τ + gy, // y:: ψ + gu, // u:: υ + gi, // i:: ι + go, // o:: ο + gp, // p:: π + ga, // a:: α + gs, // s:: σ + gd, // d:: δ + gf, // f:: φ + gg, // g:: γ + gh, // h:: η + gj, // j:: ϑ + gk, // k:: κ + gl, // l:: λ + gz, // z:: ζ + gx, // x:: ξ + gc, // c:: χ + gv, // v:: ς + gb, // b:: β + gn, // n:: ν + gm, // m:: μ + + //GREEU + Rone, // 1:: Ⅰ + Rtwo, // 2:: Ⅱ + Rthree, // 3:: Ⅲ + Rfour, // 4:: Ⅳ + Rfive, // 5:: Ⅴ + Rsix, // 6:: Ⅵ + Rseven, // 7:: Ⅶ + Reight, // 8:: Ⅷ + Rnine, // 9:: Ⅸ + Rten, + Gq, // Q:: Θ + Gw, // W:: Ω + Ge, // E:: Ε + Gr, // R:: Ρ + Gt, // T:: Τ + Gy, // Y:: Ψ + Gu, // U:: Υ + Gi, // I:: Ι + Go, // O:: Ο + Gp, // P:: Π + Ga, // A:: Α + Gs, // S:: Σ + Gd, // D:: Δ + Gf, // F:: Φ + Gg, // G:: Γ + Gh, // H:: Η + Gj, // J:: J + Gk, // K:: Κ + Gl, // L:: Λ + Gz, // Z:: Ζ + Gx, // X:: Ξ + Gc, // C:: Χ + Gv, // V:: V + Gb, // B:: Β + Gn, // N:: Ν + Gm, // M:: Μ +}; + +const uint32_t PROGMEM unicode_map[] = { + //MATH + [neq] = 0x2260, //≠ + [intgrl] = 0x222B, //∫ + [angl] = 0x2220, //∠ + [imply] = 0x21D2, //⇒ + [equiv] = 0x21D4, //⇔ + [porp] = 0x221D, //∝ + [exists] = 0x2203, //∃ + [nexists] = 0x2204, //∄ + [forall] = 0x2200, //∀ + [and] = 0x2227, //∧ + [or] = 0x2228, //∨ + [xor] = 0x2295, //⊕ + [apeql] = 0x2245, //≅ + [root] = 0x221A, //√ + [not] = 0x00AC, //¬ + [sum] = 0x2211, //∑ + [plsminus] = 0x00B1, //± + [infin] = 0x221E, //∞ + [emtyset] = 0x2205, //∅ + [Mn] = 0x2115, //ℕ + [Mz] = 0x2124, //ℤ + [Mq] = 0x211A, //ℚ + [Mr] = 0x211D, //ℝ + [Mc] = 0x2102, //ℂ + [eleof] = 0x2208, //∈ + [member] = 0x220B, //∋ + [neleof] = 0x2209, //∉ + [nmember] = 0x220C, //∌ + [subsetof] = 0x2282, //⊂ + [suprsetof] = 0x2283, // + [intersection] = 0x2229, //∩ + [Munion] = 0x222A, //∪ + //Symbol + [arwl] = 0x2190, //← + [arwu] = 0x2191, //↑ + [arwr] = 0x2192, //→ + [arwd] = 0x2193, //↓ + + [uxclm] = 0x00A1, //¡ + [cent] = 0x00A2, //¢ + [degree] = 0x00B0, //° + [trade] = 0x2122, //™ + [copy] = 0x00A9, //© + [numero] = 0x2116, //№ + [sect] = 0x00A7, //§ + [mdot] = 0x00B7, //· + [rang] = 0x299C, //⦜ + + + [lshade] = 0x2591,//░ + [mshade] = 0x2592,//▒ + [dshade] = 0x2593,//▓ + + [fire] = 0x1F525, //🔥 + [water] = 0x1F322, //🌢 + [cleft] = 0x1F12F, //🄯 + [baster] = 0x1F7BC, //🞼 + [neteen] = 0x1F51E, //🔞 + [floppy] = 0x1F5AB, //🖫 + + [boxemp] = 0x2610, //☐ + [boxchk] = 0x2611, //☑ + [boxX] = 0x2612, //☒ + + [bbstr] = 0x23A1, //⎡ + [bbstl] = 0x23A4, //⎤ + [bbml] = 0x23A8, //⎨ + [bbmr] = 0x23AC, //⎬ + [bbmb] = 0x23AA, //⎪ + [bbrtr] = 0x23A7, //⎧ + [bbrbr] = 0x23A9, //⎩ + [bbrtl] = 0x23AB, //⎫ + [bbrbl] = 0x23AD, //⎭ + [bbsbr] = 0x23A3, //⎣ + [bbsbl] = 0x23A6, //⎦ + [bbmbr] = 0x23A5, //⎥ + [bbmbl] = 0x23A2, //⎢ + + [Agrave] = 0x0300,//è //above [wtf] = 0x1242A, //𒐪 + [Aacute] = 0x0301,//é //1st + [Acircm] = 0x0302,//ê //2nd + [Atilde] = 0x0303,//ẽ //5th + [Abreve] = 0x0306,//ĕ //4th + [Adiaer] = 0x0308,//ë //3rd + [Adacut] = 0x030B,//e̋ + + // not all ogham letters, as I + // actually intend to use them for hex + [OS] = 0x1680,//space + [Oa] = 0x1681,//1 + [Ob] = 0x1682,//2 + [Oc] = 0x1683,//3 + [Od] = 0x1684,//4 + [Oe] = 0x1685,//5 + [Of] = 0x1686,//6 + [Og] = 0x1687,//7 + [Oh] = 0x1688,//8 + [Oi] = 0x1689,//9 + [OA] = 0x168A,//A + [OB] = 0x168B,//B + [OC] = 0x168C,//C + [OD] = 0x168D,//D + [OE] = 0x168E,//E + [OF] = 0x168F,//F + [Os] = 0x169B,//Start + [OED] = 0x169C,//End + [Ox] = 0x1695,//X + + [gnd] = 0x23DA,//⏚ + [sqr] = 0x238D,//⎍, actually monostable + [sine] = 0x223F,//∿ + [opt] = 0x2325,//⌥, actually option used for switch + + [geq] = 0x2264, //≤ + [leq] = 0x2265, //≥ + [brkup] = 0xFE38, //︸ + [brkdn] = 0xFE37, //︷ + [perup] = 0xFE35, //︵ + [perdn] = 0xFE36, //︶ + //GREEKL + [rone] = 0x2170, // 1:: ⅰ + [rtwo] = 0x2171, // 2:: ⅱ + [rthree] = 0x2172, // 3:: ⅲ + [rfour] = 0x2173, // 4:: ⅳ + [rfive] = 0x2174, // 5:: ⅴ + [rsix] = 0x2175, // 6:: ⅵ + [rseven] = 0x2176, // 7:: ⅶ + [reight] = 0x2177, // 8:: ⅷ + [rnine] = 0x2178, // 9:: ⅸ + [rten] = 0x2179, // 0:: ⅹ + [gq] = 0x03B8, // q:: θ + [gw] = 0x03C9, // w:: ω + [ge] = 0x03B5, // e:: ε + [gr] = 0x03C1, // r:: ρ + [gt] = 0x03C4, // t:: τ + [gy] = 0x03C8, // y:: ψ + [gu] = 0x03C5, // u:: υ + [gi] = 0x03B9, // i:: ι + [go] = 0x03BF, // o:: ο + [gp] = 0x03C0, // p:: π + [ga] = 0x03B1, // a:: α + [gs] = 0x03C3, // s:: σ + [gd] = 0x03B4, // d:: δ + [gf] = 0x03C6, // f:: φ + [gg] = 0x03B3, // g:: γ + [gh] = 0x03B7, // h:: η + [gj] = 0x03D1, // j:: ϑ + [gk] = 0x03BA, // k:: κ + [gl] = 0x03BB, // l:: λ + [gz] = 0x03B6, // z:: ζ + [gx] = 0x03BE, // x:: ξ + [gc] = 0x03C7, // c:: χ + [gv] = 0x03C2, // v:: ς + [gb] = 0x03B2, // b:: β + [gn] = 0x03BD, // n:: ν + [gm] = 0x03BC, // m:: μ + //GREEKU + [Rone] = 0x2160, // 1:: Ⅰ + [Rtwo] = 0x2161, // 2:: Ⅱ + [Rthree] = 0x2162, // 3:: Ⅲ + [Rfour] = 0x2163, // 4:: Ⅳ + [Rfive] = 0x2164, // 5:: Ⅴ + [Rsix] = 0x2165, // 6:: Ⅵ + [Rseven] = 0x2166, // 7:: Ⅶ + [Reight] = 0x2167, // 8:: Ⅷ + [Rnine] = 0x2168, // 9:: Ⅸ + [Rten] = 0x2169, // 0:: Ⅹ + [Gq] = 0x0398, // Q:: Θ + [Gw] = 0x03A9, // W:: Ω + [Ge] = 0x0395, // E:: Ε + [Gr] = 0x03A1, // R:: Ρ + [Gt] = 0x03A4, // T:: Τ + [Gy] = 0x03A8, // Y:: Ψ + [Gu] = 0x03A5, // U:: Υ + [Gi] = 0x0399, // I:: Ι + [Go] = 0x039F, // O:: Ο + [Gp] = 0x03A0, // P:: Π + [Ga] = 0x0391, // A:: Α + [Gs] = 0x03A3, // S:: Σ + [Gd] = 0x0394, // D:: Δ + [Gf] = 0x03A6, // F:: Φ + [Gg] = 0x0393, // G:: Γ + [Gh] = 0x0397, // H:: Η + [Gj] = 0x004A, // J:: J + [Gk] = 0x039A, // K:: Κ + [Gl] = 0x039B, // L:: Λ + [Gz] = 0x0396, // Z:: Ζ + [Gx] = 0x039E, // X:: Ξ + [Gc] = 0x03A7, // C:: Χ + [Gv] = 0x0056, // V:: V + [Gb] = 0x0392, // B:: Β + [Gn] = 0x039D, // N:: Ν + [Gm] = 0x039C, // M:: Μ +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[BASE] = LAYOUT_ergodox( // layer 0 : default + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_BSLS, + KC_EQL, KC_A, KC_O, KC_E, KC_U, KC_I, + KC_LSPO, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_AMPR, + OSL(FNLR), TT(GREL), TT(MATH), KC_UP, KC_DOWN, + KC_LBRC, KC_HOME, KC_INS, KC_SPC, KC_LGUI, KC_DEL, + + OSL(FNLR), KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_PGUP, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, + KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, + KC_PGDN, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC, + KC_LEFT, KC_RIGHT, KC_RALT, TT(SYMB), TT(QWER), + KC_END, KC_RBRC, KC_PSCR, KC_RALT, KC_RCTL, KC_ENT +), + +[FNLR] = LAYOUT_ergodox( + // left hand + UC_M_LN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO, + UC_M_WC,KC_F11, KC_F12, KC_F13,KC_F14, KC_F15, KC_NO, + KC_NO,KC_F21, KC_F22, KC_F23,KC_F24, KC_NO, + KC_NO,KC_PAUSE,KC_PSCR,KC_SLCK,KC_NO,KC_NO,KC_NO, + EEP_RST,TO(BASE),TO(BASE),TO(BASE),TO(BASE), + KC_NO,KC_NO, + KC_NO, + KC_NO,KC_NO,KC_NO, + // right hand + TO(BASE), KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, UC_M_LN, + KC_NO, KC_F16, KC_F17,KC_F18, KC_F19, KC_F20, UC_M_WI, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO,KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, + KC_NO, + KC_NO, KC_RCTL, KC_NO +), + +[QWER] = LAYOUT_ergodox( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSLS, + KC_AMPR, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_QUOT, + KC_BSLS, KC_LCTL, KC_LGUI, KC_RALT, KC_APP, + KC_LBRC, KC_HOME, KC_PGUP, KC_SPC, KC_LSFT, KC_PGDN, + + OSL(FNLR), KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_MINS, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_SLSH, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + KC_EQL, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, + KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, TO(BASE), + KC_END, KC_INS, KC_DEL, KC_RGHT, KC_ENT, KC_SPC +), + +[MATH] = LAYOUT_ergodox( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, + KC_TAB, X(Mc), X(Munion), X(arwl), X(or), X(exists), KC_BSLASH, + X(arwr), X(root), X(and), X(imply), X(nexists), X(forall), + KC_LSPO, KC_SCLN, X(intgrl), X(Mn), X(Mz), X(member), X(arwl), + KC_MS_L, TO(BASE), TO(BASE), KC_INS, KC_DEL, + KC_LBRC, KC_HOME, KC_UP, KC_SPC, KC_LGUI, KC_DOWN, + + TT(FNLR), KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_PGUP, X(plsminus), X(infin), X(neleof), X(equiv), X(Mq), KC_EQL, + X(sum), X(emtyset), X(porp), X(suprsetof), X(not), X(neq), + KC_PGDN, X(subsetof), X(intersection), X(angl), X(nmember), X(eleof), KC_RSPC, + KC_RCTL, KC_RALT, KC_APP, TO(BASE), TO(BASE), + KC_END, KC_RBRC, KC_LEFT, KC_RGHT, KC_ENT, KC_SPC +), + +[SYMB] = LAYOUT_ergodox( + X(Os), X(Oa), X(Ob), X(Oc), X(Od), X(Oe), X(mdot), + X(boxemp), X(bbstr), X(bbrtr), X(bbrtl), X(bbstl), X(degree), X(brkdn), + X(boxchk), X(bbmbl), X(bbml), X(bbmr), X(bbmbr), X(neteen), + X(boxX), X(bbsbr), X(bbrbr), X(bbrbl), X(bbsbl), X(uxclm), X(brkup), + X(floppy), TO(BASE), TO(BASE), X(arwu), X(arwd), + X(fire), X(lshade), X(mshade), KC_SPC, X(OS), X(dshade), + + X(Ox), X(Of), X(Og), X(Oh), X(Oi), X(OA), X(OB), + X(numero), X(trade), X(copy), X(cleft), X(cent), X(OED), X(OC), + X(Agrave), X(gnd), X(sqr), X(sine), X(opt), X(OD), + X(sect), X(Aacute), X(Acircm), X(Adiaer), X(Abreve), X(Atilde), X(OE), + X(arwl), X(arwr), X(geq), X(leq), X(OF), + X(rang), X(water), X(perup), X(perdn), X(baster), KC_ENT +), + +[GREL] = LAYOUT_ergodox( + KC_ESC, X(Rone), X(Rtwo), X(Rthree), X(Rfour), X(Rfive), KC_GRV, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, X(gp), X(gy), KC_SLSH, + KC_SLSH, X(ga), X(go), X(ge), X(gu), X(gi), + MO(GREU), KC_SCLN, X(gq), X(gj), X(gk), X(gx), KC_AMPR, + KC_MS_L, TO(BASE), TO(BASE), KC_INS, KC_DEL, + KC_LBRC, KC_HOME, KC_UP, KC_SPC, KC_LGUI, KC_DOWN, + + TO(BASE), X(Rsix), X(Rseven), X(Reight), X(Rnine), X(Rten), KC_BSPC, + KC_PGUP, X(gf), X(gg), X(gc), X(gr), X(gl), KC_EQL, + X(gd), X(gh), X(gt), X(gn), X(gs), KC_MINS, + KC_PGDN, X(gb), X(gm), X(gw), X(gv), X(gz), MO(GREU), + KC_RCTL, KC_RALT, KC_APP, TO(BASE), TO(BASE), + KC_END, KC_RBRC, KC_LEFT, KC_RGHT, KC_ENT, KC_SPC +), + +[GREU] = LAYOUT_ergodox( + KC_ESC, X(Rone), X(Rtwo), X(Rthree), X(Rfour), X(Rfive), KC_GRV, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, X(Gp), X(Gy), KC_SLSH, + KC_SLSH, X(Ga), X(Go), X(Ge), X(Gu), X(Gi), + KC_TRNS, KC_SCLN, X(Gq), X(Gj), X(Gk), X(Gx), KC_AMPR, + KC_MS_L, TO(BASE), TO(BASE), KC_INS, KC_DEL, + KC_LBRC, KC_HOME, KC_UP, KC_SPC, KC_LGUI, KC_DOWN, + + TO(BASE), X(Rsix), X(Rseven), X(Reight), X(Rnine), X(Rten), KC_BSPC, + KC_PGUP, X(Gf), X(Gg), X(Gc), X(Gr), X(Gl), KC_EQL, + X(Gd), X(Gh), X(Gt), X(Gn), X(Gs), KC_MINS, + KC_PGDN, X(Gb), X(Gm), X(Gw), X(Gv), X(Gz), KC_TRNS, + KC_RCTL, KC_RALT, KC_APP, TO(BASE), TO(BASE), + KC_END, KC_RBRC, KC_LEFT, KC_RGHT, KC_ENT, KC_SPC +), + +}; + +// 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) { + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } +}; diff --git a/keyboards/ktec/ergodone/keymaps/vega/rules.mk b/keyboards/ktec/ergodone/keymaps/vega/rules.mk new file mode 100644 index 0000000000..d4b8547225 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/vega/rules.mk @@ -0,0 +1,2 @@ +UNICODE_ENABLE = no # Unicode +UNICODEMAP_ENABLE = yes diff --git a/keyboards/ktec/ergodone/keymaps/via/config.h b/keyboards/ktec/ergodone/keymaps/via/config.h new file mode 100644 index 0000000000..fc7744c763 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/via/config.h @@ -0,0 +1,18 @@ + /* Copyright HarshitGoel96 2021 + * + * 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/>. + */ + //Keymap specific config.h +#pragma once +#define DYNAMIC_KEYMAP_LAYER_COUNT 4
\ No newline at end of file diff --git a/keyboards/ktec/ergodone/keymaps/via/keymap.c b/keyboards/ktec/ergodone/keymaps/via/keymap.c new file mode 100644 index 0000000000..f155a4b51d --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/via/keymap.c @@ -0,0 +1,196 @@ + /* Copyright HarshitGoel96 2021 + * + * 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 QMK_KEYBOARD_H + +enum layer_names { + QRTY, // qwerty above workman to make sure transparent does not catch unwanted keycode + SYMB, // symbols + MDIA, // media keys + EXTRA, // added extra layer for via +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd | + * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | LGui | | Alt |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* + +[QRTY] = LAYOUT_ergodox( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), + 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, ALL_T(KC_NO), + 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_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(SYMB), 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), + MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, TT(SYMB), + KC_LALT, CTL_T(KC_ESC), + KC_PGUP, + KC_PGDN,KC_TAB, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,---------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | EEP_RST | | | | | | | . | 0 | = | | + * `-----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * |Animat| | |Toggle|Solid | + * ,------|------|------| |------+------+------. + * |Bright|Bright| | | |Hue- |Hue+ | + * |ness- |ness+ |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = LAYOUT_ergodox( + // left hand + KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + EEP_RST ,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + RGB_MOD,KC_TRNS, + KC_TRNS, + RGB_VAD,RGB_VAI,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, 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_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + RGB_TOG, RGB_M_P , + KC_TRNS, + KC_TRNS, RGB_HUD, RGB_HUI +), +/* 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_ergodox( + KC_TRNS, 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_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_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_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, 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 +), +[EXTRA] = LAYOUT_ergodox( + KC_TRNS, 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_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_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_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, 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 +) +}; + +// Runs constantly in the background, in a loop. + +layer_state_t layer_state_set_user(layer_state_t state) { + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (get_highest_layer(state)) { + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + case 3: + ergodox_right_led_3_on(); + break; + default: + // none + break; + } + return state; +} diff --git a/keyboards/ktec/ergodone/keymaps/via/readme.md b/keyboards/ktec/ergodone/keymaps/via/readme.md new file mode 100644 index 0000000000..223cb892ba --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/via/readme.md @@ -0,0 +1,5 @@ + +## Changelog +HarshitGoel96 + +I love my ergodone, but it needed via, so here it is. Flash using HIDBOOTLOADER as described in keyboard root read.md and enjoy via on ergodone.
\ No newline at end of file diff --git a/keyboards/ktec/ergodone/keymaps/via/rules.mk b/keyboards/ktec/ergodone/keymaps/via/rules.mk new file mode 100644 index 0000000000..43061db1dd --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes
\ No newline at end of file diff --git a/keyboards/ktec/ergodone/matrix.c b/keyboards/ktec/ergodone/matrix.c new file mode 100644 index 0000000000..3973ff3484 --- /dev/null +++ b/keyboards/ktec/ergodone/matrix.c @@ -0,0 +1,256 @@ +#include <stdint.h> +#include <stdbool.h> +#include <avr/io.h> +#include "wait.h" +#include "action_layer.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "ergodone.h" +#include "expander.h" + +/* + * This constant define not debouncing time in msecs, but amount of matrix + * scan loops which should be made to get stable debounced results. + * + * On Ergodox matrix scan rate is relatively low, because of slow I2C. + * Now it's only 317 scans/second, or about 3.15 msec/scan. + * According to Cherry specs, debouncing time is 5 msec. + * + * And so, there is no sense to have DEBOUNCE higher than 2. + */ + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; + +// Debouncing: store for each key the number of scans until it's eligible to +// change. When scanning the matrix, ignore any changes in keys that have +// already changed in the last DEBOUNCE scans. +static uint8_t debounce_matrix[MATRIX_ROWS * MATRIX_COLS]; + +static matrix_row_t read_cols(uint8_t row); +static void init_cols(void); +static void unselect_rows(void); +static void select_row(uint8_t row); + +__attribute__ ((weak)) +void matrix_init_user(void) {} + +__attribute__ ((weak)) +void matrix_scan_user(void) {} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + unselect_rows(); + init_cols(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + for (uint8_t j=0; j < MATRIX_COLS; ++j) { + debounce_matrix[i * MATRIX_COLS + j] = 0; + } + } + + matrix_init_quantum(); +} + +void matrix_power_up(void) { + unselect_rows(); + init_cols(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + } +} + +// Returns a matrix_row_t whose bits are set if the corresponding key should be +// eligible to change in this scan. +matrix_row_t debounce_mask(uint8_t row) { + matrix_row_t result = 0; + for (uint8_t j=0; j < MATRIX_COLS; ++j) { + if (debounce_matrix[row * MATRIX_COLS + j]) { + --debounce_matrix[row * MATRIX_COLS + j]; + } else { + result |= (1 << j); + } + } + return result; +} + +// Report changed keys in the given row. Resets the debounce countdowns +// corresponding to each set bit in 'change' to DEBOUNCE. +void debounce_report(matrix_row_t change, uint8_t row) { + for (uint8_t i = 0; i < MATRIX_COLS; ++i) { + if (change & (1 << i)) { + debounce_matrix[row * MATRIX_COLS + i] = DEBOUNCE; + } + } +} + +uint8_t matrix_scan(void) +{ + expander_scan(); + + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + select_row(i); + wait_us(30); // without this wait read unstable value. + matrix_row_t mask = debounce_mask(i); + matrix_row_t cols = (read_cols(i) & mask) | (matrix[i] & ~mask); + debounce_report(cols ^ matrix[i], i); + matrix[i] = cols; + + unselect_rows(); + } + + matrix_scan_quantum(); + + return 1; +} + +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++) { + print_hex8(row); print(": "); + print_bin_reverse16(matrix_get_row(row)); + print("\n"); + } +} + +uint8_t matrix_key_count(void) +{ + uint8_t count = 0; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + count += bitpop16(matrix[i]); + } + return count; +} + +/* Column pin configuration + * + * Pro Micro: 6 5 4 3 2 1 0 + * PD3 PD2 PD4 PC6 PD7 PE6 PB4 + * + * Expander: 13 12 11 10 9 8 7 + */ +static void init_cols(void) +{ + // Pro Micro + DDRE &= ~(1<<PE6); + PORTE |= (1<<PE6); + DDRD &= ~(1<<PD2 | 1<<PD3 | 1<<PD4 | 1<<PD7); + PORTD |= (1<<PD2 | 1<<PD3 | 1<<PD4 | 1<<PD7); + DDRC &= ~(1<<PC6); + PORTC |= (1<<PC6); + DDRB &= ~(1<<PB4); + PORTB |= (1<<PB4); + + // MCP23017 + expander_init(); +} + +static matrix_row_t read_cols(uint8_t row) +{ + return expander_read_row() | + (PIND&(1<<PD3) ? 0 : (1<<6)) | + (PIND&(1<<PD2) ? 0 : (1<<5)) | + (PIND&(1<<PD4) ? 0 : (1<<4)) | + (PINC&(1<<PC6) ? 0 : (1<<3)) | + (PIND&(1<<PD7) ? 0 : (1<<2)) | + (PINE&(1<<PE6) ? 0 : (1<<1)) | + (PINB&(1<<PB4) ? 0 : (1<<0)) ; +} + +/* Row pin configuration + * + * Pro Micro: 0 1 2 3 4 5 + * F4 F5 F6 F7 B1 B2 + * + * Expander: 0 1 2 3 4 5 + */ +static void unselect_rows(void) +{ + // Pro Micro + DDRF &= ~(1<<PF4 | 1<<PF5 | 1<<PF6 | 1<<PF7); + PORTF &= ~(1<<PF4 | 1<<PF5 | 1<<PF6 | 1<<PF7); + DDRB &= ~(1<<PB1 | 1<<PB2); + PORTB &= ~(1<<PB1 | 1<<PB2); + + // Expander + expander_unselect_rows(); +} + +static void select_row(uint8_t row) +{ + // Pro Micro + switch (row) { + case 0: + DDRF |= (1<<PF4); + PORTF &= ~(1<<PF4); + break; + case 1: + DDRF |= (1<<PF5); + PORTF &= ~(1<<PF5); + break; + case 2: + DDRF |= (1<<PF6); + PORTF &= ~(1<<PF6); + break; + case 3: + DDRF |= (1<<PF7); + PORTF &= ~(1<<PF7); + break; + case 4: + DDRB |= (1<<PB1); + PORTB &= ~(1<<PB1); + break; + case 5: + DDRB |= (1<<PB2); + PORTB &= ~(1<<PB2); + break; + } + + expander_select_row(row); +} + diff --git a/keyboards/ktec/ergodone/readme.md b/keyboards/ktec/ergodone/readme.md new file mode 100644 index 0000000000..82c1043dad --- /dev/null +++ b/keyboards/ktec/ergodone/readme.md @@ -0,0 +1,33 @@ +ErgoDone +======== + +![ErgoDone](https://i.imgur.com/QERsQGQ.jpg) + +The ErgoDone is a modified version of the ErgoDox, made by K.T.E.C., with pre-soldered components. It has different wiring and uses a SparkFun Pro Micro instead of Teensy. + +- Keyboard maintainer: [Yu He](http://github.com/yuhe00) +- Hardware supported: + - ErgoDone v1.3 (tested) +- Hardware availability: + - [AliExpress](https://www.aliexpress.com/store/product/ergodone-Custom-Mechanical-Keyboard-TKG-TOOLS-PCB-programmed-Ergonomic-Keyboard-Kit-similar-with-infinity-ergodox/3034003_32830050940.html) + - [KBDfans](https://kbdfans.myshopify.com/collections/pcb/products/ergodone-keyboard-pcb-1pcs-free-shipping) + +# Building the firmware + +[Install the build tools.](https://docs.qmk.fm/#/getting_started_build_tools) + +In the root directory of the repository, build the firmware with a command like: + + make ergodone:default + +For more information on the layout option and other ones, see the [`make` guide](https://docs.qmk.fm/#/getting_started_make_guide). + +# Flashing the firmware onto the keyboard + +The ErgoDone uses a customized HID bootloader rather than the Teensy one. It doesn't need an OS driver, and the required actions before flashing are a little different than with an ErgoDox. + +1. To enter flash mode, disconnect the keyboard first. Then, on the left-hand device, in the top row, press and hold the two rightmost keys while reconnecting the keyboard. +![Ergodone Flash Mode](https://i.imgur.com/sNivAnr.jpg) +2. To flash the .hex file, use the `hid_bootloader_cli` utlity from the [TKG Toolkit](https://github.com/kairyu/tkg-toolkit) (as of 2017-10-03, only [this old version](https://github.com/kairyu/tkg-toolkit/blob/b14c67ca8bc84c07e5fc6b2e01ae4002b808243a/windows/bin/hid_bootloader_cli.exe) works under Windows): + + hid_bootloader_cli -mmcu=atmega32u4 ergodone_default.hex diff --git a/keyboards/ktec/ergodone/rules.mk b/keyboards/ktec/ergodone/rules.mk new file mode 100644 index 0000000000..7b88a1419c --- /dev/null +++ b/keyboards/ktec/ergodone/rules.mk @@ -0,0 +1,37 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# comment out to disable the options. +# +CUSTOM_MATRIX = yes # Custom matrix file for the ErgoDone +UNICODE_ENABLE = yes # Unicode +BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA +USB_6KRO_ENABLE = no # USB 6key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +SWAP_HANDS_ENABLE = no # Disable Onehand +RGBLIGHT_ENABLE = no + +# project specific files +SRC = \ + twimaster.c \ + matrix.c \ + expander.c \ + +LAYOUTS = ergodox diff --git a/keyboards/ktec/ergodone/twimaster.c b/keyboards/ktec/ergodone/twimaster.c new file mode 100644 index 0000000000..d6f3f78405 --- /dev/null +++ b/keyboards/ktec/ergodone/twimaster.c @@ -0,0 +1,208 @@ +/************************************************************************* +* Title: I2C master library using hardware TWI interface +* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury +* File: $Id: twimaster.c,v 1.3 2005/07/02 11:14:21 Peter Exp $ +* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3 +* Target: any AVR device with hardware TWI +* Usage: API compatible with I2C Software Library i2cmaster.h +**************************************************************************/ +#include <inttypes.h> +#include <compat/twi.h> + +#include "i2cmaster.h" + + +/* define CPU frequency in Mhz here if not defined in Makefile */ +#ifndef F_CPU +#define F_CPU 16000000UL +#endif + +/* I2C clock in Hz */ +#define SCL_CLOCK 400000L + + +/************************************************************************* + Initialization of the I2C bus interface. Need to be called only once +*************************************************************************/ +void i2c_init(void) +{ + /* initialize TWI clock + * minimal values in Bit Rate Register (TWBR) and minimal Prescaler + * bits in the TWI Status Register should give us maximal possible + * I2C bus speed - about 444 kHz + * + * for more details, see 20.5.2 in ATmega16/32 secification + */ + + TWSR = 0; /* no prescaler */ + TWBR = 10; /* must be >= 10 for stable operation */ + +}/* i2c_init */ + + +/************************************************************************* + Issues a start condition and sends address and transfer direction. + return 0 = device accessible, 1= failed to access device +*************************************************************************/ +unsigned char i2c_start(unsigned char address) +{ + uint8_t twst; + + // send START condition + TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); + + // wait until transmission completed + while(!(TWCR & (1<<TWINT))); + + // check value of TWI Status Register. Mask prescaler bits. + twst = TW_STATUS & 0xF8; + if ( (twst != TW_START) && (twst != TW_REP_START)) return 1; + + // send device address + TWDR = address; + TWCR = (1<<TWINT) | (1<<TWEN); + + // wail until transmission completed and ACK/NACK has been received + while(!(TWCR & (1<<TWINT))); + + // check value of TWI Status Register. Mask prescaler bits. + twst = TW_STATUS & 0xF8; + if ( (twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK) ) return 1; + + return 0; + +}/* i2c_start */ + + +/************************************************************************* + Issues a start condition and sends address and transfer direction. + If device is busy, use ack polling to wait until device is ready + + Input: address and transfer direction of I2C device +*************************************************************************/ +void i2c_start_wait(unsigned char address) +{ + uint8_t twst; + + + while ( 1 ) + { + // send START condition + TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); + + // wait until transmission completed + while(!(TWCR & (1<<TWINT))); + + // check value of TWI Status Register. Mask prescaler bits. + twst = TW_STATUS & 0xF8; + if ( (twst != TW_START) && (twst != TW_REP_START)) continue; + + // send device address + TWDR = address; + TWCR = (1<<TWINT) | (1<<TWEN); + + // wail until transmission completed + while(!(TWCR & (1<<TWINT))); + + // check value of TWI Status Register. Mask prescaler bits. + twst = TW_STATUS & 0xF8; + if ( (twst == TW_MT_SLA_NACK )||(twst ==TW_MR_DATA_NACK) ) + { + /* device busy, send stop condition to terminate write operation */ + TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); + + // wait until stop condition is executed and bus released + while(TWCR & (1<<TWSTO)); + + continue; + } + //if( twst != TW_MT_SLA_ACK) return 1; + break; + } + +}/* i2c_start_wait */ + + +/************************************************************************* + Issues a repeated start condition and sends address and transfer direction + + Input: address and transfer direction of I2C device + + Return: 0 device accessible + 1 failed to access device +*************************************************************************/ +unsigned char i2c_rep_start(unsigned char address) +{ + return i2c_start( address ); + +}/* i2c_rep_start */ + + +/************************************************************************* + Terminates the data transfer and releases the I2C bus +*************************************************************************/ +void i2c_stop(void) +{ + /* send stop condition */ + TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); + + // wait until stop condition is executed and bus released + while(TWCR & (1<<TWSTO)); + +}/* i2c_stop */ + + +/************************************************************************* + Send one byte to I2C device + + Input: byte to be transfered + Return: 0 write successful + 1 write failed +*************************************************************************/ +unsigned char i2c_write( unsigned char data ) +{ + uint8_t twst; + + // send data to the previously addressed device + TWDR = data; + TWCR = (1<<TWINT) | (1<<TWEN); + + // wait until transmission completed + while(!(TWCR & (1<<TWINT))); + + // check value of TWI Status Register. Mask prescaler bits + twst = TW_STATUS & 0xF8; + if( twst != TW_MT_DATA_ACK) return 1; + return 0; + +}/* i2c_write */ + + +/************************************************************************* + Read one byte from the I2C device, request more data from device + + Return: byte read from I2C device +*************************************************************************/ +unsigned char i2c_readAck(void) +{ + TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWEA); + while(!(TWCR & (1<<TWINT))); + + return TWDR; + +}/* i2c_readAck */ + + +/************************************************************************* + Read one byte from the I2C device, read is followed by a stop condition + + Return: byte read from I2C device +*************************************************************************/ +unsigned char i2c_readNak(void) +{ + TWCR = (1<<TWINT) | (1<<TWEN); + while(!(TWCR & (1<<TWINT))); + + return TWDR; + +}/* i2c_readNak */ |