diff options
author | Pierre Constantineau <jpconstantineau@gmail.com> | 2018-06-05 19:15:19 +0300 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-06-05 09:15:19 -0700 |
commit | c5b9533312443b78b152385d267cb19a87189478 (patch) | |
tree | 94bc31d4589aff231fd26c67a57bff6d693e4cb2 /keyboards | |
parent | 6b1350d764a0caf16bcf9c175a5c7867d8cd4fcb (diff) |
adding all ErgoTravel Files (#3129)
* adding all ErgoTravel Files
* fixing KC_KEYMAP to LAYOUT_kc on Viet's keymap.c
Diffstat (limited to 'keyboards')
33 files changed, 2635 insertions, 83 deletions
diff --git a/keyboards/ergotravel/config.h b/keyboards/ergotravel/config.h new file mode 100644 index 0000000000..beda546a04 --- /dev/null +++ b/keyboards/ergotravel/config.h @@ -0,0 +1,90 @@ +/* +Copyright 2018 Pierre Constantineau <jpconstantineau@gmail.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef REV1_CONFIG_H +#define REV1_CONFIG_H + +#include QMK_KEYBOARD_CONFIG_H + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1256 +#define DEVICE_VER 0x0100 +#define MANUFACTURER JPConstantineau.com +#define PRODUCT ErgoTravel Keyboard +#define DESCRIPTION Split 45 percent ergonomic keyboard + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 8 +#define MATRIX_COLS 7 + +// wiring of each half +#define MATRIX_ROW_PINS { C6, D7, E6, B4 } +#define MATRIX_COL_PINS { F5, F6, F7, B1, B3, B2, B6 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define BACKLIGHT_PIN B5 +#define BACKLIGHT_LEVELS 5 + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 12 // Number of LEDs +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboards/ergotravel/ergotravel.c b/keyboards/ergotravel/ergotravel.c new file mode 100644 index 0000000000..2ada434c19 --- /dev/null +++ b/keyboards/ergotravel/ergotravel.c @@ -0,0 +1 @@ +#include "ergotravel.h" diff --git a/keyboards/ergotravel/ergotravel.h b/keyboards/ergotravel/ergotravel.h new file mode 100644 index 0000000000..353000061a --- /dev/null +++ b/keyboards/ergotravel/ergotravel.h @@ -0,0 +1,24 @@ +#ifndef ERGOTRAVEL_H +#define ERGOTRAVEL_H + +#ifdef KEYBOARD_ergotravel_rev1 + #include "rev1.h" +#endif + +#include "quantum.h" + +// Used to create a keymap using only KC_ prefixed keys +#define LAYOUT_kc( \ + 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,L26, R20, R21, R22, R23, R24, R25, R26,\ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ + ) \ + LAYOUT( \ + KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##L06, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, KC_##R06, \ + KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##L16, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, KC_##R16, \ + KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##L26, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, KC_##R26, \ + KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \ + ) + +#endif
\ No newline at end of file diff --git a/keyboards/ergotravel/i2c.c b/keyboards/ergotravel/i2c.c new file mode 100644 index 0000000000..084c890c40 --- /dev/null +++ b/keyboards/ergotravel/i2c.c @@ -0,0 +1,162 @@ +#include <util/twi.h> +#include <avr/io.h> +#include <stdlib.h> +#include <avr/interrupt.h> +#include <util/twi.h> +#include <stdbool.h> +#include "i2c.h" + +#ifdef USE_I2C + +// Limits the amount of we wait for any one i2c transaction. +// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is +// 9 bits, a single transaction will take around 90μs to complete. +// +// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit +// poll loop takes at least 8 clock cycles to execute +#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 + +#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) + +volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +static volatile uint8_t slave_buffer_pos; +static volatile bool slave_has_register_set = false; + +// Wait for an i2c operation to finish +inline static +void i2c_delay(void) { + uint16_t lim = 0; + while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) + lim++; + + // easier way, but will wait slightly longer + // _delay_us(100); +} + +// Setup twi to run at 100kHz +void i2c_master_init(void) { + // no prescaler + TWSR = 0; + // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. + // Check datasheets for more info. + TWBR = ((F_CPU/SCL_CLOCK)-16)/2; +} + +// Start a transaction with the given i2c slave address. The direction of the +// transfer is set with I2C_READ and I2C_WRITE. +// returns: 0 => success +// 1 => error +uint8_t i2c_master_start(uint8_t address) { + TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); + + i2c_delay(); + + // check that we started successfully + if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) + return 1; + + TWDR = address; + TWCR = (1<<TWINT) | (1<<TWEN); + + i2c_delay(); + + if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) + return 1; // slave did not acknowledge + else + return 0; // success +} + + +// Finish the i2c transaction. +void i2c_master_stop(void) { + TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); + + uint16_t lim = 0; + while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) + lim++; +} + +// Write one byte to the i2c slave. +// returns 0 => slave ACK +// 1 => slave NACK +uint8_t i2c_master_write(uint8_t data) { + TWDR = data; + TWCR = (1<<TWINT) | (1<<TWEN); + + i2c_delay(); + + // check if the slave acknowledged us + return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; +} + +// Read one byte from the i2c slave. If ack=1 the slave is acknowledged, +// if ack=0 the acknowledge bit is not set. +// returns: byte read from i2c device +uint8_t i2c_master_read(int ack) { + TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); + + i2c_delay(); + return TWDR; +} + +void i2c_reset_state(void) { + TWCR = 0; +} + +void i2c_slave_init(uint8_t address) { + TWAR = address << 0; // slave i2c address + // TWEN - twi enable + // TWEA - enable address acknowledgement + // TWINT - twi interrupt flag + // TWIE - enable the twi interrupt + TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); +} + +ISR(TWI_vect); + +ISR(TWI_vect) { + uint8_t ack = 1; + switch(TW_STATUS) { + case TW_SR_SLA_ACK: + // this device has been addressed as a slave receiver + slave_has_register_set = false; + break; + + case TW_SR_DATA_ACK: + // this device has received data as a slave receiver + // The first byte that we receive in this transaction sets the location + // of the read/write location of the slaves memory that it exposes over + // i2c. After that, bytes will be written at slave_buffer_pos, incrementing + // slave_buffer_pos after each write. + if(!slave_has_register_set) { + slave_buffer_pos = TWDR; + // don't acknowledge the master if this memory loctaion is out of bounds + if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { + ack = 0; + slave_buffer_pos = 0; + } + slave_has_register_set = true; + } else { + i2c_slave_buffer[slave_buffer_pos] = TWDR; + BUFFER_POS_INC(); + } + break; + + case TW_ST_SLA_ACK: + case TW_ST_DATA_ACK: + // master has addressed this device as a slave transmitter and is + // requesting data. + TWDR = i2c_slave_buffer[slave_buffer_pos]; + BUFFER_POS_INC(); + break; + + case TW_BUS_ERROR: // something went wrong, reset twi state + TWCR = 0; + default: + break; + } + // Reset everything, so we are ready for the next TWI interrupt + TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); +} +#endif diff --git a/keyboards/ergotravel/i2c.h b/keyboards/ergotravel/i2c.h new file mode 100644 index 0000000000..43e5969884 --- /dev/null +++ b/keyboards/ergotravel/i2c.h @@ -0,0 +1,49 @@ +#ifndef I2C_H +#define I2C_H + +#include <stdint.h> + +#ifndef F_CPU +#define F_CPU 16000000UL +#endif + +#define I2C_READ 1 +#define I2C_WRITE 0 + +#define I2C_ACK 1 +#define I2C_NACK 0 + +#define SLAVE_BUFFER_SIZE 0x10 + +// i2c SCL clock frequency +#define SCL_CLOCK 100000L + +extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +void i2c_master_init(void); +uint8_t i2c_master_start(uint8_t address); +void i2c_master_stop(void); +uint8_t i2c_master_write(uint8_t data); +uint8_t i2c_master_read(int); +void i2c_reset_state(void); +void i2c_slave_init(uint8_t address); + + +static inline unsigned char i2c_start_read(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_READ); +} + +static inline unsigned char i2c_start_write(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_WRITE); +} + +// from SSD1306 scrips +extern unsigned char i2c_rep_start(unsigned char addr); +extern void i2c_start_wait(unsigned char addr); +extern unsigned char i2c_readAck(void); +extern unsigned char i2c_readNak(void); +extern unsigned char i2c_read(unsigned char ack); + +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); + +#endif diff --git a/keyboards/ergotravel/info.json b/keyboards/ergotravel/info.json new file mode 100644 index 0000000000..c92ea720cb --- /dev/null +++ b/keyboards/ergotravel/info.json @@ -0,0 +1,15 @@ +{ + "keyboard_name": "ErgoTravel", + "manufacturer": "jpconstantineau", + "identifier": "0x1256", + "url": "https://github.com/jpconstantineau/ErgoTravel", + "maintainer": "qmk", + "processor": "atmega32u4", + "width": 14.5, + "height": 5, + "layouts": { + "LAYOUT": { + "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":8.5, "y":0}, {"x":9.5, "y":0}, {"x":10.5, "y":0}, {"x":11.5, "y":0}, {"x":12.5, "y":0}, {"x":13.5, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":8.5, "y":2}, {"x":9.5, "y":2}, {"x":10.5, "y":2}, {"x":11.5, "y":2}, {"x":12.5, "y":2}, {"x":13.5, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":7.5, "y":3}, {"x":8.5, "y":3}, {"x":9.5, "y":3}, {"x":10.5, "y":3}, {"x":11.5, "y":3}, {"x":12.5, "y":3}, {"x":13.5, "y":3}, {"x":4, "y":4}, {"x":5, "y":4}, {"x":6, "y":4}, {"x":7.5, "y":4}, {"x":8.5, "y":4}, {"x":9.5, "y":4}] + } + } +} diff --git a/keyboards/ergotravel/keymaps/ckofy/config.h b/keyboards/ergotravel/keymaps/ckofy/config.h new file mode 100644 index 0000000000..caae080d70 --- /dev/null +++ b/keyboards/ergotravel/keymaps/ckofy/config.h @@ -0,0 +1,46 @@ +/* +Copyright 2017 Pierre Constantineau <jpconstantineau@gmail.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +/* Use I2C or Serial, not both */ + +//#define USE_SERIAL +#define USE_I2C + +/* Select hand configuration */ + +//#define MASTER_LEFT +#define MASTER_RIGHT +//#define EE_HANDS + +#define TAPPING_TOGGLE 2 + +// required if modifiers are defined in layers besided the default one. +#define PREVENT_STUCK_MODIFIERS + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/ergotravel/keymaps/ckofy/keymap.c b/keyboards/ergotravel/keymaps/ckofy/keymap.c new file mode 100644 index 0000000000..cc2c33cca3 --- /dev/null +++ b/keyboards/ergotravel/keymaps/ckofy/keymap.c @@ -0,0 +1,202 @@ +#include QMK_KEYBOARD_H + +extern keymap_config_t keymap_config; + +#define _COLEMAK 0 +#define _QWERTY 1 +#define _NUMPAD 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + COLEMAK = SAFE_RANGE, + QWERTY, + NUMPAD, + LOWER, + RAISE, + ADJUST, +}; + +/* Fn keys */ + +enum { + + F_SFT = 0, + F_ALT, + F_CTRL, + F_NUMPAD +// F_LOWER, +// F_RAISE, +}; + +#define KC_ KC_TRNS +#define _______ KC_TRNS +#define KC_XXXX KC_NO + +#define KC_CMK COLEMAK +#define KC_QWE QWERTY +#define KC_LOWR LOWER +#define KC_RASE RAISE +#define KC_QRAS QRAISE +#define KC_ADJT ADJUST +#define KC_RST RESET +#define KC_BL_S BL_STEP +#define KC_DBUG DEBUG +#define KC_RTOG RGB_TOG +#define KC_RMOD RGB_MOD +#define KC_RHUI RGB_HUI +#define KC_RHUD RGB_HUD +#define KC_RSAI RGB_SAI +#define KC_RSAD RGB_SAD +#define KC_RVAI RGB_VAI +#define KC_RVAD RGB_VAD +//#define KC_CATDEL LCTL(LALT(KC_DEL)) // Ctrl alt del +#define KC_CPY LCTL(KC_C) +#define KC_PST LCTL(KC_V) +#define KC_SELA LCTL(KC_A) +#define KC_UDO LCTL(KC_Z) +#define KC_CUT LCTL(KC_X) +#define KC_SVE LCTL(KC_S) +#define KC_OSH F(F_SFT) +#define KC_OCTL F(F_CTRL) +#define KC_NUMP F(F_NUMPAD) +#define KC_SHESC MT(MOD_LSFT,KC_ESC) +#define KC_SHENT MT(MOD_RSFT,KC_ENT) +//#define KC_NUMP TG(_NUMPAD) // Toggle layer NUMPAD for use in KC_keymaps +//#define KC_RST RESET + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +// Colemak Mod-DH is used. https://colemakmods.github.io/mod-dh/ + [_COLEMAK] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + TAB , Q , W , F , P , B ,LPRN, RPRN, J , L , U , Y ,SCLN,BSPC, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + BSPC, A , R , S , T , G ,EQL , MINS, K , N , E , I , O ,QUOT, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + SHESC, Z , X , C , D , V ,NUMP, ENT, M , H ,COMM,DOT ,SLSH,SHENT, + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + OCTL,LALT,LGUI,DEL ,LOWR, SPC, OSH, RASE,LEFT,RIGHT,RALT,RCTL + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ), + + [_QWERTY] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ESC , Q , W , E , R , T ,LBRC, RBRC, Y , U , I , O , P ,BSPC, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB , A , S , D , F , G ,LPRN, RPRN, H , J , K , L ,SCLN,QUOT, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B , , , N , M ,COMM,DOT ,SLSH,ENT , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + LCTL,LGUI,LALT,DEL , , SPC, SPC , ,LEFT,DOWN, UP ,RIGHT + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ), + + [_NUMPAD] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + , , , , , , , ,ASTR, P7 , P8 , P9 ,SLSH, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , ,PIPE, P4 , P5 , P6 ,MINS, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , ,COMM, P1 , P2 , P3 ,PLUS, , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + , , , , , , , P0 ,NLCK, , , + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ), + + [_LOWER] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ,XXXX,XXXX,XXXX,XXXX,CAPS, , ,PGUP,HOME, UP ,END ,DEL , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + ,SELA,LALT,LSFT,LCTL,SVE , , ,PGDN,LEFT,DOWN,RGHT,BSPC,INS , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + ,UDO ,CUT ,CPY ,PST ,XXXX, , ,XXXX,XXXX,COMM,DOT ,SLSH, , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + , , , , , , , , , , , + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ), + + [_RAISE] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ,AMPR,PERC,HASH,EXLM,LPRN, , ,ASTR,RPRN, AT ,DLR ,CIRC,BSPC, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , 7 , 5 , 3 , 1 , 9 ,LBRC, RBRC, 8 , 0 , 2 , 4 , 6 ,BSLS, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , GRV,TILD,XXXX,EQL ,PLUS, , ,UNDS,MINS,COMM,DOT ,SLSH,ENT , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + , , , , , , , , , , , + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ), + + + [_ADJUST] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + , F1 , F2 , F3 , F4 , F5 , F6, F7, F8, F9 ,F10 , F11, F12,BSPC, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , CMK,QWE , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , , , , , , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + , , , , , , , , ,VOLD,VOLU,MUTE + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ) + +}; + +const uint16_t PROGMEM fn_actions[] = { + [F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT) + ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT) + ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL) + ,[F_NUMPAD] = ACTION_LAYER_TAP_TOGGLE(_NUMPAD) +// ,[F_LOWER] = ACTION_LAYER_TAP_TOGGLE(LOWER) // FN1 - Momentary Layer 1 (Lower) +// ,[F_RAISE] = ACTION_LAYER_TAP_TOGGLE(RAISE) // FN2 - Momentary Layer 2 (Raise) +}; + + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + + } + return false; + break; + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/ergotravel/keymaps/ckofy/rules.mk b/keyboards/ergotravel/keymaps/ckofy/rules.mk new file mode 100644 index 0000000000..457a3d01d4 --- /dev/null +++ b/keyboards/ergotravel/keymaps/ckofy/rules.mk @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/ergotravel/keymaps/default/config.h b/keyboards/ergotravel/keymaps/default/config.h new file mode 100644 index 0000000000..abb8cfa8e6 --- /dev/null +++ b/keyboards/ergotravel/keymaps/default/config.h @@ -0,0 +1,41 @@ +/* +Copyright 2017 Pierre Constantineau <jpconstantineau@gmail.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/ergotravel/keymaps/default/keymap.c b/keyboards/ergotravel/keymaps/default/keymap.c new file mode 100644 index 0000000000..ef168a5362 --- /dev/null +++ b/keyboards/ergotravel/keymaps/default/keymap.c @@ -0,0 +1,134 @@ +#include QMK_KEYBOARD_H + +extern keymap_config_t keymap_config; + +#define _QWERTY 0 +#define _LOWER 1 +#define _RAISE 2 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + LOWER, + RAISE, + ADJUST, +}; + +#define KC_ KC_TRNS +#define _______ KC_TRNS + +#define KC_LOWR LOWER +#define KC_RASE RAISE +#define KC_ADJT ADJUST +#define KC_RST RESET +#define KC_BL_S BL_STEP +#define KC_DBUG DEBUG +#define KC_RTOG RGB_TOG +#define KC_RMOD RGB_MOD +#define KC_RHUI RGB_HUI +#define KC_RHUD RGB_HUD +#define KC_RSAI RGB_SAI +#define KC_RSAD RGB_SAD +#define KC_RVAI RGB_VAI +#define KC_RVAD RGB_VAD + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ESC , Q , W , E , R , T ,LBRC, RBRC, Y , U , I , O , P ,BSPC, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB , A , S , D , F , G , A, A, H , J , K , L ,SCLN,QUOT, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ), + + [_LOWER] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + GRAVE, 1 , 2 , 3 , 4 , 5 , A, B, 6 , 7 , 8 , 9 , 0 ,DEL, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB , F1 , F2 , F3 , F4 , F5 , F6 , D, Y ,MINS, EQL,LBRC,RBRC,BSLS, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, F7 , F8 , F9 , F10, F11, F12, SPC, N , M ,COMM,DOT ,SLSH,ENT , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ), + + [_RAISE] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ESC , 1 , 2 , 3 , 4 , 5 , A, B, 6 , 7 , 8 , 9 , 0 ,BSPC, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB , Q , W , E , R , T , C , D, Y , U , I , O , P ,DEL , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ), + + [_ADJUST] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ESC , F1 , F2 , F3 , F4 , F5 , F6, F7, F8, F9 ,F10 , F11, F12,BSPC, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB , Q , W , E , R , T , C , D, Y , U , I , O , P ,DEL , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , + //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| + LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT + //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' + ) |