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 | |
parent | 6b1350d764a0caf16bcf9c175a5c7867d8cd4fcb (diff) | |
download | qmk_firmware-c5b9533312443b78b152385d267cb19a87189478.tar.gz qmk_firmware-c5b9533312443b78b152385d267cb19a87189478.zip |
adding all ErgoTravel Files (#3129)
* adding all ErgoTravel Files
* fixing KC_KEYMAP to LAYOUT_kc on Viet's keymap.c
33 files changed, 2635 insertions, 83 deletions
diff --git a/keyboards/ergotravel/config.h b/keyboards/ergotravel/config.h new file mode 100644 index 000000000..beda546a0 --- /dev/null +++ b/keyboards/ergotravel/config.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | Copyright 2018 Pierre Constantineau <jpconstantineau@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef REV1_CONFIG_H | ||
19 | #define REV1_CONFIG_H | ||
20 | |||
21 | #include QMK_KEYBOARD_CONFIG_H | ||
22 | |||
23 | /* USB Device descriptor parameter */ | ||
24 | #define VENDOR_ID 0xCEEB | ||
25 | #define PRODUCT_ID 0x1256 | ||
26 | #define DEVICE_VER 0x0100 | ||
27 | #define MANUFACTURER JPConstantineau.com | ||
28 | #define PRODUCT ErgoTravel Keyboard | ||
29 | #define DESCRIPTION Split 45 percent ergonomic keyboard | ||
30 | |||
31 | /* key matrix size */ | ||
32 | // Rows are doubled-up | ||
33 | #define MATRIX_ROWS 8 | ||
34 | #define MATRIX_COLS 7 | ||
35 | |||
36 | // wiring of each half | ||
37 | #define MATRIX_ROW_PINS { C6, D7, E6, B4 } | ||
38 | #define MATRIX_COL_PINS { F5, F6, F7, B1, B3, B2, B6 } | ||
39 | |||
40 | /* COL2ROW or ROW2COL */ | ||
41 | #define DIODE_DIRECTION COL2ROW | ||
42 | |||
43 | /* define if matrix has ghost */ | ||
44 | //#define MATRIX_HAS_GHOST | ||
45 | |||
46 | /* number of backlight levels */ | ||
47 | // #define BACKLIGHT_LEVELS 3 | ||
48 | |||
49 | /* Set 0 if debouncing isn't needed */ | ||
50 | #define DEBOUNCING_DELAY 5 | ||
51 | |||
52 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
53 | #define LOCKING_SUPPORT_ENABLE | ||
54 | /* Locking resynchronize hack */ | ||
55 | #define LOCKING_RESYNC_ENABLE | ||
56 | |||
57 | /* key combination for command */ | ||
58 | #define IS_COMMAND() ( \ | ||
59 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
60 | ) | ||
61 | |||
62 | #define BACKLIGHT_PIN B5 | ||
63 | #define BACKLIGHT_LEVELS 5 | ||
64 | |||
65 | /* ws2812 RGB LED */ | ||
66 | #define RGB_DI_PIN D3 | ||
67 | #define RGBLIGHT_TIMER | ||
68 | #define RGBLED_NUM 12 // Number of LEDs | ||
69 | #define ws2812_PORTREG PORTD | ||
70 | #define ws2812_DDRREG DDRD | ||
71 | |||
72 | /* | ||
73 | * Feature disable options | ||
74 | * These options are also useful to firmware size reduction. | ||
75 | */ | ||
76 | |||
77 | /* disable debug print */ | ||
78 | // #define NO_DEBUG | ||
79 | |||
80 | /* disable print */ | ||
81 | // #define NO_PRINT | ||
82 | |||
83 | /* disable action features */ | ||
84 | //#define NO_ACTION_LAYER | ||
85 | //#define NO_ACTION_TAPPING | ||
86 | //#define NO_ACTION_ONESHOT | ||
87 | //#define NO_ACTION_MACRO | ||
88 | //#define NO_ACTION_FUNCTION | ||
89 | |||
90 | #endif | ||
diff --git a/keyboards/ergotravel/ergotravel.c b/keyboards/ergotravel/ergotravel.c new file mode 100644 index 000000000..2ada434c1 --- /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 000000000..353000061 --- /dev/null +++ b/keyboards/ergotravel/ergotravel.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef ERGOTRAVEL_H | ||
2 | #define ERGOTRAVEL_H | ||
3 | |||
4 | #ifdef KEYBOARD_ergotravel_rev1 | ||
5 | #include "rev1.h" | ||
6 | #endif | ||
7 | |||
8 | #include "quantum.h" | ||
9 | |||
10 | // Used to create a keymap using only KC_ prefixed keys | ||
11 | #define LAYOUT_kc( \ | ||
12 | L00, L01, L02, L03, L04, L05,L06, R00, R01, R02, R03, R04, R05, R06, \ | ||
13 | L10, L11, L12, L13, L14, L15,L16, R10, R11, R12, R13, R14, R15, R16,\ | ||
14 | L20, L21, L22, L23, L24, L25,L26, R20, R21, R22, R23, R24, R25, R26,\ | ||
15 | L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ | ||
16 | ) \ | ||
17 | LAYOUT( \ | ||
18 | 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, \ | ||
19 | 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, \ | ||
20 | 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, \ | ||
21 | KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \ | ||
22 | ) | ||
23 | |||
24 | #endif \ No newline at end of file | ||
diff --git a/keyboards/ergotravel/i2c.c b/keyboards/ergotravel/i2c.c new file mode 100644 index 000000000..084c890c4 --- /dev/null +++ b/keyboards/ergotravel/i2c.c | |||
@@ -0,0 +1,162 @@ | |||
1 | #include <util/twi.h> | ||
2 | #include <avr/io.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <avr/interrupt.h> | ||
5 | #include <util/twi.h> | ||
6 | #include <stdbool.h> | ||
7 | #include "i2c.h" | ||
8 | |||
9 | #ifdef USE_I2C | ||
10 | |||
11 | // Limits the amount of we wait for any one i2c transaction. | ||
12 | // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is | ||
13 | // 9 bits, a single transaction will take around 90μs to complete. | ||
14 | // | ||
15 | // (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit | ||
16 | // poll loop takes at least 8 clock cycles to execute | ||
17 | #define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 | ||
18 | |||
19 | #define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) | ||
20 | |||
21 | volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
22 | |||
23 | static volatile uint8_t slave_buffer_pos; | ||
24 | static volatile bool slave_has_register_set = false; | ||
25 | |||
26 | // Wait for an i2c operation to finish | ||
27 | inline static | ||
28 | void i2c_delay(void) { | ||
29 | uint16_t lim = 0; | ||
30 | while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) | ||
31 | lim++; | ||
32 | |||
33 | // easier way, but will wait slightly longer | ||
34 | // _delay_us(100); | ||
35 | } | ||
36 | |||
37 | // Setup twi to run at 100kHz | ||
38 | void i2c_master_init(void) { | ||
39 | // no prescaler | ||
40 | TWSR = 0; | ||
41 | // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. | ||
42 | // Check datasheets for more info. | ||
43 | TWBR = ((F_CPU/SCL_CLOCK)-16)/2; | ||
44 | } | ||
45 | |||
46 | // Start a transaction with the given i2c slave address. The direction of the | ||
47 | // transfer is set with I2C_READ and I2C_WRITE. | ||
48 | // returns: 0 => success | ||
49 | // 1 => error | ||
50 | uint8_t i2c_master_start(uint8_t address) { | ||
51 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); | ||
52 | |||
53 | i2c_delay(); | ||
54 | |||
55 | // check that we started successfully | ||
56 | if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) | ||
57 | return 1; | ||
58 | |||
59 | TWDR = address; | ||
60 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
61 | |||
62 | i2c_delay(); | ||
63 | |||
64 | if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) | ||
65 | return 1; // slave did not acknowledge | ||
66 | else | ||
67 | return 0; // success | ||
68 | } | ||
69 | |||
70 | |||
71 | // Finish the i2c transaction. | ||
72 | void i2c_master_stop(void) { | ||
73 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); | ||
74 | |||
75 | uint16_t lim = 0; | ||
76 | while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) | ||
77 | lim++; | ||
78 | } | ||
79 | |||
80 | // Write one byte to the i2c slave. | ||
81 | // returns 0 => slave ACK | ||
82 | // 1 => slave NACK | ||
83 | uint8_t i2c_master_write(uint8_t data) { | ||
84 | TWDR = data; | ||
85 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
86 | |||
87 | i2c_delay(); | ||
88 | |||
89 | // check if the slave acknowledged us | ||
90 | return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; | ||
91 | } | ||
92 | |||
93 | // Read one byte from the i2c slave. If ack=1 the slave is acknowledged, | ||
94 | // if ack=0 the acknowledge bit is not set. | ||
95 | // returns: byte read from i2c device | ||
96 | uint8_t i2c_master_read(int ack) { | ||
97 | TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); | ||
98 | |||
99 | i2c_delay(); | ||
100 | return TWDR; | ||
101 | } | ||
102 | |||
103 | void i2c_reset_state(void) { | ||
104 | TWCR = 0; | ||
105 | } | ||
106 | |||
107 | void i2c_slave_init(uint8_t address) { | ||
108 | TWAR = address << 0; // slave i2c address | ||
109 | // TWEN - twi enable | ||
110 | // TWEA - enable address acknowledgement | ||
111 | // TWINT - twi interrupt flag | ||
112 | // TWIE - enable the twi interrupt | ||
113 | TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); | ||
114 | } | ||
115 | |||
116 | ISR(TWI_vect); | ||
117 | |||
118 | ISR(TWI_vect) { | ||
119 | uint8_t ack = 1; | ||
120 | switch(TW_STATUS) { | ||
121 | case TW_SR_SLA_ACK: | ||
122 | // this device has been addressed as a slave receiver | ||
123 | slave_has_register_set = false; | ||
124 | break; | ||
125 | |||
126 | case TW_SR_DATA_ACK: | ||
127 | // this device has received data as a slave receiver | ||
128 | // The first byte that we receive in this transaction sets the location | ||
129 | // of the read/write location of the slaves memory that it exposes over | ||
130 | // i2c. After that, bytes will be written at slave_buffer_pos, incrementing | ||
131 | // slave_buffer_pos after each write. | ||
132 | if(!slave_has_register_set) { | ||
133 | slave_buffer_pos = TWDR; | ||
134 | // don't acknowledge the master if this memory loctaion is out of bounds | ||
135 | if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { | ||
136 | ack = 0; | ||
137 | slave_buffer_pos = 0; | ||
138 | } | ||
139 | slave_has_register_set = true; | ||
140 | } else { | ||
141 | i2c_slave_buffer[slave_buffer_pos] = TWDR; | ||
142 | BUFFER_POS_INC(); | ||
143 | } | ||
144 | break; | ||
145 | |||
146 | case TW_ST_SLA_ACK: | ||
147 | case TW_ST_DATA_ACK: | ||
148 | // master has addressed this device as a slave transmitter and is | ||
149 | // requesting data. | ||
150 | TWDR = i2c_slave_buffer[slave_buffer_pos]; | ||
151 | BUFFER_POS_INC(); | ||
152 | break; | ||
153 | |||
154 | case TW_BUS_ERROR: // something went wrong, reset twi state | ||
155 | TWCR = 0; | ||
156 | default: | ||
157 | break; | ||
158 | } | ||
159 | // Reset everything, so we are ready for the next TWI interrupt | ||
160 | TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); | ||
161 | } | ||
162 | #endif | ||
diff --git a/keyboards/ergotravel/i2c.h b/keyboards/ergotravel/i2c.h new file mode 100644 index 000000000..43e596988 --- /dev/null +++ b/keyboards/ergotravel/i2c.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef I2C_H | ||
2 | #define I2C_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | |||
6 | #ifndef F_CPU | ||
7 | #define F_CPU 16000000UL | ||
8 | #endif | ||
9 | |||
10 | #define I2C_READ 1 | ||
11 | #define I2C_WRITE 0 | ||
12 | |||
13 | #define I2C_ACK 1 | ||
14 | #define I2C_NACK 0 | ||
15 | |||
16 | #define SLAVE_BUFFER_SIZE 0x10 | ||
17 | |||
18 | // i2c SCL clock frequency | ||
19 | #define SCL_CLOCK 100000L | ||
20 | |||
21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
22 | |||
23 | void i2c_master_init(void); | ||
24 | uint8_t i2c_master_start(uint8_t address); | ||
25 | void i2c_master_stop(void); | ||
26 | uint8_t i2c_master_write(uint8_t data); | ||
27 | uint8_t i2c_master_read(int); | ||
28 | void i2c_reset_state(void); | ||
29 | void i2c_slave_init(uint8_t address); | ||
30 | |||
31 | |||
32 | static inline unsigned char i2c_start_read(unsigned char addr) { | ||
33 | return i2c_master_start((addr << 1) | I2C_READ); | ||
34 | } | ||
35 | |||
36 | static inline unsigned char i2c_start_write(unsigned char addr) { | ||
37 | return i2c_master_start((addr << 1) | I2C_WRITE); | ||
38 | } | ||
39 | |||
40 | // from SSD1306 scrips | ||
41 | extern unsigned char i2c_rep_start(unsigned char addr); | ||
42 | extern void i2c_start_wait(unsigned char addr); | ||
43 | extern unsigned char i2c_readAck(void); | ||
44 | extern unsigned char i2c_readNak(void); | ||
45 | extern unsigned char i2c_read(unsigned char ack); | ||
46 | |||
47 | #define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); | ||
48 | |||
49 | #endif | ||
diff --git a/keyboards/ergotravel/info.json b/keyboards/ergotravel/info.json new file mode 100644 index 000000000..c92ea720c --- /dev/null +++ b/keyboards/ergotravel/info.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "keyboard_name": "ErgoTravel", | ||
3 | "manufacturer": "jpconstantineau", | ||
4 | "identifier": "0x1256", | ||
5 | "url": "https://github.com/jpconstantineau/ErgoTravel", | ||
6 | "maintainer": "qmk", | ||
7 | "processor": "atmega32u4", | ||
8 | "width": 14.5, | ||
9 | "height": 5, | ||
10 | "layouts": { | ||
11 | "LAYOUT": { | ||
12 | "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}] | ||
13 | } | ||
14 | } | ||
15 | } | ||
diff --git a/keyboards/ergotravel/keymaps/ckofy/config.h b/keyboards/ergotravel/keymaps/ckofy/config.h new file mode 100644 index 000000000..caae080d7 --- /dev/null +++ b/keyboards/ergotravel/keymaps/ckofy/config.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | Copyright 2017 Pierre Constantineau <jpconstantineau@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef CONFIG_USER_H | ||
19 | #define CONFIG_USER_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* Use I2C or Serial, not both */ | ||
24 | |||
25 | //#define USE_SERIAL | ||
26 | #define USE_I2C | ||
27 | |||
28 | /* Select hand configuration */ | ||
29 | |||
30 | //#define MASTER_LEFT | ||
31 | #define MASTER_RIGHT | ||
32 | //#define EE_HANDS | ||
33 | |||
34 | #define TAPPING_TOGGLE 2 | ||
35 | |||
36 | // required if modifiers are defined in layers besided the default one. | ||
37 | #define PREVENT_STUCK_MODIFIERS | ||
38 | |||
39 | #undef RGBLED_NUM | ||
40 | #define RGBLIGHT_ANIMATIONS | ||
41 | #define RGBLED_NUM 12 | ||
42 | #define RGBLIGHT_HUE_STEP 8 | ||
43 | #define RGBLIGHT_SAT_STEP 8 | ||
44 | #define RGBLIGHT_VAL_STEP 8 | ||
45 | |||
46 | #endif | ||
diff --git a/keyboards/ergotravel/keymaps/ckofy/keymap.c b/keyboards/ergotravel/keymaps/ckofy/keymap.c new file mode 100644 index 000000000..cc2c33cca --- /dev/null +++ b/keyboards/ergotravel/keymaps/ckofy/keymap.c | |||
@@ -0,0 +1,202 @@ | |||
1 | #include QMK_KEYBOARD_H | ||
2 | |||
3 | extern keymap_config_t keymap_config; | ||
4 | |||
5 | #define _COLEMAK 0 | ||
6 | #define _QWERTY 1 | ||
7 | #define _NUMPAD 2 | ||
8 | #define _LOWER 3 | ||
9 | #define _RAISE 4 | ||
10 | #define _ADJUST 16 | ||
11 | |||
12 | enum custom_keycodes { | ||
13 | COLEMAK = SAFE_RANGE, | ||
14 | QWERTY, | ||
15 | NUMPAD, | ||
16 | LOWER, | ||
17 | RAISE, | ||
18 | ADJUST, | ||
19 | }; | ||
20 | |||
21 | /* Fn keys */ | ||
22 | |||
23 | enum { | ||
24 | |||
25 | F_SFT = 0, | ||
26 | F_ALT, | ||
27 | F_CTRL, | ||
28 | F_NUMPAD | ||
29 | // F_LOWER, | ||
30 | // F_RAISE, | ||
31 | }; | ||
32 | |||
33 | #define KC_ KC_TRNS | ||
34 | #define _______ KC_TRNS | ||
35 | #define KC_XXXX KC_NO | ||
36 | |||
37 | #define KC_CMK COLEMAK | ||
38 | #define KC_QWE QWERTY | ||
39 | #define KC_LOWR LOWER | ||
40 | #define KC_RASE RAISE | ||
41 | #define KC_QRAS QRAISE | ||
42 | #define KC_ADJT ADJUST | ||
43 | #define KC_RST RESET | ||
44 | #define KC_BL_S BL_STEP | ||
45 | #define KC_DBUG DEBUG | ||
46 | #define KC_RTOG RGB_TOG | ||
47 | #define KC_RMOD RGB_MOD | ||
48 | #define KC_RHUI RGB_HUI | ||
49 | #define KC_RHUD RGB_HUD | ||
50 | #define KC_RSAI RGB_SAI | ||
51 | #define KC_RSAD RGB_SAD | ||
52 | #define KC_RVAI RGB_VAI | ||
53 | #define KC_RVAD RGB_VAD | ||
54 | //#define KC_CATDEL LCTL(LALT(KC_DEL)) // Ctrl alt del | ||
55 | #define KC_CPY LCTL(KC_C) | ||
56 | #define KC_PST LCTL(KC_V) | ||
57 | #define KC_SELA LCTL(KC_A) | ||
58 | #define KC_UDO LCTL(KC_Z) | ||
59 | #define KC_CUT LCTL(KC_X) | ||
60 | #define KC_SVE LCTL(KC_S) | ||
61 | #define KC_OSH F(F_SFT) | ||
62 | #define KC_OCTL F(F_CTRL) | ||
63 | #define KC_NUMP F(F_NUMPAD) | ||
64 | #define KC_SHESC MT(MOD_LSFT,KC_ESC) | ||
65 | #define KC_SHENT MT(MOD_RSFT,KC_ENT) | ||
66 | //#define KC_NUMP TG(_NUMPAD) // Toggle layer NUMPAD for use in KC_keymaps | ||
67 | //#define KC_RST RESET | ||
68 | |||
69 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
70 | // Colemak Mod-DH is used. https://colemakmods.github.io/mod-dh/ | ||
71 | [_COLEMAK] = LAYOUT_kc( | ||
72 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
73 | TAB , Q , W , F , P , B ,LPRN, RPRN, J , L , U , Y ,SCLN,BSPC, | ||
74 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
75 | BSPC, A , R , S , T , G ,EQL , MINS, K , N , E , I , O ,QUOT, | ||
76 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
77 | SHESC, Z , X , C , D , V ,NUMP, ENT, M , H ,COMM,DOT ,SLSH,SHENT, | ||
78 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
79 | OCTL,LALT,LGUI,DEL ,LOWR, SPC, OSH, RASE,LEFT,RIGHT,RALT,RCTL | ||
80 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
81 | ), | ||
82 | |||
83 | [_QWERTY] = LAYOUT_kc( | ||
84 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
85 | ESC , Q , W , E , R , T ,LBRC, RBRC, Y , U , I , O , P ,BSPC, | ||
86 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
87 | TAB , A , S , D , F , G ,LPRN, RPRN, H , J , K , L ,SCLN,QUOT, | ||
88 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
89 | LSFT, Z , X , C , V , B , , , N , M ,COMM,DOT ,SLSH,ENT , | ||
90 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
91 | LCTL,LGUI,LALT,DEL , , SPC, SPC , ,LEFT,DOWN, UP ,RIGHT | ||
92 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
93 | ), | ||
94 | |||
95 | [_NUMPAD] = LAYOUT_kc( | ||
96 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
97 | , , , , , , , ,ASTR, P7 , P8 , P9 ,SLSH, , | ||
98 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
99 | , , , , , , , ,PIPE, P4 , P5 , P6 ,MINS, , | ||
100 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
101 | , , , , , , , ,COMM, P1 , P2 , P3 ,PLUS, , | ||
102 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
103 | , , , , , , , P0 ,NLCK, , , | ||
104 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
105 | ), | ||
106 | |||
107 | [_LOWER] = LAYOUT_kc( | ||
108 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
109 | ,XXXX,XXXX,XXXX,XXXX,CAPS, , ,PGUP,HOME, UP ,END ,DEL , , | ||
110 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
111 | ,SELA,LALT,LSFT,LCTL,SVE , , ,PGDN,LEFT,DOWN,RGHT,BSPC,INS , | ||
112 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
113 | ,UDO ,CUT ,CPY ,PST ,XXXX, , ,XXXX,XXXX,COMM,DOT ,SLSH, , | ||
114 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
115 | , , , , , , , , , , , | ||
116 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
117 | ), | ||
118 | |||
119 | [_RAISE] = LAYOUT_kc( | ||
120 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
121 | ,AMPR,PERC,HASH,EXLM,LPRN, , ,ASTR,RPRN, AT ,DLR ,CIRC,BSPC, | ||
122 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
123 | , 7 , 5 , 3 , 1 , 9 ,LBRC, RBRC, 8 , 0 , 2 , 4 , 6 ,BSLS, | ||
124 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
125 | , GRV,TILD,XXXX,EQL ,PLUS, , ,UNDS,MINS,COMM,DOT ,SLSH,ENT , | ||
126 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
127 | , , , , , , , , , , , | ||
128 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
129 | ), | ||
130 | |||
131 | |||
132 | [_ADJUST] = LAYOUT_kc( | ||
133 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
134 | , F1 , F2 , F3 , F4 , F5 , F6, F7, F8, F9 ,F10 , F11, F12,BSPC, | ||
135 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
136 | , , , , , , , , , CMK,QWE , , , , | ||
137 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
138 | , , , , , , , , , , , , , , | ||
139 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
140 | , , , , , , , , ,VOLD,VOLU,MUTE | ||
141 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
142 | ) | ||
143 | |||
144 | }; | ||
145 | |||
146 | const uint16_t PROGMEM fn_actions[] = { | ||
147 | [F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT) | ||
148 | ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT) | ||
149 | ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL) | ||
150 | ,[F_NUMPAD] = ACTION_LAYER_TAP_TOGGLE(_NUMPAD) | ||
151 | // ,[F_LOWER] = ACTION_LAYER_TAP_TOGGLE(LOWER) // FN1 - Momentary Layer 1 (Lower) | ||
152 | // ,[F_RAISE] = ACTION_LAYER_TAP_TOGGLE(RAISE) // FN2 - Momentary Layer 2 (Raise) | ||
153 | }; | ||
154 | |||
155 | |||
156 | |||
157 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
158 | switch (keycode) { | ||
159 | case COLEMAK: | ||
160 | if (record->event.pressed) { | ||
161 | set_single_persistent_default_layer(_COLEMAK); | ||
162 | |||
163 | } | ||
164 | return false; | ||
165 | break; | ||
166 | case QWERTY: | ||
167 | if (record->event.pressed) { | ||
168 | set_single_persistent_default_layer(_QWERTY); | ||
169 | } | ||
170 | return false; | ||
171 | break; | ||
172 | case LOWER: | ||
173 | if (record->event.pressed) { | ||
174 | layer_on(_LOWER); | ||
175 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
176 | } else { | ||
177 | layer_off(_LOWER); | ||
178 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
179 | } | ||
180 | return false; | ||
181 | break; | ||
182 | case RAISE: | ||
183 | if (record->event.pressed) { | ||
184 | layer_on(_RAISE); | ||
185 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
186 | } else { | ||
187 | layer_off(_RAISE); | ||
188 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
189 | } | ||
190 | return false; | ||
191 | break; | ||
192 | case ADJUST: | ||
193 | if (record->event.pressed) { | ||
194 | layer_on(_ADJUST); | ||
195 | } else { | ||
196 | layer_off(_ADJUST); | ||
197 | } | ||
198 | return false; | ||
199 | break; | ||
200 | } | ||
201 | return true; | ||
202 | } | ||
diff --git a/keyboards/ergotravel/keymaps/ckofy/rules.mk b/keyboards/ergotravel/keymaps/ckofy/rules.mk new file mode 100644 index 000000000..457a3d01d --- /dev/null +++ b/keyboards/ergotravel/keymaps/ckofy/rules.mk | |||
@@ -0,0 +1,3 @@ | |||
1 | ifndef QUANTUM_DIR | ||
2 | include ../../../../Makefile | ||
3 | endif | ||
diff --git a/keyboards/ergotravel/keymaps/default/config.h b/keyboards/ergotravel/keymaps/default/config.h new file mode 100644 index 000000000..abb8cfa8e --- /dev/null +++ b/keyboards/ergotravel/keymaps/default/config.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | Copyright 2017 Pierre Constantineau <jpconstantineau@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef CONFIG_USER_H | ||
19 | #define CONFIG_USER_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* Use I2C or Serial, not both */ | ||
24 | |||
25 | #define USE_SERIAL | ||
26 | // #define USE_I2C | ||
27 | |||
28 | /* Select hand configuration */ | ||
29 | |||
30 | #define MASTER_LEFT | ||
31 | // #define MASTER_RIGHT | ||
32 | // #define EE_HANDS | ||
33 | |||
34 | #undef RGBLED_NUM | ||
35 | #define RGBLIGHT_ANIMATIONS | ||
36 | #define RGBLED_NUM 12 | ||
37 | #define RGBLIGHT_HUE_STEP 8 | ||
38 | #define RGBLIGHT_SAT_STEP 8 | ||
39 | #define RGBLIGHT_VAL_STEP 8 | ||
40 | |||
41 | #endif | ||
diff --git a/keyboards/ergotravel/keymaps/default/keymap.c b/keyboards/ergotravel/keymaps/default/keymap.c new file mode 100644 index 000000000..ef168a536 --- /dev/null +++ b/keyboards/ergotravel/keymaps/default/keymap.c | |||
@@ -0,0 +1,134 @@ | |||
1 | #include QMK_KEYBOARD_H | ||
2 | |||
3 | extern keymap_config_t keymap_config; | ||
4 | |||
5 | #define _QWERTY 0 | ||
6 | #define _LOWER 1 | ||
7 | #define _RAISE 2 | ||
8 | #define _ADJUST 16 | ||
9 | |||
10 | enum custom_keycodes { | ||
11 | QWERTY = SAFE_RANGE, | ||
12 | LOWER, | ||
13 | RAISE, | ||
14 | ADJUST, | ||
15 | }; | ||
16 | |||
17 | #define KC_ KC_TRNS | ||
18 | #define _______ KC_TRNS | ||
19 | |||
20 | #define KC_LOWR LOWER | ||
21 | #define KC_RASE RAISE | ||
22 | #define KC_ADJT ADJUST | ||
23 | #define KC_RST RESET | ||
24 | #define KC_BL_S BL_STEP | ||
25 | #define KC_DBUG DEBUG | ||
26 | #define KC_RTOG RGB_TOG | ||
27 | #define KC_RMOD RGB_MOD | ||
28 | #define KC_RHUI RGB_HUI | ||
29 | #define KC_RHUD RGB_HUD | ||
30 | #define KC_RSAI RGB_SAI | ||
31 | #define KC_RSAD RGB_SAD | ||
32 | #define KC_RVAI RGB_VAI | ||
33 | #define KC_RVAD RGB_VAD | ||
34 | |||
35 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
36 | |||
37 | [_QWERTY] = LAYOUT_kc( | ||
38 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
39 | ESC , Q , W , E , R , T ,LBRC, RBRC, Y , U , I , O , P ,BSPC, | ||
40 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
41 | TAB , A , S , D , F , G , A, A, H , J , K , L ,SCLN,QUOT, | ||
42 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
43 | LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , | ||
44 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
45 | LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT | ||
46 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
47 | ), | ||
48 | |||
49 | [_LOWER] = LAYOUT_kc( | ||
50 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
51 | GRAVE, 1 , 2 , 3 , 4 , 5 , A, B, 6 , 7 , 8 , 9 , 0 ,DEL, | ||
52 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
53 | TAB , F1 , F2 , F3 , F4 , F5 , F6 , D, Y ,MINS, EQL,LBRC,RBRC,BSLS, | ||
54 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
55 | LSFT, F7 , F8 , F9 , F10, F11, F12, SPC, N , M ,COMM,DOT ,SLSH,ENT , | ||
56 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
57 | LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT | ||
58 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
59 | ), | ||
60 | |||
61 | [_RAISE] = LAYOUT_kc( | ||
62 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
63 | ESC , 1 , 2 , 3 , 4 , 5 , A, B, 6 , 7 , 8 , 9 , 0 ,BSPC, | ||
64 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
65 | TAB , Q , W , E , R , T , C , D, Y , U , I , O , P ,DEL , | ||
66 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
67 | LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , | ||
68 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
69 | LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT | ||
70 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
71 | ), | ||
72 | |||
73 | [_ADJUST] = LAYOUT_kc( | ||
74 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
75 | ESC , F1 , F2 , F3 , F4 , F5 , F6, F7, F8, F9 ,F10 , F11, F12,BSPC, | ||
76 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
77 | TAB , Q , W , E , R , T , C , D, Y , U , I , O , P ,DEL , | ||
78 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
79 | LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , | ||
80 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
81 | LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT | ||
82 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
83 | ) | ||
84 | |||
85 | }; | ||
86 | |||
87 | |||
88 | |||
89 | |||
90 | |||
91 | |||
92 | |||
93 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
94 | switch (keycode) { | ||
95 | case QWERTY: | ||
96 | if (record->event.pressed) { | ||
97 | #ifdef AUDIO_ENABLE | ||
98 | PLAY_SONG(tone_qwerty); | ||
99 | #endif | ||
100 | set_single_persistent_default_layer(_QWERTY); | ||
101 | } | ||
102 | return false; | ||
103 | break; | ||
104 | case LOWER: | ||
105 | if (record->event.pressed) { | ||
106 | layer_on(_LOWER); | ||
107 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
108 | } else { | ||
109 | layer_off(_LOWER); | ||
110 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
111 | } | ||
112 | return false; | ||
113 | break; | ||
114 | case RAISE: | ||
115 | if (record->event.pressed) { | ||
116 | layer_on(_RAISE); | ||
117 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
118 | } else { | ||
119 | layer_off(_RAISE); | ||
120 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
121 | } | ||
122 | return false; | ||
123 | break; | ||
124 | case ADJUST: | ||
125 | if (record->event.pressed) { | ||
126 | layer_on(_ADJUST); | ||
127 | } else { | ||
128 | layer_off(_ADJUST); | ||
129 | } | ||
130 | return false; | ||
131 | break; | ||
132 | } | ||
133 | return true; | ||
134 | } | ||
diff --git a/keyboards/ergotravel/keymaps/default/rules.mk b/keyboards/ergotravel/keymaps/default/rules.mk new file mode 100644 index 000000000..457a3d01d --- /dev/null +++ b/keyboards/ergotravel/keymaps/default/rules.mk | |||
@@ -0,0 +1,3 @@ | |||
1 | ifndef QUANTUM_DIR | ||
2 | include ../../../../Makefile | ||
3 | endif | ||
diff --git a/keyboards/ergotravel/keymaps/ian/config.h b/keyboards/ergotravel/keymaps/ian/config.h new file mode 100644 index 000000000..b2e8ca9b5 --- /dev/null +++ b/keyboards/ergotravel/keymaps/ian/config.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | Copyright 2017 Pierre Constantineau <jpconstantineau@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef CONFIG_USER_H | ||
19 | #define CONFIG_USER_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* Use I2C or Serial, not both */ | ||
24 | |||
25 | #define USE_SERIAL | ||
26 | // #define USE_I2C | ||
27 | |||
28 | /* Select hand configuration */ | ||
29 | |||
30 | // #define MASTER_LEFT | ||
31 | #define MASTER_RIGHT | ||
32 | // #define EE_HANDS | ||
33 | |||
34 | #undef RGBLED_NUM | ||
35 | #define RGBLIGHT_ANIMATIONS | ||
36 | #define RGBLED_NUM 12 | ||
37 | #define RGBLIGHT_HUE_STEP 8 | ||
38 | #define RGBLIGHT_SAT_STEP 8 | ||
39 | #define RGBLIGHT_VAL_STEP 8 | ||
40 | |||
41 | #endif | ||
diff --git a/keyboards/ergotravel/keymaps/ian/keymap.c b/keyboards/ergotravel/keymaps/ian/keymap.c new file mode 100644 index 000000000..fd4006d51 --- /dev/null +++ b/keyboards/ergotravel/keymaps/ian/keymap.c | |||
@@ -0,0 +1,95 @@ | |||
1 | #include QMK_KEYBOARD_H | ||
2 | |||
3 | extern keymap_config_t keymap_config; | ||
4 | |||
5 | enum custom_layers { | ||
6 | _COLEMAK, | ||
7 | _ADJUST, | ||
8 | _RAISE, | ||
9 | _LOWER, | ||
10 | _QWERTY | ||
11 | }; | ||
12 | |||
13 | |||
14 | |||
15 | #define _______ KC_TRNS | ||
16 | #define XXXXXXX KC_NO | ||
17 | #define BASELYR TO(_COLEMAK) // base layer | ||
18 | #define LOWER MO(_LOWER) // momentary lower layer | ||
19 | #define RAISE MO(_RAISE) // momentary raise layer | ||
20 | #define ADJUST MO(_ADJUST) // momentary adjust layer | ||
21 | #define QWERTY TG(_QWERTY) | ||
22 | #define LLOWER TG(_LOWER) // lock for lower layer | ||
23 | #define LRAISE TG(_RAISE) // lock for raise layer | ||
24 | #define LHALF LALT(LGUI(KC_LEFT)) // spec left half screen | ||
25 | #define TLHALF LCTL(LGUI(KC_LEFT)) // spec top left half | ||
26 | #define BLHALF LCTL(LSFT(LGUI(KC_LEFT))) // spec bottom left half | ||
27 | #define RHALF LALT(LGUI(KC_RIGHT)) // spec right half screen | ||
28 | #define TRHALF LCTL(LGUI(KC_RIGHT)) // spec top right half | ||
29 | #define BRHALF LCTL(LSFT(LGUI(KC_RIGHT))) // spec bottom right half | ||
30 | #define SAFBCK LGUI(KC_LBRC) // safari back | ||
31 | #define SAFFWD LGUI(KC_RBRC) // safari forward | ||
32 | #define CENTER LALT(LGUI(KC_C)) // spec center | ||
33 | #define FULL LALT(LGUI(KC_F)) // spec full screen | ||
34 | |||
35 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
36 | |||
37 | [_COLEMAK] = LAYOUT( | ||
38 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
39 | KC_ESC , KC_Q , KC_W , KC_F , KC_P , KC_G ,KC_LCBR, KC_RCBR, KC_J , KC_L , KC_U , KC_Y ,KC_SCLN,KC_BSPC, | ||
40 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
41 | KC_TAB , KC_A , KC_R , KC_S , KC_T , KC_D ,KC_LPRN, KC_RPRN, KC_H , KC_N , KC_E , KC_I , KC_O ,KC_QUOT, | ||
42 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
43 | KC_BSLS, KC_Z , KC_X , KC_C , KC_V , KC_B ,KC_LBRC , KC_RBRC , KC_K , KC_M ,KC_COMM, KC_DOT,KC_SLSH,KC_ENT , | ||
44 | //,------+-------+-------+-------+-------+-------+-------. .-------+-------+-------+-------+-------+-------+-------. | ||
45 | ADJUST ,KC_LCTL,KC_LALT,KC_LGUI, LOWER, KC_SPC, KC_LSFT, RAISE, KC_LEFT, KC_DOWN, KC_UP,KC_RGHT | ||
46 | //,------+-------+-------+-------+-------/-------/ \-------\-------+-------+-------+-------+-------' | ||
47 | ), | ||
48 | |||
49 | [_ADJUST] = LAYOUT( | ||
50 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
51 | BASELYR,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, RESET , | ||
52 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
53 | XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, | ||
54 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
55 | XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, | ||
56 | //|------+-------+-------+-------+-------+-------+-------. .-------+-------+-------+-------+-------+-------+-------. | ||
57 | _______,KC_F10 ,KC_F11 ,KC_F12 ,LLOWER ,XXXXXXX, XXXXXXX,LRAISE ,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX | ||
58 | //`------+-------+-------+-------+-------/-------/ \------\-------+-------+-------+-------+-------' | ||
59 | ), | ||
60 | |||
61 | [_RAISE] = LAYOUT( | ||
62 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
63 | BASELYR,KC_EXLM, KC_AT, KC_HASH, KC_DLR,KC_LCBR,XXXXXXX, XXXXXXX, KC_RCBR, TLHALF, CENTER, TRHALF, XXXXXXX, KC_BSPC, | ||
64 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
65 | KC_TILD,KC_PERC,KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,XXXXXXX, XXXXXXX, KC_RPRN, LHALF, FULL, RHALF, XXXXXXX, KC_VOLU, | ||
66 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
67 | KC_GRV, KC_MINS,KC_PLUS,KC_UNDS,KC_EQL, KC_LBRC,XXXXXXX, XXXXXXX, KC_RBRC, BLHALF, XXXXXXX, BRHALF, XXXXXXX, KC_VOLD, | ||
68 | //|-------+-------+-------+-------+-------+-------+-------. .-------+-------+-------+-------+-------+-------+-------| | ||
69 | XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,KC_TRNS,KC_SPC, KC_LSFT, KC_TRNS, XXXXXXX, KC_F14, KC_F15, KC_MUTE | ||
70 | //`-------+-------+-------+-------+-------/-------/ \------\-------+-------+-------+-------+-------' | ||
71 | ), | ||
72 | |||
73 | [_LOWER] = LAYOUT( | ||
74 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
75 | BASELYR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LCBR,XXXXXXX, XXXXXXX, KC_RCBR, KC_7, KC_8, KC_9, KC_MINS, KC_BSPC, | ||
76 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
77 | XXXXXXX, XXXXXXX, SAFBCK, XXXXXXX, SAFFWD, KC_LPRN,XXXXXXX, XXXXXXX, KC_RPRN, KC_4, KC_5, KC_6, KC_PLUS, XXXXXXX, | ||
78 | //,------+-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------+-------. | ||
79 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LBRC,XXXXXXX, XXXXXXX, KC_RBRC, KC_1, KC_2, KC_3, KC_ASTR, KC_ENT, | ||
80 | //|-------+-------+-------+-------+-------+-------+-------. .-------+-------+-------+-------+-------+-------+-------| | ||
81 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_TRNS, KC_SPC, KC_LSFT, KC_0, KC_0, KC_DOT, KC_SLASH, XXXXXXX | ||
82 | //`-------+-------+-------+-------+-------/-------/ \------\-------+-------+-------+-------+-------' | ||
83 | ) | ||
84 | |||
85 | }; | ||
86 | |||
87 | |||
88 | |||
89 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
90 | switch (keycode) { | ||
91 | |||
92 | } | ||
93 | return true; | ||
94 | } | ||
95 | |||
diff --git a/keyboards/ergotravel/keymaps/ian/rules.mk b/keyboards/ergotravel/keymaps/ian/rules.mk new file mode 100644 index 000000000..457a3d01d --- /dev/null +++ b/keyboards/ergotravel/keymaps/ian/rules.mk | |||
@@ -0,0 +1,3 @@ | |||
1 | ifndef QUANTUM_DIR | ||
2 | include ../../../../Makefile | ||
3 | endif | ||
diff --git a/keyboards/ergotravel/keymaps/jpconstantineau/config.h b/keyboards/ergotravel/keymaps/jpconstantineau/config.h new file mode 100644 index 000000000..abb8cfa8e --- /dev/null +++ b/keyboards/ergotravel/keymaps/jpconstantineau/config.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | Copyright 2017 Pierre Constantineau <jpconstantineau@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef CONFIG_USER_H | ||
19 | #define CONFIG_USER_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* Use I2C or Serial, not both */ | ||
24 | |||
25 | #define USE_SERIAL | ||
26 | // #define USE_I2C | ||
27 | |||
28 | /* Select hand configuration */ | ||
29 | |||
30 | #define MASTER_LEFT | ||
31 | // #define MASTER_RIGHT | ||
32 | // #define EE_HANDS | ||
33 | |||
34 | #undef RGBLED_NUM | ||
35 | #define RGBLIGHT_ANIMATIONS | ||
36 | #define RGBLED_NUM 12 | ||
37 | #define RGBLIGHT_HUE_STEP 8 | ||
38 | #define RGBLIGHT_SAT_STEP 8 | ||
39 | #define RGBLIGHT_VAL_STEP 8 | ||
40 | |||
41 | #endif | ||
diff --git a/keyboards/ergotravel/keymaps/jpconstantineau/keymap.c b/keyboards/ergotravel/keymaps/jpconstantineau/keymap.c new file mode 100644 index 000000000..b2374b711 --- /dev/null +++ b/keyboards/ergotravel/keymaps/jpconstantineau/keymap.c | |||
@@ -0,0 +1,129 @@ | |||
1 | #include QMK_KEYBOARD_H | ||
2 | |||
3 | extern keymap_config_t keymap_config; | ||
4 | |||
5 | #define _QWERTY 0 | ||
6 | #define _LOWER 1 | ||
7 | #define _RAISE 2 | ||
8 | #define _ADJUST 16 | ||
9 | |||
10 | enum custom_keycodes { | ||
11 | QWERTY = SAFE_RANGE, | ||
12 | LOWER, | ||
13 | RAISE, | ||
14 | ADJUST, | ||
15 | }; | ||
16 | |||
17 | #define KC_ KC_TRNS | ||
18 | #define _______ KC_TRNS | ||
19 | |||
20 | #define KC_LOWR LOWER | ||
21 | #define KC_RASE RAISE | ||
22 | #define KC_ADJT ADJUST | ||
23 | #define KC_RST RESET | ||
24 | #define KC_BL_S BL_STEP | ||
25 | #define KC_DBUG DEBUG | ||
26 | #define KC_RTOG RGB_TOG | ||
27 | #define KC_RMOD RGB_MOD | ||
28 | #define KC_RHUI RGB_HUI | ||
29 | #define KC_RHUD RGB_HUD | ||
30 | #define KC_RSAI RGB_SAI | ||
31 | #define KC_RSAD RGB_SAD | ||
32 | #define KC_RVAI RGB_VAI | ||
33 | #define KC_RVAD RGB_VAD | ||
34 | |||
35 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
36 | |||
37 | [_QWERTY] = LAYOUT_kc( | ||
38 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
39 | ESC , Q , W , E , R , T ,LBRC, RBRC, Y , U , I , O , P ,BSPC, | ||
40 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
41 | TAB , A , S , D , F , G , A, A, H , J , K , L ,SCLN,QUOT, | ||
42 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
43 | LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , | ||
44 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
45 | LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT | ||
46 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
47 | ), | ||
48 | |||
49 | [_LOWER] = LAYOUT_kc( | ||
50 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
51 | GRAVE, 1 , 2 , 3 , 4 , 5 , A, B, 6 , 7 , 8 , 9 , 0 ,DEL, | ||
52 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
53 | TAB , F1 , F2 , F3 , F4 , F5 , F6 , D, Y ,MINS, EQL,LBRC,RBRC,BSLS, | ||
54 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
55 | LSFT, F7 , F8 , F9 , F10, F11, F12, SPC, N , M ,COMM,DOT ,SLSH,ENT , | ||
56 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
57 | LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT | ||
58 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
59 | ), | ||
60 | |||
61 | [_RAISE] = LAYOUT_kc( | ||
62 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
63 | ESC , 1 , 2 , 3 , 4 , 5 , A, B, 6 , 7 , 8 , 9 , 0 ,BSPC, | ||
64 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
65 | TAB , Q , W , E , R , T , C , D, Y , U , I , O , P ,DEL , | ||
66 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
67 | LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , | ||
68 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
69 | LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT | ||
70 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
71 | ), | ||
72 | |||
73 | [_ADJUST] = LAYOUT_kc( | ||
74 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
75 | ESC , F1 , F2 , F3 , F4 , F5 , F6, F7, F8, F9 ,F10 , F11, F12,BSPC, | ||
76 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
77 | TAB , Q , W , E , R , T , C , D, Y , U , I , O , P ,DEL , | ||
78 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
79 | LSFT, Z , X , C , V , B , A, SPC, N , M ,COMM,DOT ,SLSH,ENT , | ||
80 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
81 | LCTL,LGUI,LALT,ADJT,LOWR,SPC, SPC, RASE,LEFT, UP ,DOWN,RIGHT | ||
82 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
83 | ) | ||
84 | |||
85 | }; | ||
86 | |||
87 | |||
88 | |||
89 | |||
90 | |||
91 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
92 | switch (keycode) { | ||
93 | case QWERTY: | ||
94 | if (record->event.pressed) { | ||
95 | set_single_persistent_default_layer(_QWERTY); | ||
96 | } | ||
97 | return false; | ||
98 | break; | ||
99 | case LOWER: | ||
100 | if (record->event.pressed) { | ||
101 | layer_on(_LOWER); | ||
102 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
103 | } else { | ||
104 | layer_off(_LOWER); | ||
105 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
106 | } | ||
107 | return false; | ||
108 | break; | ||
109 | case RAISE: | ||
110 | if (record->event.pressed) { | ||
111 | layer_on(_RAISE); | ||
112 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
113 | } else { | ||
114 | layer_off(_RAISE); | ||
115 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
116 | } | ||
117 | return false; | ||
118 | break; | ||
119 | case ADJUST: | ||
120 | if (record->event.pressed) { | ||
121 | layer_on(_ADJUST); | ||
122 | } else { | ||
123 | layer_off(_ADJUST); | ||
124 | } | ||
125 | return false; | ||
126 | break; | ||
127 | } | ||
128 | return true; | ||
129 | } | ||
diff --git a/keyboards/ergotravel/keymaps/jpconstantineau/rules.mk b/keyboards/ergotravel/keymaps/jpconstantineau/rules.mk new file mode 100644 index 000000000..457a3d01d --- /dev/null +++ b/keyboards/ergotravel/keymaps/jpconstantineau/rules.mk | |||
@@ -0,0 +1,3 @@ | |||
1 | ifndef QUANTUM_DIR | ||
2 | include ../../../../Makefile | ||
3 | endif | ||
diff --git a/keyboards/ergotravel/keymaps/viet/config.h b/keyboards/ergotravel/keymaps/viet/config.h new file mode 100644 index 000000000..24e95b2b9 --- /dev/null +++ b/keyboards/ergotravel/keymaps/viet/config.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | Copyright 2017 Pierre Constantineau <jpconstantineau@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef CONFIG_USER_H | ||
19 | #define CONFIG_USER_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* Use I2C or Serial, not both */ | ||
24 | |||
25 | #define USE_SERIAL | ||
26 | // #define USE_I2C | ||
27 | |||
28 | /* Select hand configuration */ | ||
29 | |||
30 | //#define MASTER_LEFT | ||
31 | #define MASTER_RIGHT | ||
32 | // #define EE_HANDS | ||
33 | |||
34 | #undef RGBLED_NUM | ||
35 | #define RGBLIGHT_ANIMATIONS | ||
36 | #define RGBLED_NUM 26 | ||
37 | #define RGBLIGHT_HUE_STEP 20 | ||
38 | #define RGBLIGHT_SAT_STEP 20 | ||
39 | #define RGBLIGHT_VAL_STEP 20 | ||
40 | #define RGBLIGHT_LIMIT_VAL 220 | ||
41 | |||
42 | #endif | ||
diff --git a/keyboards/ergotravel/keymaps/viet/keymap.c b/keyboards/ergotravel/keymaps/viet/keymap.c new file mode 100644 index 000000000..0e3ec074c --- /dev/null +++ b/keyboards/ergotravel/keymaps/viet/keymap.c | |||
@@ -0,0 +1,327 @@ | |||
1 | #include "ergotravel.h" | ||
2 | #include "action_layer.h" | ||
3 | #include "eeconfig.h" | ||
4 | #include "mousekey.h" | ||
5 | #include "process_unicode.h" | ||
6 | extern keymap_config_t keymap_config; | ||
7 | |||
8 | #define _QWERTY 0 | ||
9 | #define _NUMBERS 1 | ||
10 | #define _SYMBOLS 2 | ||
11 | #define _CODING 3 | ||
12 | #define _NAVIGATION 4 | ||
13 | #define _ADJUST 16 | ||
14 | |||
15 | enum custom_keycodes { | ||
16 | QWERTY = SAFE_RANGE, | ||
17 | ADJUST, | ||
18 | CODING_SPACE, | ||
19 | NUMBERS_SPACE, | ||
20 | SYMBOLS_SPACE, | ||
21 | NAVIGATE_SPACE, | ||
22 | TABLE_FLIP, | ||
23 | RESET_TABLE, | ||
24 | SHRUG, | ||
25 | LOOK_OF_DISAPPROVAL | ||
26 | }; | ||
27 | |||
28 | #define KC_ KC_TRNS | ||
29 | #define _______ KC_TRNS | ||
30 | |||
31 | #define KC_ADJT MO(_ADJUST) | ||
32 | #define KC_RST RESET | ||
33 | #define KC_BL_S BL_STEP | ||
34 | #define KC_DBUG DEBUG | ||
35 | #define KC_RTOG RGB_TOG | ||
36 | #define KC_RMOD RGB_MOD | ||
37 | #define KC_RHUI RGB_HUI | ||
38 | #define KC_RHUD RGB_HUD | ||
39 | #define KC_RSAI RGB_SAI | ||
40 | #define KC_RSAD RGB_SAD | ||
41 | #define KC_RVAI RGB_VAI | ||
42 | #define KC_RVAD RGB_VAD | ||
43 | |||
44 | #define KC_RSEN MT(MOD_RSFT, KC_ENT) // Tap for enter, hold for right shift | ||
45 | |||
46 | #define KC_LCCA MT(MOD_LCTL, KC_CAPS) // Tap for caps lock, hold for left control | ||
47 | #define KC_SHDE MT(MOD_LSFT, KC_DEL) // Tap for delete, hold for left shift | ||
48 | |||
49 | #define KC_NAVI MO(_NAVIGATION) | ||
50 | |||
51 | #define KC_COSP CODING_SPACE | ||
52 | #define KC_NUSP NUMBERS_SPACE | ||
53 | #define KC_SYSP SYMBOLS_SPACE | ||
54 | #define KC_NASP NAVIGATE_SPACE | ||
55 | |||
56 | #define KC_FLIP TABLE_FLIP | ||
57 | #define KC_TSET RESET_TABLE | ||
58 | #define KC_SRUG SHRUG | ||
59 | #define KC_DISA LOOK_OF_DISAPPROVAL | ||
60 | #define KC_RST RESET | ||
61 | |||
62 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
63 | |||
64 | [_QWERTY] = LAYOUT_kc( | ||
65 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
66 | TAB , Q , W , E , R , T ,HOME, PGUP, Y , U , I , O , P ,BSPC, | ||
67 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
68 | LCCA, A , S , D , F , G ,END , PGDN, H , J , K , L ,SCLN,QUOT, | ||
69 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
70 | SHDE, Z , X , C , V , B ,LGUI, RALT, N , M ,COMM,DOT ,SLSH,RSEN, | ||
71 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
72 | ESC ,ADJT,LALT,ENT ,NUSP,NASP, SYSP,COSP,RCTL,NAVI,ADJT,DEL | ||
73 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
74 | ), | ||
75 | |||
76 | [_NUMBERS] = LAYOUT_kc( | ||
77 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
78 | GRAVE, 1 , 2 , 3 , 4 , 5 ,MPLY, VOLU, 6 , 7 , 8 , 9 , 0 , , | ||
79 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
80 | , , , , , ,MNXT, VOLD,FLIP,TSET,SRUG,DISA, , , | ||
81 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
82 | , , , , , , , , , , , , , , | ||
83 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
84 | , , , , , , , , , , , | ||
85 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
86 | ), | ||
87 | |||
88 | [_SYMBOLS] = LAYOUT_kc( | ||
89 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
90 | GRAVE,EXLM, AT ,HASH,DLR ,PERC,MPLY, VOLU,CIRC,AMPR,ASTR,LPRN,RPRN,BSLS, | ||
91 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
92 | , , , , , ,MNXT, VOLD, , , , , , , | ||
93 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
94 | , , , , , , , , , , , , , , | ||
95 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
96 | , , , , , , , , , , , | ||
97 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
98 | ), | ||
99 | |||
100 | [_CODING] = LAYOUT_kc( | ||
101 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
102 | , , ,LCBR,RCBR, ,MPLY, VOLU, ,AMPR,PIPE,DLR , , , | ||
103 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
104 | , , ,LPRN,RPRN, ,MNXT, VOLD, ,UNDS,MINS,ASTR, , , | ||
105 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
106 | , , ,LBRC,RBRC, , , , ,PLUS,EQL , , , , | ||
107 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
108 | , , , , , , , , , , , | ||
109 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
110 | ), | ||
111 | |||
112 | [_NAVIGATION] = LAYOUT_kc( | ||
113 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
114 | , , , UP , , ,MPLY, VOLU,WH_U,BTN1,MS_U,BTN1, , , | ||
115 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
116 | , ,LEFT,DOWN,RGHT, ,MNXT, VOLD,WH_D,MS_L,MS_D,MS_R, , , | ||
117 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
118 | , , , , , , , , , , , , , , | ||
119 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
120 | , , , , , , , , , , , | ||
121 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
122 | ), | ||
123 | |||
124 | [_ADJUST] = LAYOUT_kc( | ||
125 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
126 | F1 ,F2 ,F3 ,F4 ,F5 ,F6 , , ,F7 ,F8 ,F9 ,F10 ,F11 ,F12 , | ||
127 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
128 | ,RTOG,RVAI,RHUI,RSAI, , , , , , , , , , | ||
129 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
130 | ,RMOD,RVAD,RHUD,RSAD, , , ,RST , , , , , , | ||
131 | //|----+----+----+----+----+----+----. .----+----+----+----+----+----+----| | ||
132 | , , , , , , , , , , , | ||
133 | //`----+----+----+--+-+----/----/ \----\----+----+----+----+----' | ||
134 | ) | ||
135 | |||
136 | }; | ||
137 | |||
138 | |||
139 | #ifdef AUDIO_ENABLE | ||
140 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
141 | #endif | ||
142 | |||
143 | void persistent_default_layer_set(uint16_t default_layer) { | ||
144 | eeconfig_update_default_layer(default_layer); | ||
145 | default_layer_set(default_layer); | ||
146 | } | ||
147 | |||
148 | uint16_t custom_lt_timer; | ||
149 | keypos_t prv_key_pressed; | ||
150 | // Runs just one time when the keyboard initializes. | ||
151 | void matrix_init_user(void) { | ||
152 | // set_unicode_input_mode(UC_LNX); // Linux | ||
153 | set_unicode_input_mode(UC_OSX); // Mac OSX | ||
154 | // set_unicode_input_mode(UC_WIN); // Windows (with registry key, see wiki) | ||
155 | //set_unicode_input_mode(UC_WINC); // Windows (with WinCompose, see wiki) | ||
156 | }; | ||
157 | |||
158 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
159 | |||
160 | if(record->event.pressed) prv_key_pressed = record->event.key; | ||
161 | #define IS_KEYPOS_SAME(keyone,keytwo) ((keyone.col==keytwo.col)&&(keyone.row==keytwo.row)) | ||
162 | #define ANOTHER_KEY_PRESSED (!IS_KEYPOS_SAME(prv_key_pressed, record->event.key)) | ||
163 | |||
164 | inline void tap(uint16_t keycode) { | ||
165 | register_code(keycode); | ||
166 | unregister_code(keycode); | ||
167 | }; | ||
168 | |||
169 | inline void swapInput(void) { | ||
170 | register_code(KC_LGUI); | ||
171 | tap(KC_SPC); | ||
172 | unregister_code(KC_LGUI); | ||
173 | }; | ||
174 | |||
175 | switch (keycode) { | ||
176 | case QWERTY: | ||
177 | if (record->event.pressed) { | ||
178 | #ifdef AUDIO_ENABLE | ||
179 | PLAY_SONG(tone_qwerty); | ||
180 | #endif | ||
181 | persistent_default_layer_set(1UL<<_QWERTY); | ||
182 | } | ||
183 | return false; | ||
184 | break; | ||
185 | case CODING_SPACE: | ||
186 | if (record->event.pressed) { | ||
187 | custom_lt_timer = timer_read(); | ||
188 | layer_on(_CODING); | ||
189 | } else { | ||
190 | layer_off(_CODING); | ||
191 | if (timer_elapsed(custom_lt_timer)<150 && (!ANOTHER_KEY_PRESSED)) { | ||
192 | register_code(KC_SPC); | ||
193 | unregister_code(KC_SPC); | ||
194 | } | ||
195 | } | ||
196 | return false; | ||
197 | break; | ||
198 | case NUMBERS_SPACE: | ||
199 | if (record->event.pressed) { | ||
200 | custom_lt_timer = timer_read(); | ||
201 | layer_on(_NUMBERS); | ||
202 | } else { | ||
203 | layer_off(_NUMBERS); | ||
204 | if (timer_elapsed(custom_lt_timer)<150 && (!ANOTHER_KEY_PRESSED)) { | ||
205 | register_code(KC_SPC); | ||
206 | unregister_code(KC_SPC); | ||
207 | } | ||
208 | } | ||
209 | return false; | ||
210 | break; | ||
211 | case SYMBOLS_SPACE: | ||
212 | if (record->event.pressed) { | ||
213 | custom_lt_timer = timer_read(); | ||
214 | layer_on(_SYMBOLS); | ||
215 | } else { | ||
216 | layer_off(_SYMBOLS); | ||
217 | if (timer_elapsed(custom_lt_timer)<150 && (!ANOTHER_KEY_PRESSED)) { | ||
218 | register_code(KC_SPC); | ||
219 | unregister_code(KC_SPC); | ||
220 | } | ||
221 | } | ||
222 | return false; | ||
223 | break; | ||
224 | case NAVIGATE_SPACE: | ||
225 | if (record->event.pressed) { | ||
226 | custom_lt_timer = timer_read(); | ||
227 | layer_on(_NAVIGATION); | ||
228 | } else { | ||
229 | layer_off(_NAVIGATION); | ||
230 | if (timer_elapsed(custom_lt_timer)<150 && (!ANOTHER_KEY_PRESSED)) { | ||
231 | register_code(KC_SPC); | ||
232 | unregister_code(KC_SPC); | ||
233 | } | ||
234 | } | ||
235 | return false; | ||
236 | break; | ||
237 | case TABLE_FLIP: | ||
238 | if (record->event.pressed) { | ||
239 | swapInput(); | ||
240 | |||
241 | register_code(KC_RSFT); | ||
242 | tap(KC_9); | ||
243 | unregister_code(KC_RSFT); | ||
244 | process_unicode((0x256F|QK_UNICODE), record); // Arm | ||
245 | process_unicode((0x00B0|QK_UNICODE), record); // Eye | ||
246 | process_unicode((0x25A1|QK_UNICODE), record); // Mouth | ||
247 | process_unicode((0x00B0|QK_UNICODE), record); // Eye | ||
248 | register_code(KC_RSFT); | ||
249 | tap(KC_0); | ||
250 | unregister_code(KC_RSFT); | ||
251 | process_unicode((0x256F|QK_UNICODE), record); // Arm | ||
252 | tap(KC_SPC); | ||
253 | process_unicode((0x0361|QK_UNICODE), record); // Flippy | ||
254 | tap(KC_SPC); | ||
255 | process_unicode((0x253B|QK_UNICODE), record); // Table | ||
256 | process_unicode((0x2501|QK_UNICODE), record); // Table | ||
257 | process_unicode((0x253B|QK_UNICODE), record); // Table | ||
258 | |||
259 | swapInput(); | ||
260 | } | ||
261 | return false; | ||
262 | break; | ||
263 | case RESET_TABLE: // ┬──┬ ノ( ゜-゜ノ) | ||
264 | if (record->event.pressed) { | ||
265 | swapInput(); | ||
266 | |||
267 | process_unicode((0x252C|QK_UNICODE), record); // Table | ||
268 | process_unicode((0x2500|QK_UNICODE), record); // Table | ||
269 | process_unicode((0x2500|QK_UNICODE), record); // Table | ||
270 | process_unicode((0x252C|QK_UNICODE), record); // Table | ||
271 | tap(KC_SPC); | ||
272 | process_unicode((0x30CE|QK_UNICODE), record); // Arm | ||
273 | register_code(KC_RSFT); | ||
274 | tap(KC_9); | ||
275 | unregister_code(KC_RSFT); | ||
276 | tap(KC_SPC); | ||
277 | process_unicode((0x309C|QK_UNICODE), record); // Eye | ||
278 | tap(KC_MINS); | ||
279 | process_unicode((0x309C|QK_UNICODE), record); // Eye | ||
280 | process_unicode((0x30CE|QK_UNICODE), record); // Arm | ||
281 | register_code(KC_RSFT); | ||
282 | tap(KC_0); | ||
283 | unregister_code(KC_RSFT); | ||
284 | |||
285 | swapInput(); | ||
286 | } | ||
287 | return false; | ||
288 | break; | ||
289 | case SHRUG: // ¯\_(ツ)_/¯ | ||
290 | if (record->event.pressed) { | ||
291 | swapInput(); | ||
292 | |||
293 | process_unicode((0x00AF|QK_UNICODE), record); // Hand | ||
294 | tap(KC_BSLS); // Arm | ||
295 | register_code(KC_RSFT); | ||
296 | tap(KC_UNDS); // Arm | ||
297 | tap(KC_LPRN); // Head | ||
298 | unregister_code(KC_RSFT); | ||
299 | process_unicode((0x30C4|QK_UNICODE), record); // Face | ||
300 | register_code(KC_RSFT); | ||
301 | tap(KC_RPRN); // Head | ||
302 | tap(KC_UNDS); // Arm | ||
303 | unregister_code(KC_RSFT); | ||
304 | tap(KC_SLSH); // Arm | ||
305 | process_unicode((0x00AF|QK_UNICODE), record); // Hand | ||
306 | |||
307 | swapInput(); | ||
308 | } | ||
309 | return false; | ||
310 | break; | ||
311 | case LOOK_OF_DISAPPROVAL: // ಠ_ಠ | ||
312 | if(record->event.pressed){ | ||
313 | swapInput(); | ||
314 | |||
315 | process_unicode((0x0CA0|QK_UNICODE), record); // Eye | ||
316 | register_code(KC_RSFT); | ||
317 | tap(KC_MINS); | ||
318 | unregister_code(KC_RSFT); | ||
319 | process_unicode((0x0CA0|QK_UNICODE), record); // Eye | ||
320 | |||
321 | swapInput(); | ||
322 | } | ||
323 | return false; | ||
324 | break; | ||
325 | } | ||
326 | return true; | ||
327 | } | ||
diff --git a/keyboards/ergotravel/keymaps/viet/rules.mk b/keyboards/ergotravel/keymaps/viet/rules.mk new file mode 100644 index 000000000..da4752731 --- /dev/null +++ b/keyboards/ergotravel/keymaps/viet/rules.mk | |||
@@ -0,0 +1,7 @@ | |||
1 | RGBLIGHT_ENABLE = yes | ||
2 | BACKLIGHT_ENABLE = no | ||
3 | UNICODE_ENABLE = yes | ||
4 | |||
5 | ifndef QUANTUM_DIR | ||
6 | include ../../../../Makefile | ||
7 | endif | ||
diff --git a/keyboards/ergotravel/matrix.c b/keyboards/ergotravel/matrix.c new file mode 100644 index 000000000..4061924dc --- /dev/null +++ b/keyboards/ergotravel/matrix.c | |||
@@ -0,0 +1,482 @@ | |||
1 | /* | ||
2 | Copyright 2018 Pierre Constantineau | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * scan matrix | ||
20 | */ | ||
21 | #include <stdint.h> | ||
22 | #include <stdbool.h> | ||
23 | #include <avr/io.h> | ||
24 | #include "wait.h" | ||
25 | #include "print.h" | ||
26 | #include "debug.h" | ||
27 | #include "util.h" | ||
28 | #include "matrix.h" | ||
29 | #include "split_util.h" | ||
30 | #include "pro_micro.h" | ||
31 | #include "config.h" | ||
32 | #include "timer.h" | ||
33 | #include "backlight.h" | ||
34 | |||
35 | #ifdef USE_I2C | ||
36 | # include "i2c.h" | ||
37 | #else // USE_SERIAL | ||
38 | # include "serial.h" | ||
39 | #endif | ||
40 | |||
41 | #ifndef DEBOUNCING_DELAY | ||
42 | # define DEBOUNCING_DELAY 5 | ||
43 | #endif | ||
44 | |||
45 | #if (DEBOUNCING_DELAY > 0) | ||
46 | static uint16_t debouncing_time; | ||
47 | static bool debouncing = false; | ||
48 | #endif | ||
49 | |||
50 | #if (MATRIX_COLS <= 8) | ||
51 | # define print_matrix_header() print("\nr/c 01234567\n") | ||
52 | # define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) | ||
53 | # define matrix_bitpop(i) bitpop(matrix[i]) | ||
54 | # define ROW_SHIFTER ((uint8_t)1) | ||
55 | #else | ||
56 | # error "Currently only supports 8 COLS" | ||
57 | #endif | ||
58 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
59 | |||
60 | #define ERROR_DISCONNECT_COUNT 5 | ||
61 | |||
62 | #define SERIAL_LED_ADDR 0x00 | ||
63 | |||
64 | #define ROWS_PER_HAND (MATRIX_ROWS/2) | ||
65 | |||
66 | static uint8_t error_count = 0; | ||
67 | |||
68 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||
69 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
70 | |||
71 | /* matrix state(1:on, 0:off) */ | ||
72 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
73 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
74 | |||
75 | #if (DIODE_DIRECTION == COL2ROW) | ||
76 | static void init_cols(void); | ||
77 | static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); | ||
78 | static void unselect_rows(void); | ||
79 | static void select_row(uint8_t row); | ||
80 | static void unselect_row(uint8_t row); | ||
81 | #elif (DIODE_DIRECTION == ROW2COL) | ||
82 | static void init_rows(void); | ||
83 | static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); | ||
84 | static void unselect_cols(void); | ||
85 | static void unselect_col(uint8_t col); | ||
86 | static void select_col(uint8_t col); | ||
87 | #endif | ||
88 | |||
89 | |||
90 | __attribute__ ((weak)) | ||
91 | void matrix_init_kb(void) { | ||
92 | matrix_init_user(); | ||
93 | } | ||
94 | |||
95 | __attribute__ ((weak)) | ||
96 | void matrix_scan_kb(void) { | ||
97 | matrix_scan_user(); | ||
98 | } | ||
99 | |||
100 | __attribute__ ((weak)) | ||
101 | void matrix_init_user(void) { | ||
102 | } | ||
103 | |||
104 | __attribute__ ((weak)) | ||
105 | void matrix_scan_user(void) { | ||
106 | } | ||
107 | |||
108 | inline | ||
109 | uint8_t matrix_rows(void) | ||
110 | { | ||
111 | return MATRIX_ROWS; | ||
112 | } | ||
113 | |||
114 | inline | ||
115 | uint8_t matrix_cols(void) | ||
116 | { | ||
117 | return MATRIX_COLS; | ||
118 | } | ||
119 | |||
120 | void matrix_init(void) | ||
121 | { | ||
122 | debug_enable = true; | ||
123 | debug_matrix = true; | ||
124 | debug_mouse = true; | ||
125 | // initialize row and col | ||
126 | unselect_rows(); | ||
127 | init_cols(); | ||
128 | |||
129 | TX_RX_LED_INIT; | ||
130 | |||
131 | // initialize matrix state: all keys off | ||
132 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
133 | matrix[i] = 0; | ||
134 | matrix_debouncing[i] = 0; | ||
135 | } | ||
136 | |||
137 | matrix_init_quantum(); | ||
138 | |||
139 | } | ||
140 | |||
141 | uint8_t _matrix_scan(void) | ||
142 | { | ||
143 | int offset = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
144 | #if (DIODE_DIRECTION == COL2ROW) | ||
145 | // Set row, read cols | ||
146 | for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { | ||
147 | # if (DEBOUNCING_DELAY > 0) | ||
148 | bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row); | ||
149 | |||
150 | if (matrix_changed) { | ||
151 | debouncing = true; | ||
152 | debouncing_time = timer_read(); | ||
153 | PORTD ^= (1 << 2); | ||
154 | } | ||
155 | |||
156 | # else | ||
157 | read_cols_on_row(matrix+offset, current_row); | ||
158 | # endif | ||
159 | |||
160 | } | ||
161 | |||
162 | #elif (DIODE_DIRECTION == ROW2COL) | ||
163 | // Set col, read rows | ||
164 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { | ||
165 | # if (DEBOUNCING_DELAY > 0) | ||
166 | bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col); | ||
167 | if (matrix_changed) { | ||
168 | debouncing = true; | ||
169 | debouncing_time = timer_read(); | ||
170 | } | ||
171 | # else | ||
172 | read_rows_on_col(matrix+offset, current_col); | ||
173 | # endif | ||
174 | |||
175 | } | ||
176 | #endif | ||
177 | |||
178 | # if (DEBOUNCING_DELAY > 0) | ||
179 | if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { | ||
180 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
181 | matrix[i+offset] = matrix_debouncing[i+offset]; | ||
182 | } | ||
183 | debouncing = false; | ||
184 | } | ||
185 | # endif | ||
186 | |||
187 | return 1; | ||
188 | } | ||
189 | |||
190 | #ifdef USE_I2C | ||
191 | |||
192 | // Get rows from other half over i2c | ||
193 | int i2c_transaction(void) { | ||
194 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
195 | |||
196 | int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); | ||
197 | if (err) goto i2c_error; | ||
198 | |||
199 | // start of matrix stored at 0x00 | ||
200 | err = i2c_master_write(0x00); | ||
201 | if (err) goto i2c_error; | ||
202 | |||
203 | #ifdef BACKLIGHT_ENABLE | ||
204 | // Write backlight level for slave to read | ||
205 | err = i2c_master_write(get_backlight_level()); | ||
206 | #else | ||
207 | // Write zero, so our byte index is the same | ||
208 | err = i2c_master_write(0x00); | ||
209 | #endif | ||
210 | if (err) goto i2c_error; | ||
211 | |||
212 | // Start read | ||
213 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); | ||
214 | if (err) goto i2c_error; | ||
215 | |||
216 | if (!err) { | ||
217 | int i; | ||
218 | for (i = 0; i < ROWS_PER_HAND-1; ++i) { | ||
219 | matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); | ||
220 | } | ||
221 | matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); | ||
222 | i2c_master_stop(); | ||
223 | } else { | ||
224 | i2c_error: // the cable is disconnceted, or something else went wrong | ||
225 | i2c_reset_state(); | ||
226 | return err; | ||
227 | } | ||
228 | |||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | #else // USE_SERIAL | ||
233 | |||
234 | int serial_transaction(void) { | ||
235 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
236 | |||
237 | if (serial_update_buffers()) { | ||
238 | return 1; | ||
239 | } | ||
240 | |||
241 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
242 | matrix[slaveOffset+i] = serial_slave_buffer[i]; | ||
243 | } | ||
244 | |||
245 | #ifdef BACKLIGHT_ENABLE | ||
246 | // Write backlight level for slave to read | ||
247 | serial_master_buffer[SERIAL_LED_ADDR] = get_backlight_level(); | ||
248 | #endif | ||
249 | return 0; | ||
250 | } | ||
251 | #endif | ||
252 | |||
253 | uint8_t matrix_scan(void) | ||
254 | { | ||
255 | uint8_t ret = _matrix_scan(); | ||
256 | |||
257 | #ifdef USE_I2C | ||
258 | if( i2c_transaction() ) { | ||
259 | #else // USE_SERIAL | ||
260 | if( serial_transaction() ) { | ||
261 | #endif | ||
262 | // turn on the indicator led when halves are disconnected | ||
263 | TXLED1; | ||
264 | |||
265 | error_count++; | ||
266 | |||
267 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
268 | // reset other half if disconnected | ||
269 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
270 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
271 | matrix[slaveOffset+i] = 0; | ||
272 | } | ||
273 | } | ||
274 | } else { | ||
275 | // turn off the indicator led on no error | ||
276 | TXLED0; | ||
277 | error_count = 0; | ||
278 | } | ||
279 | matrix_scan_quantum(); | ||
280 | return ret; | ||
281 | } | ||
282 | |||
283 | void matrix_slave_scan(void) { | ||
284 | _matrix_scan(); | ||
285 | |||
286 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; | ||
287 | |||
288 | #ifdef USE_I2C | ||
289 | #ifdef BACKLIGHT_ENABLE | ||
290 | // Read backlight level sent from master and update level on slave | ||
291 | backlight_set(i2c_slave_buffer[0]); | ||
292 | #endif | ||
293 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
294 | i2c_slave_buffer[i+1] = matrix[offset+i]; | ||
295 | } | ||
296 | #else // USE_SERIAL | ||
297 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
298 | serial_slave_buffer[i] = matrix[offset+i]; | ||
299 | } | ||
300 | |||
301 | #ifdef BACKLIGHT_ENABLE | ||
302 | // Read backlight level sent from master and update level on slave | ||
303 | backlight_set(serial_master_buffer[SERIAL_LED_ADDR]); | ||
304 | #endif | ||
305 | #endif | ||
306 | } | ||
307 | |||
308 | bool matrix_is_modified(void) | ||
309 | { | ||
310 | if (debouncing) return false; | ||
311 | return true; | ||
312 | } | ||
313 | |||
314 | inline | ||
315 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
316 | { | ||
317 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
318 | } | ||
319 | |||
320 | inline | ||
321 | matrix_row_t matrix_get_row(uint8_t row) | ||
322 | { | ||
323 | return matrix[row]; | ||
324 | } | ||
325 | |||
326 | void matrix_print(void) | ||
327 | { | ||
328 | print("\nr/c 0123456789ABCDEF\n"); | ||
329 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
330 | phex(row); print(": "); | ||
331 | pbin_reverse16(matrix_get_row(row)); | ||
332 | print("\n"); | ||
333 | } | ||
334 | } | ||
335 | |||
336 | uint8_t matrix_key_count(void) | ||
337 | { | ||
338 | uint8_t count = 0; | ||
339 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
340 | count += bitpop16(matrix[i]); | ||
341 | } | ||
342 | return count; | ||
343 | } | ||
344 | |||
345 | #if (DIODE_DIRECTION == COL2ROW) | ||
346 | |||
347 | static void init_cols(void) | ||
348 | { | ||
349 | for(uint8_t x = 0; x < MATRIX_COLS; x++) { | ||
350 | uint8_t pin = col_pins[x]; | ||
351 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
352 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
353 | } | ||
354 | } | ||
355 | |||
356 | static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) | ||
357 | { | ||
358 | // Store last value of row prior to reading | ||
359 | matrix_row_t last_row_value = current_matrix[current_row]; | ||
360 | |||
361 | // Clear data in matrix row | ||
362 | current_matrix[current_row] = 0; | ||
363 | |||
364 | // Select row and wait for row selecton to stabilize | ||
365 | select_row(current_row); | ||
366 | wait_us(30); | ||
367 | |||
368 | // For each col... | ||
369 | for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { | ||
370 | |||
371 | // Select the col pin to read (active low) | ||
372 | uint8_t pin = col_pins[col_index]; | ||
373 | uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); | ||
374 | |||
375 | // Populate the matrix row with the state of the col pin | ||
376 | current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); | ||
377 | } | ||
378 | |||
379 | // Unselect row | ||
380 | unselect_row(current_row); | ||
381 | |||
382 | return (last_row_value != current_matrix[current_row]); | ||
383 | } | ||
384 | |||
385 | static void select_row(uint8_t row) | ||
386 | { | ||
387 | uint8_t pin = row_pins[row]; | ||
388 | _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT | ||
389 | _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW | ||
390 | } | ||
391 | |||
392 | static void unselect_row(uint8_t row) | ||
393 | { | ||
394 | uint8_t pin = row_pins[row]; | ||
395 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
396 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
397 | } | ||
398 | |||
399 | static void unselect_rows(void) | ||
400 | { | ||
401 | for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { | ||
402 | uint8_t pin = row_pins[x]; | ||
403 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
404 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
405 | } | ||
406 | } | ||
407 | |||
408 | #elif (DIODE_DIRECTION == ROW2COL) | ||
409 | |||
410 | static void init_rows(void) | ||
411 | { | ||
412 | for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { | ||
413 | uint8_t pin = row_pins[x]; | ||
414 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
415 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
416 | } | ||
417 | } | ||
418 | |||
419 | static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) | ||
420 | { | ||
421 | bool matrix_changed = false; | ||
422 | |||
423 | // Select col and wait for col selecton to stabilize | ||
424 | select_col(current_col); | ||
425 | wait_us(30); | ||
426 | |||
427 | // For each row... | ||
428 | for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) | ||
429 | { | ||
430 | |||
431 | // Store last value of row prior to reading | ||
432 | matrix_row_t last_row_value = current_matrix[row_index]; | ||
433 | |||
434 | // Check row pin state | ||
435 | if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0) | ||
436 | { | ||
437 | // Pin LO, set col bit | ||
438 | current_matrix[row_index] |= (ROW_SHIFTER << current_col); | ||
439 | } | ||
440 | else | ||
441 | { | ||
442 | // Pin HI, clear col bit | ||
443 | current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); | ||
444 | } | ||
445 | |||
446 | // Determine if the matrix changed state | ||
447 | if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) | ||
448 | { | ||
449 | matrix_changed = true; | ||
450 | } | ||
451 | } | ||
452 | |||
453 | // Unselect col | ||
454 | unselect_col(current_col); | ||
455 | |||
456 | return matrix_changed; | ||
457 | } | ||
458 | |||
459 | static void select_col(uint8_t col) | ||
460 | { | ||
461 | uint8_t pin = col_pins[col]; | ||
462 | _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT | ||
463 | _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW | ||
464 | } | ||
465 | |||
466 | static void unselect_col(uint8_t col) | ||
467 | { | ||
468 | uint8_t pin = col_pins[col]; | ||
469 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
470 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
471 | } | ||
472 | |||
473 | static void unselect_cols(void) | ||
474 | { | ||
475 | for(uint8_t x = 0; x < MATRIX_COLS; x++) { | ||
476 | uint8_t pin = col_pins[x]; | ||
477 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
478 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
479 | } | ||
480 | } | ||
481 | |||
482 | #endif | ||
diff --git a/keyboards/ergotravel/readme.md b/keyboards/ergotravel/readme.md new file mode 100644 index 000000000..ad37bc1ac --- /dev/null +++ b/keyboards/ergotravel/readme.md | |||
@@ -0,0 +1,28 @@ | |||
1 | ErgoTravel | ||
2 | ==== | ||
3 | |||
4 |  | ||
5 | |||
6 | |||
7 | A split ergo 4x6 keyboard with 2 or 3 thumb keys and extra inner macro keys designed by Pierre Constantineau. [More info on the GitHub Repo](https://github.com/jpconstantineau/ErgoTravel). | ||
8 | |||
9 | **Status** The ErgoTravel is currently being beta-tested. | ||
10 | |||
11 | Keyboard Maintainer: [/u/jpconstantineau](https://github.com/jpconstantineau) | ||
12 | |||
13 | Hardware Supported: Pro Micro (ATmega32U4) | ||
14 | |||
15 | Hardware Availability: [Group Buys](https://keyboards.jpconstantineau.com/) or order your own [yourself](https://github.com/jpconstantineau/ErgoTravel/blob/master/OrderingInstructions.md) | ||
16 | |||
17 | |||
18 | Make example for this keyboard (after setting up your build environment): | ||
19 | |||
20 | make ergotravel/rev1:default | ||
21 | |||
22 | Example of flashing this keyboard: | ||
23 | |||
24 | make ergotravel/rev1:default:avrdude | ||
25 | |||
26 | See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. | ||
27 | |||
28 | A build guide for this keyboard can be found here: [Build Guide](https://github.com/jpconstantineau) | ||
diff --git a/keyboards/ergotravel/rev1/config.h b/keyboards/ergotravel/rev1/config.h new file mode 100644 index 000000000..beda546a0 --- /dev/null +++ b/keyboards/ergotravel/rev1/config.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | Copyright 2018 Pierre Constantineau <jpconstantineau@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef REV1_CONFIG_H | ||
19 | #define REV1_CONFIG_H | ||
20 | |||
21 | #include QMK_KEYBOARD_CONFIG_H | ||
22 | |||
23 | /* USB Device descriptor parameter */ | ||
24 | #define VENDOR_ID 0xCEEB | ||
25 | #define PRODUCT_ID 0x1256 | ||
26 | #define DEVICE_VER 0x0100 | ||
27 | #define MANUFACTURER JPConstantineau.com | ||
28 | #define PRODUCT ErgoTravel Keyboard | ||
29 | #define DESCRIPTION Split 45 percent ergonomic keyboard | ||
30 | |||
31 | /* key matrix size */ | ||
32 | // Rows are doubled-up | ||
33 | #define MATRIX_ROWS 8 | ||
34 | #define MATRIX_COLS 7 | ||
35 | |||
36 | // wiring of each half | ||
37 | #define MATRIX_ROW_PINS { C6, D7, E6, B4 } | ||
38 | #define MATRIX_COL_PINS { F5, F6, F7, B1, B3, B2, B6 } | ||
39 | |||
40 | /* COL2ROW or ROW2COL */ | ||
41 | #define DIODE_DIRECTION COL2ROW | ||
42 | |||
43 | /* define if matrix has ghost */ | ||
44 | //#define MATRIX_HAS_GHOST | ||
45 | |||
46 | /* number of backlight levels */ | ||
47 | // #define BACKLIGHT_LEVELS 3 | ||
48 | |||
49 | /* Set 0 if debouncing isn't needed */ | ||
50 | #define DEBOUNCING_DELAY 5 | ||
51 | |||
52 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
53 | #define LOCKING_SUPPORT_ENABLE | ||
54 | /* Locking resynchronize hack */ | ||
55 | #define LOCKING_RESYNC_ENABLE | ||
56 | |||
57 | /* key combination for command */ | ||
58 | #define IS_COMMAND() ( \ | ||
59 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
60 | ) | ||
61 | |||
62 | #define BACKLIGHT_PIN B5 | ||
63 | #define BACKLIGHT_LEVELS 5 | ||
64 | |||
65 | /* ws2812 RGB LED */ | ||
66 | #define RGB_DI_PIN D3 | ||
67 | #define RGBLIGHT_TIMER | ||
68 | #define RGBLED_NUM 12 // Number of LEDs | ||
69 | #define ws2812_PORTREG PORTD | ||
70 | #define ws2812_DDRREG DDRD | ||
71 | |||
72 | /* | ||
73 | * Feature disable options | ||
74 | * These options are also useful to firmware size reduction. | ||
75 | */ | ||
76 | |||
77 | /* disable debug print */ | ||
78 | // #define NO_DEBUG | ||
79 | |||
80 | /* disable print */ | ||
81 | // #define NO_PRINT | ||
82 | |||
83 | /* disable action features */ | ||
84 | //#define NO_ACTION_LAYER | ||
85 | //#define NO_ACTION_TAPPING | ||
86 | //#define NO_ACTION_ONESHOT | ||
87 | //#define NO_ACTION_MACRO | ||
88 | //#define NO_ACTION_FUNCTION | ||
89 | |||
90 | #endif | ||
diff --git a/keyboards/ergotravel/rev1/rev1.c b/keyboards/ergotravel/rev1/rev1.c new file mode 100644 index 000000000..609c479eb --- /dev/null +++ b/keyboards/ergotravel/rev1/rev1.c | |||
@@ -0,0 +1,22 @@ | |||
1 | #include "rev1.h" | ||
2 | |||
3 | |||
4 | #ifdef SSD1306OLED | ||
5 | void led_set_kb(uint8_t usb_led) { | ||
6 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
7 | led_set_user(usb_led); | ||
8 | } | ||
9 | #endif | ||
10 | |||
11 | void matrix_init_kb(void) { | ||
12 | |||
13 | // // green led on | ||
14 | // DDRD |= (1<<5); | ||
15 | // PORTD &= ~(1<<5); | ||
16 | |||
17 | // // orange led on | ||
18 | // DDRB |= (1<<0); | ||
19 | // PORTB &= ~(1<<0); | ||
20 | |||
21 | matrix_init_user(); | ||
22 | }; | ||
diff --git a/keyboards/ergotravel/rev1/rev1.h b/keyboards/ergotravel/rev1/rev1.h new file mode 100644 index 000000000..b20d9f9be --- /dev/null +++ b/keyboards/ergotravel/rev1/rev1.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef REV1_H | ||
2 | #define REV1_H | ||
3 | |||
4 | #include "ergotravel.h" | ||
5 | |||
6 | //void promicro_bootloader_jmp(bool program); | ||
7 | #include "quantum.h" | ||
8 | |||
9 | |||
10 | #ifdef USE_I2C | ||
11 | #include <stddef.h> | ||
12 | #ifdef __AVR__ | ||
13 | #include <avr/io.h> | ||
14 | #include <avr/interrupt.h> | ||
15 | #endif | ||
16 | #endif | ||
17 | |||
18 | //void promicro_bootloader_jmp(bool program); | ||
19 | |||
20 | #define LAYOUT( \ | ||
21 | L00, L01, L02, L03, L04, L05,L06, R00, R01, R02, R03, R04, R05,R06, \ | ||
22 | L10, L11, L12, L13, L14, L15,L16, R10, R11, R12, R13, R14, R15,R16, \ | ||
23 | L20, L21, L22, L23, L24, L25,L26, R20, R21, R22, R23, R24, R25,R26, \ | ||
24 | L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ | ||
25 | ) \ | ||
26 | { \ | ||
27 | { L00, L01, L02, L03, L04, L05, L06 }, \ | ||
28 | { L10, L11, L12, L13, L14, L15, L16 }, \ | ||
29 | { L20, L21, L22, L23, L24, L25, L26 }, \ | ||
30 | { L30, L31, L32, L33, L34, L35, KC_NO }, \ | ||
31 | { R06, R05, R04, R03, R02, R01, R00 }, \ | ||
32 | { R16, R15, R14, R13, R12, R11, R10 }, \ | ||
33 | { R26, R25, R24, R23, R22, R21, R20 }, \ | ||
34 | { R35, R34, R33, R32, R31, R30, KC_NO } \ | ||
35 | } | ||
36 | |||
37 | #endif | ||
diff --git a/keyboards/ergotravel/rev1/rules.mk b/keyboards/ergotravel/rev1/rules.mk new file mode 100644 index 000000000..7b30c0bef --- /dev/null +++ b/keyboards/ergotravel/rev1/rules.mk | |||
@@ -0,0 +1 @@ | |||
BACKLIGHT_ENABLE = no | |||
diff --git a/keyboards/ergotravel/rules.mk b/keyboards/ergotravel/rules.mk new file mode 100644 index 000000000..fceb56edf --- /dev/null +++ b/keyboards/ergotravel/rules.mk | |||
@@ -0,0 +1,74 @@ | |||
1 | SRC += matrix.c \ | ||
2 | i2c.c \ | ||
3 | split_util.c \ | ||
4 | serial.c | ||
5 | |||
6 | # MCU name | ||
7 | #MCU = at90usb1287 | ||
8 | MCU = atmega32u4 | ||
9 | |||
10 | # Processor frequency. | ||
11 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
12 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
13 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
14 | # automatically to create a 32-bit value in your source code. | ||
15 | # | ||
16 | # This will be an integer division of F_USB below, as it is sourced by | ||
17 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
18 | # does not *change* the processor frequency - it should merely be updated to | ||
19 | # reflect the processor speed set externally so that the code can use accurate | ||
20 | # software delays. | ||
21 | F_CPU = 16000000 | ||
22 | |||
23 | # | ||
24 | # LUFA specific | ||
25 | # | ||
26 | # Target architecture (see library "Board Types" documentation). | ||
27 | ARCH = AVR8 | ||
28 | |||
29 | # Input clock frequency. | ||
30 | # This will define a symbol, F_USB, in all source code files equal to the | ||
31 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
32 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
33 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
34 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
35 | # at the end, this will be done automatically to create a 32-bit value in your | ||
36 | # source code. | ||
37 | # | ||
38 | # If no clock division is performed on the input clock inside the AVR (via the | ||
39 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
40 | F_USB = $(F_CPU) | ||
41 | |||
42 | # Bootloader | ||
43 | # This definition is optional, and if your keyboard supports multiple bootloaders of | ||
44 | # different sizes, comment this out, and the correct address will be loaded | ||
45 | # automatically (+60). See bootloader.mk for all options. | ||
46 | BOOTLOADER = caterina | ||
47 | |||
48 | # Interrupt driven control endpoint task(+60) | ||
49 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
50 | |||
51 | # Build Options | ||
52 | # change to "no" to disable the options, or define them in the Makefile in | ||
53 | # the appropriate keymap folder that will get included automatically | ||
54 | # | ||
55 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
56 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
57 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
58 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
59 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
60 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
61 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
62 | MIDI_ENABLE = no # MIDI controls | ||
63 | AUDIO_ENABLE = no # Audio output on port C6 | ||
64 | UNICODE_ENABLE = no # Unicode | ||
65 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
66 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
67 | SUBPROJECT_rev1 = yes | ||
68 | USE_I2C = yes # I2C is used between the sides | ||
69 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
70 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
71 | |||
72 | CUSTOM_MATRIX = yes | ||
73 | |||
74 | DEFAULT_FOLDER = ergotravel/rev1 | ||
diff --git a/keyboards/ergotravel/serial.c b/keyboards/ergotravel/serial.c new file mode 100644 index 000000000..74bcbb6bf --- /dev/null +++ b/keyboards/ergotravel/serial.c | |||
@@ -0,0 +1,228 @@ | |||
1 | /* | ||
2 | * WARNING: be careful changing this code, it is very timing dependent | ||
3 | */ | ||
4 | |||
5 | #ifndef F_CPU | ||
6 | #define F_CPU 16000000 | ||
7 | #endif | ||
8 | |||
9 | #include <avr/io.h> | ||
10 | #include <avr/interrupt.h> | ||
11 | #include <util/delay.h> | ||
12 | #include <stdbool.h> | ||
13 | #include "serial.h" | ||
14 | |||
15 | #ifndef USE_I2C | ||
16 | |||
17 | // Serial pulse period in microseconds. Its probably a bad idea to lower this | ||
18 | // value. | ||
19 | #define SERIAL_DELAY 24 | ||
20 | |||
21 | uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; | ||
22 | uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; | ||
23 | |||
24 | #define SLAVE_DATA_CORRUPT (1<<0) | ||
25 | volatile uint8_t status = 0; | ||
26 | |||
27 | inline static | ||
28 | void serial_delay(void) { | ||
29 | _delay_us(SERIAL_DELAY); | ||
30 | } | ||
31 | |||
32 | inline static | ||
33 | void serial_output(void) { | ||
34 | SERIAL_PIN_DDR |= SERIAL_PIN_MASK; | ||
35 | } | ||
36 | |||
37 | // make the serial pin an input with pull-up resistor | ||
38 | inline static | ||
39 | void serial_input(void) { | ||
40 | SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; | ||
41 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
42 | } | ||
43 | |||
44 | inline static | ||
45 | uint8_t serial_read_pin(void) { | ||
46 | return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); | ||
47 | } | ||
48 | |||
49 | inline static | ||
50 | void serial_low(void) { | ||
51 | SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; | ||
52 | } | ||
53 | |||
54 | inline static | ||
55 | void serial_high(void) { | ||
56 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
57 | } | ||
58 | |||
59 | void serial_master_init(void) { | ||
60 | serial_output(); | ||
61 | serial_high(); | ||
62 | } | ||
63 | |||
64 | void serial_slave_init(void) { | ||
65 | serial_input(); | ||
66 | |||
67 | // Enable INT0 | ||
68 | EIMSK |= _BV(INT0); | ||
69 | // Trigger on falling edge of INT0 | ||
70 | EICRA &= ~(_BV(ISC00) | _BV(ISC01)); | ||
71 | } | ||
72 | |||
73 | // Used by the master to synchronize timing with the slave. | ||
74 | static | ||
75 | void sync_recv(void) { | ||
76 | serial_input(); | ||
77 | // This shouldn't hang if the slave disconnects because the | ||
78 | // serial line will float to high if the slave does disconnect. | ||
79 | while (!serial_read_pin()); | ||
80 | serial_delay(); | ||
81 | } | ||
82 | |||
83 | // Used by the slave to send a synchronization signal to the master. | ||
84 | static | ||
85 | void sync_send(void) { | ||
86 | serial_output(); | ||
87 | |||
88 | serial_low(); | ||
89 | serial_delay(); | ||
90 | |||
91 | serial_high(); | ||
92 | } | ||
93 | |||
94 | // Reads a byte from the serial line | ||
95 | static | ||
96 | uint8_t serial_read_byte(void) { | ||
97 | uint8_t byte = 0; | ||
98 | serial_input(); | ||
99 | for ( uint8_t i = 0; i < 8; ++i) { | ||
100 | byte = (byte << 1) | serial_read_pin(); | ||
101 | serial_delay(); | ||
102 | _delay_us(1); | ||
103 | } | ||
104 | |||
105 | return byte; | ||
106 | } | ||
107 | |||
108 | // Sends a byte with MSB ordering | ||
109 | static | ||
110 | void serial_write_byte(uint8_t data) { | ||
111 | uint8_t b = 8; | ||
112 | serial_output(); | ||
113 | while( b-- ) { | ||
114 | if(data & (1 << b)) { | ||
115 | serial_high(); | ||
116 | } else { | ||
117 | serial_low(); | ||
118 | } | ||
119 | serial_delay(); | ||
120 | } | ||
121 | } | ||
122 | |||
123 | // interrupt handle to be used by the slave device | ||
124 | ISR(SERIAL_PIN_INTERRUPT) { | ||
125 | sync_send(); | ||
126 | |||
127 | uint8_t checksum = 0; | ||
128 | for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { | ||
129 | serial_write_byte(serial_slave_buffer[i]); | ||
130 | sync_send(); | ||
131 | checksum += serial_slave_buffer[i]; | ||
132 | } | ||
133 | serial_write_byte(checksum); | ||
134 | sync_send(); | ||
135 | |||
136 | // wait for the sync to finish sending | ||
137 | serial_delay(); | ||
138 | |||
139 | // read the middle of pulses | ||
140 | _delay_us(SERIAL_DELAY/2); | ||
141 | |||
142 | uint8_t checksum_computed = 0; | ||
143 | for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { | ||
144 | serial_master_buffer[i] = serial_read_byte(); | ||
145 | sync_send(); | ||
146 | checksum_computed += serial_master_buffer[i]; | ||
147 | } | ||
148 | uint8_t checksum_received = serial_read_byte(); | ||
149 | sync_send(); | ||
150 | |||
151 | serial_input(); // end transaction | ||
152 | |||
153 | if ( checksum_computed != checksum_received ) { | ||
154 | status |= SLAVE_DATA_CORRUPT; | ||
155 | } else { | ||
156 | status &= ~SLAVE_DATA_CORRUPT; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | inline | ||
161 | bool serial_slave_DATA_CORRUPT(void) { | ||
162 | return status & SLAVE_DATA_CORRUPT; | ||
163 | } | ||
164 | |||
165 | // Copies the serial_slave_buffer to the master and sends the | ||
166 | // serial_master_buffer to the slave. | ||
167 | // | ||
168 | // Returns: | ||
169 | // 0 => no error | ||
170 | // 1 => slave did not respond | ||
171 | int serial_update_buffers(void) { | ||
172 | // this code is very time dependent, so we need to disable interrupts | ||
173 | cli(); | ||
174 | |||
175 | // signal to the slave that we want to start a transaction | ||
176 | serial_output(); | ||
177 | serial_low(); | ||
178 | _delay_us(1); | ||
179 | |||
180 | // wait for the slaves response | ||
181 | serial_input(); | ||
182 | serial_high(); | ||
183 | _delay_us(SERIAL_DELAY); | ||
184 | |||
185 | // check if the slave is present | ||
186 | if (serial_read_pin()) { | ||
187 | // slave failed to pull the line low, assume not present | ||
188 | sei(); | ||
189 | return 1; | ||
190 | } | ||
191 | |||
192 | // if the slave is present syncronize with it | ||
193 | sync_recv(); | ||
194 | |||
195 | uint8_t checksum_computed = 0; | ||
196 | // receive data from the slave | ||
197 | for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { | ||
198 | serial_slave_buffer[i] = serial_read_byte(); | ||
199 | sync_recv(); | ||
200 | checksum_computed += serial_slave_buffer[i]; | ||
201 | } | ||
202 | uint8_t checksum_received = serial_read_byte(); | ||
203 | sync_recv(); | ||
204 | |||
205 | if (checksum_computed != checksum_received) { | ||
206 | sei(); | ||
207 | return 1; | ||
208 | } | ||
209 | |||
210 | uint8_t checksum = 0; | ||
211 | // send data to the slave | ||
212 | for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { | ||
213 | serial_write_byte(serial_master_buffer[i]); | ||
214 | sync_recv(); | ||
215 | checksum += serial_master_buffer[i]; | ||
216 | } | ||
217 | serial_write_byte(checksum); | ||
218 | sync_recv(); | ||
219 | |||
220 | // always, release the line when not in use | ||
221 | serial_output(); | ||
222 | serial_high(); | ||
223 | |||
224 | sei(); | ||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | #endif | ||
diff --git a/keyboards/ergotravel/serial.h b/keyboards/ergotravel/serial.h new file mode 100644 index 000000000..15fe4db7b --- /dev/null +++ b/keyboards/ergotravel/serial.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef MY_SERIAL_H | ||
2 | #define MY_SERIAL_H | ||
3 | |||
4 | #include "config.h" | ||
5 | #include <stdbool.h> | ||
6 | |||
7 | /* TODO: some defines for interrupt setup */ | ||
8 | #define SERIAL_PIN_DDR DDRD | ||
9 | #define SERIAL_PIN_PORT PORTD | ||
10 | #define SERIAL_PIN_INPUT PIND | ||
11 | #define SERIAL_PIN_MASK _BV(PD0) | ||
12 | #define SERIAL_PIN_INTERRUPT INT0_vect | ||
13 | |||
14 | #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 | ||
15 | #define SERIAL_MASTER_BUFFER_LENGTH 1 | ||
16 | |||
17 | // Buffers for master - slave communication | ||
18 | extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; | ||
19 | extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; | ||
20 | |||
21 | void serial_master_init(void); | ||
22 | void serial_slave_init(void); | ||
23 | int serial_update_buffers(void); | ||
24 | bool serial_slave_data_corrupt(void); | ||
25 | |||
26 | #endif | ||
diff --git a/keyboards/ergotravel/split_util.c b/keyboards/ergotravel/split_util.c new file mode 100644 index 000000000..346cbc908 --- /dev/null +++ b/keyboards/ergotravel/split_util.c | |||
@@ -0,0 +1,86 @@ | |||
1 | #include <avr/io.h> | ||
2 | #include <avr/wdt.h> | ||
3 | #include <avr/power.h> | ||
4 | #include <avr/interrupt.h> | ||
5 | #include <util/delay.h> | ||
6 | #include <avr/eeprom.h> | ||
7 | #include "split_util.h" | ||
8 | #include "matrix.h" | ||
9 | #include "keyboard.h" | ||
10 | #include "config.h" | ||
11 | #include "timer.h" | ||
12 | |||
13 | #ifdef USE_I2C | ||
14 | # include "i2c.h" | ||
15 | #else | ||
16 | # include "serial.h" | ||
17 | #endif | ||
18 | |||
19 | volatile bool isLeftHand = true; | ||
20 | |||
21 | static void setup_handedness(void) { | ||
22 | #ifdef EE_HANDS | ||
23 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); | ||
24 | #else | ||
25 | // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c | ||
26 | #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) | ||
27 | isLeftHand = !has_usb(); | ||
28 | #else | ||
29 | isLeftHand = has_usb(); | ||
30 | #endif | ||
31 | #endif | ||
32 | } | ||
33 | |||
34 | static void keyboard_master_setup(void) { | ||
35 | #ifdef USE_I2C | ||
36 | i2c_master_init(); | ||
37 | #ifdef SSD1306OLED | ||
38 | matrix_master_OLED_init (); | ||
39 | #endif | ||
40 | #else | ||
41 | serial_master_init(); | ||
42 | #endif | ||
43 | } | ||
44 | |||
45 | static void keyboard_slave_setup(void) { | ||
46 | timer_init(); | ||
47 | #ifdef USE_I2C | ||
48 | i2c_slave_init(SLAVE_I2C_ADDRESS); | ||
49 | #else | ||
50 | serial_slave_init(); | ||
51 | #endif | ||
52 | } | ||
53 | |||
54 | bool has_usb(void) { | ||
55 | USBCON |= (1 << OTGPADE); //enables VBUS pad | ||
56 | _delay_us(5); | ||
57 | return (USBSTA & (1<<VBUS)); //checks state of VBUS | ||
58 | } | ||
59 | |||
60 | void split_keyboard_setup(void) { | ||
61 | setup_handedness(); | ||
62 | |||
63 | if (has_usb()) { | ||
64 | keyboard_master_setup(); | ||
65 | } else { | ||
66 | keyboard_slave_setup(); | ||
67 | } | ||
68 | sei(); | ||
69 | } | ||
70 | |||
71 | void keyboard_slave_loop(void) { | ||
72 | matrix_init(); | ||
73 | |||
74 | while (1) { | ||
75 | matrix_slave_scan(); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | // this code runs before the usb and keyboard is initialized | ||
80 | void matrix_setup(void) { | ||
81 | split_keyboard_setup(); | ||
82 | |||
83 | if (!has_usb()) { | ||
84 | keyboard_slave_loop(); | ||
85 | } | ||
86 | } | ||
diff --git a/keyboards/ergotravel/split_util.h b/keyboards/ergotravel/split_util.h new file mode 100644 index 000000000..595a0659e --- /dev/null +++ b/keyboards/ergotravel/split_util.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef SPLIT_KEYBOARD_UTIL_H | ||
2 | #define SPLIT_KEYBOARD_UTIL_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | #include "eeconfig.h" | ||
6 | |||
7 | #define SLAVE_I2C_ADDRESS 0x32 | ||
8 | |||
9 | extern volatile bool isLeftHand; | ||
10 | |||
11 | // slave version of matix scan, defined in matrix.c | ||
12 | void matrix_slave_scan(void); | ||
13 | |||
14 | void split_keyboard_setup(void); | ||
15 | bool has_usb(void); | ||
16 | void keyboard_slave_loop(void); | ||
17 | |||
18 | void matrix_master_OLED_init (void); | ||
19 | |||
20 | #endif | ||
diff --git a/keyboards/melody96/keymaps/crilith/keymap.c b/keyboards/melody96/keymaps/crilith/keymap.c index 3335de050..3f2699280 100644 --- a/keyboards/melody96/keymaps/crilith/keymap.c +++ b/keyboards/melody96/keymaps/crilith/keymap.c | |||
@@ -1,83 +1,83 @@ | |||
1 | #include QMK_KEYBOARD_H | 1 | #include QMK_KEYBOARD_H |
2 | 2 | ||
3 | enum custom_keycodes { | 3 | enum custom_keycodes { |
4 | QWERTY = SAFE_RANGE, | 4 | QWERTY = SAFE_RANGE, |
5 | DYNAMIC_MACRO_RANGE, | 5 | DYNAMIC_MACRO_RANGE, |
6 | }; | 6 | }; |
7 | 7 | ||
8 | #include "dynamic_macro.h" | 8 | #include "dynamic_macro.h" |
9 | 9 | ||
10 | #define _______ KC_TRNS | 10 | #define _______ KC_TRNS |
11 | #define KC_REC DYN_REC_START1 | 11 | #define KC_REC DYN_REC_START1 |
12 | #define KC_DONE DYN_REC_STOP | 12 | #define KC_DONE DYN_REC_STOP |
13 | #define KC_PLAY DYN_MACRO_PLAY1 | 13 | #define KC_PLAY DYN_MACRO_PLAY1 |
14 | 14 | ||
15 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 15 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
16 | 16 | ||
17 | LAYOUT( | 17 | LAYOUT( |
18 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_DEL, | 18 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_DEL, |
19 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_BSPC, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, | 19 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_BSPC, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, |
20 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, | 20 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, |
21 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, | 21 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, |
22 | KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, | 22 | KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, |
23 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), | 23 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), |
24 | 24 | ||
25 | LAYOUT( | 25 | LAYOUT( |
26 | RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, | 26 | RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, |
27 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 27 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
28 | _______, RGB_TOG, _______, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______, _______, _______, | 28 | _______, RGB_TOG, _______, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______, _______, _______, |
29 | BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 29 | BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
30 | _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 30 | _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
31 | _______, _______, _______, KC_PLAY, _______, KC_REC, KC_DONE, _______, _______, _______, _______, _______, _______), | 31 | _______, _______, _______, KC_PLAY, _______, KC_REC, KC_DONE, _______, _______, _______, _______, _______, _______), |
32 | }; | 32 | }; |
33 | 33 | ||
34 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { | 34 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { |
35 | return MACRO_NONE; | 35 | return MACRO_NONE; |
36 | } | 36 | } |
37 | 37 | ||
38 | void matrix_init_user(void) { | 38 | void matrix_init_user(void) { |
39 | } | 39 | } |
40 | 40 | ||
41 | void matrix_scan_user(void) { | 41 | void matrix_scan_user(void) { |
42 | } | 42 | } |
43 | 43 | ||
44 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 44 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
45 | if (!process_record_dynamic_macro(keycode, record)) { | 45 | if (!process_record_dynamic_macro(keycode, record)) { |
46 | return false; | 46 | return false; |
47 | } | 47 | } |
48 | return true; | 48 | return true; |
49 | } | 49 | } |
50 | 50 | ||
51 | void led_set_user(uint8_t usb_led) { | 51 | void led_set_user(uint8_t usb_led) { |
52 | 52 | ||
53 | if (usb_led & (1 << USB_LED_NUM_LOCK)) { | 53 | if (usb_led & (1 << USB_LED_NUM_LOCK)) { |
54 | DDRC |= (1 << 6); PORTC &= ~(1 << 6); | 54 | DDRC |= (1 << 6); PORTC &= ~(1 << 6); |
55 | } else { | 55 | } else { |
56 | DDRC &= ~(1 << 6); PORTC &= ~(1 << 6); | 56 | DDRC &= ~(1 << 6); PORTC &= ~(1 << 6); |
57 | } | 57 | } |
58 | 58 | ||
59 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 59 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { |
60 | DDRC |= (1 << 7); PORTC &= ~(1 << 7); | 60 | DDRC |= (1 << 7); PORTC &= ~(1 << 7); |
61 | } else { | 61 | } else { |
62 | DDRC &= ~(1 << 7); PORTC &= ~(1 << 7); | 62 | DDRC &= ~(1 << 7); PORTC &= ~(1 << 7); |
63 | } | 63 | } |
64 | 64 | ||
65 | if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { | 65 | if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { |
66 | DDRB |= (1 << 5); PORTB &= ~(1 << 5); | 66 | DDRB |= (1 << 5); PORTB &= ~(1 << 5); |
67 | } else { | 67 | } else { |
68 | DDRB &= ~(1 << 5); PORTB &= ~(1 << 5); | 68 | DDRB &= ~(1 << 5); PORTB &= ~(1 << 5); |
69 | } | 69 | } |
70 | 70 | ||
71 | if (usb_led & (1 << USB_LED_COMPOSE)) { | 71 | if (usb_led & (1 << USB_LED_COMPOSE)) { |
72 | 72 | ||
73 | } else { | 73 | } else { |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | if (usb_led & (1 << USB_LED_KANA)) { | 77 | if (usb_led & (1 << USB_LED_KANA)) { |
78 | 78 | ||
79 | } else { | 79 | } else { |
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
83 | } | 83 | } |