Compare commits

..

3 Commits

Author SHA1 Message Date
Jack Humbert
8ec77eb620 remove STOP_FEATURE 2017-07-29 16:05:32 -04:00
Jack Humbert
151b7a4ae5 updates all keymaps, restricts to two options 2017-07-29 15:49:23 -04:00
Jack Humbert
98ac10fd74 introduces new format [broken] [skip ci] 2017-07-28 23:29:22 -04:00
193 changed files with 1888 additions and 3876 deletions

View File

@@ -36,16 +36,16 @@ enum my_keycodes {
## Programming The Behavior Of Any Keycode
When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_kb()` and `process_record_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required.
When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_keyboard()` and `process_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required.
These function are called every time a key is pressed or released.
### Example `process_record_user()` implementation
### Example `process_user()` implementation
This example does two things. It defines the behavior for a custom keycode called `FOO`, and it supplements our Enter key by playing a tone whenever it is pressed.
```
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case FOO:
if (record->event.pressed) {
@@ -53,21 +53,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
// Do something else when release
}
return false; // Skip all further processing of this key
return STOP_PROCESSING; // Skip all further processing of this key
case KC_ENTER:
// Play a tone when enter is pressed
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_qwerty);
}
return true; // Let QMK send the enter press/release events
return CONTINUE_PROCESSING; // Let QMK send the enter press/release events
}
}
```
### `process_record_*` Function documentation
* Keyboard/Revision: `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
* Keymap: `bool process_record_user(uint16_t keycode, keyrecord_t *record)`
* Keyboard/Revision: `level_t process_kb(uint16_t keycode, keyrecord_t *record)`
* Keymap: `level_t process_user(uint16_t keycode, keyrecord_t *record)`
The `keycode` argument is whatever is defined in your keymap, eg `MO(1)`, `KC_L`, etc. You should use a `switch...case` block to handle these events.

View File

@@ -337,10 +337,10 @@ enum my_keycodes {
};
```
You can then use `process_record_user()` to do something with your keycode:
You can then use `process_user()` to do something with your keycode:
```
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case FOO:
// Do something here

View File

@@ -135,8 +135,8 @@ The `process_record()` function itself is deceptively simple, but hidden within
* [`void process_record(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action.c#L128)
* [`bool process_record_quantum(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L140)
* [Map this record to a keycode](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L143)
* [`bool process_record_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/cluecard.c#L20)
* [`bool process_record_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/keymaps/default/keymap.c#L58)
* [`level_t process_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/cluecard.c#L20)
* [`level_t process_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/keymaps/default/keymap.c#L58)
* [`bool process_midi(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_midi.c#L102)
* [`bool process_audio(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_audio.c#L10)
* [`bool process_music(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_music.c#L69)
@@ -150,7 +150,7 @@ The `process_record()` function itself is deceptively simple, but hidden within
* [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicodemap.c#L47)
* [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L211)
At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing.
At any step during this chain of events a function (such as `process_kb()`) can `return false` to halt all further processing.
<!--
#### Mouse Handling

View File

@@ -173,31 +173,31 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORMAC:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORMAC);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -207,7 +207,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -217,8 +217,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
};

View File

@@ -78,7 +78,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
static uint8_t qw_dv_swap_state = 0;
bool process_record_user (uint16_t keycode, keyrecord_t *record) {
level_t process_user (uint16_t keycode, keyrecord_t *record) {
if (keycode == KC_LGUI) {
if (record->event.pressed)
qw_dv_swap_state |= 0b00000001;
@@ -95,5 +95,5 @@ bool process_record_user (uint16_t keycode, keyrecord_t *record) {
if (qw_dv_swap_state == 0b00000011) {
layer_invert(DVORAK);
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -189,7 +189,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
};
// Custom keycodes
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
bool queue = true;
//Cancle one-shot mods.
@@ -201,7 +201,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
break;
}
return queue;
return queue ? CONTINUE_PROCESSING : STOP_PROCESSING;
}
// TAP DANCE SETTINGS

View File

@@ -124,31 +124,31 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case WOW:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_WOW);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -158,7 +158,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -168,8 +168,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
};

View File

@@ -156,26 +156,26 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -17,11 +17,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -55,8 +55,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -20,8 +20,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -261,50 +261,50 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
/* layout switcher */
case LAY_QWE:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<QWE);
}
return false;
return STOP_PROCESSING;
break;
case LAY_COL:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<COL);
}
return false;
return STOP_PROCESSING;
break;
case LAY_WOR:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<WOR);
}
return false;
return STOP_PROCESSING;
break;
case LAY_DVO:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<DVO);
}
return false;
return STOP_PROCESSING;
break;
/* os switcher */
case OS_LIN:
set_unicode_input_mode(UC_LNX);
return false;
return STOP_PROCESSING;
break;
case OS_WIN:
set_unicode_input_mode(UC_WINC);
return false;
return STOP_PROCESSING;
break;
case OS_MAC:
set_unicode_input_mode(UC_OSX);
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
void matrix_init_user() {

View File

@@ -1,162 +1,162 @@
#include <util/twi.h>
#include <avr/io.h>
#include <stdlib.h>
#include <avr/interrupt.h>
#include <util/twi.h>
#include <stdbool.h>
#include "i2c.h"
#ifdef USE_I2C
// Limits the amount of we wait for any one i2c transaction.
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
// 9 bits, a single transaction will take around 90μs to complete.
//
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
// poll loop takes at least 8 clock cycles to execute
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
static volatile uint8_t slave_buffer_pos;
static volatile bool slave_has_register_set = false;
// Wait for an i2c operation to finish
inline static
void i2c_delay(void) {
uint16_t lim = 0;
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
lim++;
// easier way, but will wait slightly longer
// _delay_us(100);
}
// Setup twi to run at 100kHz
void i2c_master_init(void) {
// no prescaler
TWSR = 0;
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
// Check datasheets for more info.
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
}
// Start a transaction with the given i2c slave address. The direction of the
// transfer is set with I2C_READ and I2C_WRITE.
// returns: 0 => success
// 1 => error
uint8_t i2c_master_start(uint8_t address) {
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
i2c_delay();
// check that we started successfully
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
return 1;
TWDR = address;
TWCR = (1<<TWINT) | (1<<TWEN);
i2c_delay();
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
return 1; // slave did not acknowledge
else
return 0; // success
}
// Finish the i2c transaction.
void i2c_master_stop(void) {
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
uint16_t lim = 0;
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
lim++;
}
// Write one byte to the i2c slave.
// returns 0 => slave ACK
// 1 => slave NACK
uint8_t i2c_master_write(uint8_t data) {
TWDR = data;
TWCR = (1<<TWINT) | (1<<TWEN);
i2c_delay();
// check if the slave acknowledged us
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
}
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
// if ack=0 the acknowledge bit is not set.
// returns: byte read from i2c device
uint8_t i2c_master_read(int ack) {
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
i2c_delay();
return TWDR;
}
void i2c_reset_state(void) {
TWCR = 0;
}
void i2c_slave_init(uint8_t address) {
TWAR = address << 0; // slave i2c address
// TWEN - twi enable
// TWEA - enable address acknowledgement
// TWINT - twi interrupt flag
// TWIE - enable the twi interrupt
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
}
ISR(TWI_vect);
ISR(TWI_vect) {
uint8_t ack = 1;
switch(TW_STATUS) {
case TW_SR_SLA_ACK:
// this device has been addressed as a slave receiver
slave_has_register_set = false;
break;
case TW_SR_DATA_ACK:
// this device has received data as a slave receiver
// The first byte that we receive in this transaction sets the location
// of the read/write location of the slaves memory that it exposes over
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
// slave_buffer_pos after each write.
if(!slave_has_register_set) {
slave_buffer_pos = TWDR;
// don't acknowledge the master if this memory loctaion is out of bounds
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
ack = 0;
slave_buffer_pos = 0;
}
slave_has_register_set = true;
} else {
i2c_slave_buffer[slave_buffer_pos] = TWDR;
BUFFER_POS_INC();
}
break;
case TW_ST_SLA_ACK:
case TW_ST_DATA_ACK:
// master has addressed this device as a slave transmitter and is
// requesting data.
TWDR = i2c_slave_buffer[slave_buffer_pos];
BUFFER_POS_INC();
break;
case TW_BUS_ERROR: // something went wrong, reset twi state
TWCR = 0;
default:
break;
}
// Reset everything, so we are ready for the next TWI interrupt
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
}
#endif
#include <util/twi.h>
#include <avr/io.h>
#include <stdlib.h>
#include <avr/interrupt.h>
#include <util/twi.h>
#include <stdbool.h>
#include "i2c.h"
#ifdef USE_I2C
// Limits the amount of we wait for any one i2c transaction.
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
// 9 bits, a single transaction will take around 90μs to complete.
//
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
// poll loop takes at least 8 clock cycles to execute
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
static volatile uint8_t slave_buffer_pos;
static volatile bool slave_has_register_set = false;
// Wait for an i2c operation to finish
inline static
void i2c_delay(void) {
uint16_t lim = 0;
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
lim++;
// easier way, but will wait slightly longer
// _delay_us(100);
}
// Setup twi to run at 100kHz
void i2c_master_init(void) {
// no prescaler
TWSR = 0;
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
// Check datasheets for more info.
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
}
// Start a transaction with the given i2c slave address. The direction of the
// transfer is set with I2C_READ and I2C_WRITE.
// returns: 0 => success
// 1 => error
uint8_t i2c_master_start(uint8_t address) {
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
i2c_delay();
// check that we started successfully
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
return 1;
TWDR = address;
TWCR = (1<<TWINT) | (1<<TWEN);
i2c_delay();
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
return 1; // slave did not acknowledge
else
return 0; // success
}
// Finish the i2c transaction.
void i2c_master_stop(void) {
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
uint16_t lim = 0;
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
lim++;
}
// Write one byte to the i2c slave.
// returns 0 => slave ACK
// 1 => slave NACK
uint8_t i2c_master_write(uint8_t data) {
TWDR = data;
TWCR = (1<<TWINT) | (1<<TWEN);
i2c_delay();
// check if the slave acknowledged us
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
}
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
// if ack=0 the acknowledge bit is not set.
// returns: byte read from i2c device
uint8_t i2c_master_read(int ack) {
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
i2c_delay();
return TWDR;
}
void i2c_reset_state(void) {
TWCR = 0;
}
void i2c_slave_init(uint8_t address) {
TWAR = address << 0; // slave i2c address
// TWEN - twi enable
// TWEA - enable address acknowledgement
// TWINT - twi interrupt flag
// TWIE - enable the twi interrupt
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
}
ISR(TWI_vect);
ISR(TWI_vect) {
uint8_t ack = 1;
switch(TW_STATUS) {
case TW_SR_SLA_ACK:
// this device has been addressed as a slave receiver
slave_has_register_set = false;
break;
case TW_SR_DATA_ACK:
// this device has received data as a slave receiver
// The first byte that we receive in this transaction sets the location
// of the read/write location of the slaves memory that it exposes over
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
// slave_buffer_pos after each write.
if(!slave_has_register_set) {
slave_buffer_pos = TWDR;
// don't acknowledge the master if this memory loctaion is out of bounds
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
ack = 0;
slave_buffer_pos = 0;
}
slave_has_register_set = true;
} else {
i2c_slave_buffer[slave_buffer_pos] = TWDR;
BUFFER_POS_INC();
}
break;
case TW_ST_SLA_ACK:
case TW_ST_DATA_ACK:
// master has addressed this device as a slave transmitter and is
// requesting data.
TWDR = i2c_slave_buffer[slave_buffer_pos];
BUFFER_POS_INC();
break;
case TW_BUS_ERROR: // something went wrong, reset twi state
TWCR = 0;
default:
break;
}
// Reset everything, so we are ready for the next TWI interrupt
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
}
#endif

View File

@@ -1,31 +1,31 @@
#ifndef I2C_H
#define I2C_H
#include <stdint.h>
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
#define I2C_READ 1
#define I2C_WRITE 0
#define I2C_ACK 1
#define I2C_NACK 0
#define SLAVE_BUFFER_SIZE 0x10
// i2c SCL clock frequency
#define SCL_CLOCK 100000L
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
void i2c_master_init(void);
uint8_t i2c_master_start(uint8_t address);
void i2c_master_stop(void);
uint8_t i2c_master_write(uint8_t data);
uint8_t i2c_master_read(int);
void i2c_reset_state(void);
void i2c_slave_init(uint8_t address);
#endif
#ifndef I2C_H
#define I2C_H
#include <stdint.h>
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
#define I2C_READ 1
#define I2C_WRITE 0
#define I2C_ACK 1
#define I2C_NACK 0
#define SLAVE_BUFFER_SIZE 0x10
// i2c SCL clock frequency
#define SCL_CLOCK 100000L
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
void i2c_master_init(void);
uint8_t i2c_master_start(uint8_t address);
void i2c_master_stop(void);
uint8_t i2c_master_write(uint8_t data);
uint8_t i2c_master_read(int);
void i2c_reset_state(void);
void i2c_slave_init(uint8_t address);
#endif

View File

@@ -1,31 +1,31 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define USE_SERIAL
#define MASTER_LEFT
// #define _MASTER_RIGHT
// #define EE_HANDS
#ifdef SUBPROJECT_v2
#include "../../v2/config.h"
#endif
#ifdef SUBPROJECT_protosplit
#include "../../protosplit/config.h"
#endif
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define USE_SERIAL
#define MASTER_LEFT
// #define _MASTER_RIGHT
// #define EE_HANDS
#ifdef SUBPROJECT_v2
#include "../../v2/config.h"
#endif
#ifdef SUBPROJECT_protosplit
#include "../../protosplit/config.h"
#endif

View File

@@ -1,318 +1,318 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* scan matrix
*/
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "print.h"
#include "debug.h"
#include "util.h"
#include "matrix.h"
#include "split_util.h"
#include "pro_micro.h"
#include "config.h"
#ifdef USE_I2C
# include "i2c.h"
#else // USE_SERIAL
# include "serial.h"
#endif
#ifndef DEBOUNCE
# define DEBOUNCE 5
#endif
#define ERROR_DISCONNECT_COUNT 5
static uint8_t debouncing = DEBOUNCE;
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
static uint8_t error_count = 0;
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
static matrix_row_t read_cols(void);
static void init_cols(void);
static void unselect_rows(void);
static void select_row(uint8_t row);
__attribute__ ((weak))
void matrix_init_quantum(void) {
matrix_init_kb();
}
__attribute__ ((weak))
void matrix_scan_quantum(void) {
matrix_scan_kb();
}
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__ ((weak))
void matrix_init_user(void) {
}
__attribute__ ((weak))
void matrix_scan_user(void) {
}
inline
uint8_t matrix_rows(void)
{
return MATRIX_ROWS;
}
inline
uint8_t matrix_cols(void)
{
return MATRIX_COLS;
}
void matrix_init(void)
{
debug_enable = true;
debug_matrix = true;
debug_mouse = true;
// initialize row and col
unselect_rows();
init_cols();
TX_RX_LED_INIT;
// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
matrix[i] = 0;
matrix_debouncing[i] = 0;
}
matrix_init_quantum();
}
uint8_t _matrix_scan(void)
{
// Right hand is stored after the left in the matirx so, we need to offset it
int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
select_row(i);
_delay_us(30); // without this wait read unstable value.
matrix_row_t cols = read_cols();
if (matrix_debouncing[i+offset] != cols) {
matrix_debouncing[i+offset] = cols;
debouncing = DEBOUNCE;
}
unselect_rows();
}
if (debouncing) {
if (--debouncing) {
_delay_ms(1);
} else {
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
matrix[i+offset] = matrix_debouncing[i+offset];
}
}
}
return 1;
}
#ifdef USE_I2C
// Get rows from other half over i2c
int i2c_transaction(void) {
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
if (err) goto i2c_error;
// start of matrix stored at 0x00
err = i2c_master_write(0x00);
if (err) goto i2c_error;
// Start read
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
if (err) goto i2c_error;
if (!err) {
int i;
for (i = 0; i < ROWS_PER_HAND-1; ++i) {
matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
}
matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
i2c_master_stop();
} else {
i2c_error: // the cable is disconnceted, or something else went wrong
i2c_reset_state();
return err;
}
return 0;
}
#else // USE_SERIAL
int serial_transaction(void) {
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
if (serial_update_buffers()) {
return 1;
}
for (int i = 0; i < ROWS_PER_HAND; ++i) {
matrix[slaveOffset+i] = serial_slave_buffer[i];
}
return 0;
}
#endif
uint8_t matrix_scan(void)
{
int ret = _matrix_scan();
#ifdef USE_I2C
if( i2c_transaction() ) {
#else // USE_SERIAL
if( serial_transaction() ) {
#endif
// turn on the indicator led when halves are disconnected
TXLED1;
error_count++;
if (error_count > ERROR_DISCONNECT_COUNT) {
// reset other half if disconnected
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
for (int i = 0; i < ROWS_PER_HAND; ++i) {
matrix[slaveOffset+i] = 0;
}
}
} else {
// turn off the indicator led on no error
TXLED0;
error_count = 0;
}
matrix_scan_quantum();
return ret;
}
void matrix_slave_scan(void) {
_matrix_scan();
int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2);
#ifdef USE_I2C
for (int i = 0; i < ROWS_PER_HAND; ++i) {
/* i2c_slave_buffer[i] = matrix[offset+i]; */
i2c_slave_buffer[i] = matrix[offset+i];
}
#else // USE_SERIAL
for (int i = 0; i < ROWS_PER_HAND; ++i) {
serial_slave_buffer[i] = matrix[offset+i];
}
#endif
}
bool matrix_is_modified(void)
{
if (debouncing) return false;
return true;
}
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<<col));
}
inline
matrix_row_t matrix_get_row(uint8_t row)
{
return matrix[row];
}
void matrix_print(void)
{
print("\nr/c 0123456789ABCDEF\n");
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": ");
pbin_reverse16(matrix_get_row(row));
print("\n");
}
}
uint8_t matrix_key_count(void)
{
uint8_t count = 0;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
count += bitpop16(matrix[i]);
}
return count;
}
static void init_cols(void)
{
for(int x = 0; x < MATRIX_COLS; x++) {
_SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
_SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
}
}
static matrix_row_t read_cols(void)
{
matrix_row_t result = 0;
for(int x = 0; x < MATRIX_COLS; x++) {
result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
}
return result;
}
static void unselect_rows(void)
{
for(int x = 0; x < ROWS_PER_HAND; x++) {
_SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
_SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
}
}
static void select_row(uint8_t row)
{
_SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
_SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
}
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* scan matrix
*/
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "print.h"
#include "debug.h"
#include "util.h"
#include "matrix.h"
#include "split_util.h"
#include "pro_micro.h"
#include "config.h"
#ifdef USE_I2C
# include "i2c.h"
#else // USE_SERIAL
# include "serial.h"
#endif
#ifndef DEBOUNCE
# define DEBOUNCE 5
#endif
#define ERROR_DISCONNECT_COUNT 5
static uint8_t debouncing = DEBOUNCE;
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
static uint8_t error_count = 0;
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
static matrix_row_t read_cols(void);
static void init_cols(void);
static void unselect_rows(void);
static void select_row(uint8_t row);
__attribute__ ((weak))
void matrix_init_quantum(void) {
matrix_init_kb();
}
__attribute__ ((weak))
void matrix_scan_quantum(void) {
matrix_scan_kb();
}
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__ ((weak))
void matrix_init_user(void) {
}
__attribute__ ((weak))
void matrix_scan_user(void) {
}
inline
uint8_t matrix_rows(void)
{
return MATRIX_ROWS;
}
inline
uint8_t matrix_cols(void)
{
return MATRIX_COLS;
}
void matrix_init(void)
{
debug_enable = true;
debug_matrix = true;
debug_mouse = true;
// initialize row and col
unselect_rows();
init_cols();
TX_RX_LED_INIT;
// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
matrix[i] = 0;
matrix_debouncing[i] = 0;
}
matrix_init_quantum();
}
uint8_t _matrix_scan(void)
{
// Right hand is stored after the left in the matirx so, we need to offset it
int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
select_row(i);
_delay_us(30); // without this wait read unstable value.
matrix_row_t cols = read_cols();
if (matrix_debouncing[i+offset] != cols) {
matrix_debouncing[i+offset] = cols;
debouncing = DEBOUNCE;
}
unselect_rows();
}
if (debouncing) {
if (--debouncing) {
_delay_ms(1);
} else {
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
matrix[i+offset] = matrix_debouncing[i+offset];
}
}
}
return 1;
}
#ifdef USE_I2C
// Get rows from other half over i2c
int i2c_transaction(void) {
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
if (err) goto i2c_error;
// start of matrix stored at 0x00
err = i2c_master_write(0x00);
if (err) goto i2c_error;
// Start read
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
if (err) goto i2c_error;
if (!err) {
int i;
for (i = 0; i < ROWS_PER_HAND-1; ++i) {
matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
}
matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
i2c_master_stop();
} else {
i2c_error: // the cable is disconnceted, or something else went wrong
i2c_reset_state();
return err;
}
return 0;
}
#else // USE_SERIAL
int serial_transaction(void) {
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
if (serial_update_buffers()) {
return 1;
}
for (int i = 0; i < ROWS_PER_HAND; ++i) {
matrix[slaveOffset+i] = serial_slave_buffer[i];
}
return 0;
}
#endif
uint8_t matrix_scan(void)
{
int ret = _matrix_scan();
#ifdef USE_I2C
if( i2c_transaction() ) {
#else // USE_SERIAL
if( serial_transaction() ) {
#endif
// turn on the indicator led when halves are disconnected
TXLED1;
error_count++;
if (error_count > ERROR_DISCONNECT_COUNT) {
// reset other half if disconnected
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
for (int i = 0; i < ROWS_PER_HAND; ++i) {
matrix[slaveOffset+i] = 0;
}
}
} else {
// turn off the indicator led on no error
TXLED0;
error_count = 0;
}
matrix_scan_quantum();
return ret;
}
void matrix_slave_scan(void) {
_matrix_scan();
int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2);
#ifdef USE_I2C
for (int i = 0; i < ROWS_PER_HAND; ++i) {
/* i2c_slave_buffer[i] = matrix[offset+i]; */
i2c_slave_buffer[i] = matrix[offset+i];
}
#else // USE_SERIAL
for (int i = 0; i < ROWS_PER_HAND; ++i) {
serial_slave_buffer[i] = matrix[offset+i];
}
#endif
}
bool matrix_is_modified(void)
{
if (debouncing) return false;
return true;
}
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<<col));
}
inline
matrix_row_t matrix_get_row(uint8_t row)
{
return matrix[row];
}
void matrix_print(void)
{
print("\nr/c 0123456789ABCDEF\n");
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": ");
pbin_reverse16(matrix_get_row(row));
print("\n");
}
}
uint8_t matrix_key_count(void)
{
uint8_t count = 0;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
count += bitpop16(matrix[i]);
}
return count;
}
static void init_cols(void)
{
for(int x = 0; x < MATRIX_COLS; x++) {
_SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
_SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
}
}
static matrix_row_t read_cols(void)
{
matrix_row_t result = 0;
for(int x = 0; x < MATRIX_COLS; x++) {
result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
}
return result;
}
static void unselect_rows(void)
{
for(int x = 0; x < ROWS_PER_HAND; x++) {
_SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
_SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
}
}
static void select_row(uint8_t row)
{
_SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
_SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
}

View File

@@ -11,7 +11,7 @@ based boards.
## Case Files
Files are available here: https://github.com/xyxjj/DeltaSplit75-Case-files
## Build Guide
#Build Guide
The build guide should be found at https://qmk.fm/deltasplit75

View File

@@ -1,228 +1,228 @@
/*
* WARNING: be careful changing this code, it is very timing dependent
*/
#ifndef F_CPU
#define F_CPU 16000000
#endif
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdbool.h>
#include "serial.h"
#ifdef USE_SERIAL
// Serial pulse period in microseconds. Its probably a bad idea to lower this
// value.
#define SERIAL_DELAY 24
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
#define SLAVE_DATA_CORRUPT (1<<0)
volatile uint8_t status = 0;
inline static
void serial_delay(void) {
_delay_us(SERIAL_DELAY);
}
inline static
void serial_output(void) {
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
}
// make the serial pin an input with pull-up resistor
inline static
void serial_input(void) {
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
inline static
uint8_t serial_read_pin(void) {
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
}
inline static
void serial_low(void) {
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
}
inline static
void serial_high(void) {
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
void serial_master_init(void) {
serial_output();
serial_high();
}
void serial_slave_init(void) {
serial_input();
// Enable INT0
EIMSK |= _BV(INT0);
// Trigger on falling edge of INT0
EICRA &= ~(_BV(ISC00) | _BV(ISC01));
}
// Used by the master to synchronize timing with the slave.
static
void sync_recv(void) {
serial_input();
// This shouldn't hang if the slave disconnects because the
// serial line will float to high if the slave does disconnect.
while (!serial_read_pin());
serial_delay();
}
// Used by the slave to send a synchronization signal to the master.
static
void sync_send(void) {
serial_output();
serial_low();
serial_delay();
serial_high();
}
// Reads a byte from the serial line
static
uint8_t serial_read_byte(void) {
uint8_t byte = 0;
serial_input();
for ( uint8_t i = 0; i < 8; ++i) {
byte = (byte << 1) | serial_read_pin();
serial_delay();
_delay_us(1);
}
return byte;
}
// Sends a byte with MSB ordering
static
void serial_write_byte(uint8_t data) {
uint8_t b = 8;
serial_output();
while( b-- ) {
if(data & (1 << b)) {
serial_high();
} else {
serial_low();
}
serial_delay();
}
}
// interrupt handle to be used by the slave device
ISR(SERIAL_PIN_INTERRUPT) {
sync_send();
uint8_t checksum = 0;
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
serial_write_byte(serial_slave_buffer[i]);
sync_send();
checksum += serial_slave_buffer[i];
}
serial_write_byte(checksum);
sync_send();
// wait for the sync to finish sending
serial_delay();
// read the middle of pulses
_delay_us(SERIAL_DELAY/2);
uint8_t checksum_computed = 0;
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
serial_master_buffer[i] = serial_read_byte();
sync_send();
checksum_computed += serial_master_buffer[i];
}
uint8_t checksum_received = serial_read_byte();
sync_send();
serial_input(); // end transaction
if ( checksum_computed != checksum_received ) {
status |= SLAVE_DATA_CORRUPT;
} else {
status &= ~SLAVE_DATA_CORRUPT;
}
}
inline
bool serial_slave_DATA_CORRUPT(void) {
return status & SLAVE_DATA_CORRUPT;
}
// Copies the serial_slave_buffer to the master and sends the
// serial_master_buffer to the slave.
//
// Returns:
// 0 => no error
// 1 => slave did not respond
int serial_update_buffers(void) {
// this code is very time dependent, so we need to disable interrupts
cli();
// signal to the slave that we want to start a transaction
serial_output();
serial_low();
_delay_us(1);
// wait for the slaves response
serial_input();
serial_high();
_delay_us(SERIAL_DELAY);
// check if the slave is present
if (serial_read_pin()) {
// slave failed to pull the line low, assume not present
sei();
return 1;
}
// if the slave is present syncronize with it
sync_recv();
uint8_t checksum_computed = 0;
// receive data from the slave
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
serial_slave_buffer[i] = serial_read_byte();
sync_recv();
checksum_computed += serial_slave_buffer[i];
}
uint8_t checksum_received = serial_read_byte();
sync_recv();
if (checksum_computed != checksum_received) {
sei();
return 1;
}
uint8_t checksum = 0;
// send data to the slave
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
serial_write_byte(serial_master_buffer[i]);
sync_recv();
checksum += serial_master_buffer[i];
}
serial_write_byte(checksum);
sync_recv();
// always, release the line when not in use
serial_output();
serial_high();
sei();
return 0;
}
#endif
/*
* WARNING: be careful changing this code, it is very timing dependent
*/
#ifndef F_CPU
#define F_CPU 16000000
#endif
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdbool.h>
#include "serial.h"
#ifdef USE_SERIAL
// Serial pulse period in microseconds. Its probably a bad idea to lower this
// value.
#define SERIAL_DELAY 24
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
#define SLAVE_DATA_CORRUPT (1<<0)
volatile uint8_t status = 0;
inline static
void serial_delay(void) {
_delay_us(SERIAL_DELAY);
}
inline static
void serial_output(void) {
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
}
// make the serial pin an input with pull-up resistor
inline static
void serial_input(void) {
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
inline static
uint8_t serial_read_pin(void) {
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
}
inline static
void serial_low(void) {
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
}
inline static
void serial_high(void) {
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
void serial_master_init(void) {
serial_output();
serial_high();
}
void serial_slave_init(void) {
serial_input();
// Enable INT0
EIMSK |= _BV(INT0);
// Trigger on falling edge of INT0
EICRA &= ~(_BV(ISC00) | _BV(ISC01));
}
// Used by the master to synchronize timing with the slave.
static
void sync_recv(void) {
serial_input();
// This shouldn't hang if the slave disconnects because the
// serial line will float to high if the slave does disconnect.
while (!serial_read_pin());
serial_delay();
}
// Used by the slave to send a synchronization signal to the master.
static
void sync_send(void) {
serial_output();
serial_low();
serial_delay();
serial_high();
}
// Reads a byte from the serial line
static
uint8_t serial_read_byte(void) {
uint8_t byte = 0;
serial_input();
for ( uint8_t i = 0; i < 8; ++i) {
byte = (byte << 1) | serial_read_pin();
serial_delay();
_delay_us(1);
}
return byte;
}
// Sends a byte with MSB ordering
static
void serial_write_byte(uint8_t data) {
uint8_t b = 8;
serial_output();
while( b-- ) {
if(data & (1 << b)) {
serial_high();
} else {
serial_low();
}
serial_delay();
}
}
// interrupt handle to be used by the slave device
ISR(SERIAL_PIN_INTERRUPT) {
sync_send();
uint8_t checksum = 0;
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
serial_write_byte(serial_slave_buffer[i]);
sync_send();
checksum += serial_slave_buffer[i];
}
serial_write_byte(checksum);
sync_send();
// wait for the sync to finish sending
serial_delay();
// read the middle of pulses
_delay_us(SERIAL_DELAY/2);
uint8_t checksum_computed = 0;
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
serial_master_buffer[i] = serial_read_byte();
sync_send();
checksum_computed += serial_master_buffer[i];
}
uint8_t checksum_received = serial_read_byte();
sync_send();
serial_input(); // end transaction
if ( checksum_computed != checksum_received ) {
status |= SLAVE_DATA_CORRUPT;
} else {
status &= ~SLAVE_DATA_CORRUPT;
}
}
inline
bool serial_slave_DATA_CORRUPT(void) {
return status & SLAVE_DATA_CORRUPT;
}
// Copies the serial_slave_buffer to the master and sends the
// serial_master_buffer to the slave.
//
// Returns:
// 0 => no error
// 1 => slave did not respond
int serial_update_buffers(void) {
// this code is very time dependent, so we need to disable interrupts
cli();
// signal to the slave that we want to start a transaction
serial_output();
serial_low();
_delay_us(1);
// wait for the slaves response
serial_input();
serial_high();
_delay_us(SERIAL_DELAY);
// check if the slave is present
if (serial_read_pin()) {
// slave failed to pull the line low, assume not present
sei();
return 1;
}
// if the slave is present syncronize with it
sync_recv();
uint8_t checksum_computed = 0;
// receive data from the slave
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
serial_slave_buffer[i] = serial_read_byte();
sync_recv();
checksum_computed += serial_slave_buffer[i];
}
uint8_t checksum_received = serial_read_byte();
sync_recv();
if (checksum_computed != checksum_received) {
sei();
return 1;
}
uint8_t checksum = 0;
// send data to the slave
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
serial_write_byte(serial_master_buffer[i]);
sync_recv();
checksum += serial_master_buffer[i];
}
serial_write_byte(checksum);
sync_recv();
// always, release the line when not in use
serial_output();
serial_high();
sei();
return 0;
}
#endif

View File

@@ -1,26 +1,26 @@
#ifndef MY_SERIAL_H
#define MY_SERIAL_H
#include "config.h"
#include <stdbool.h>
/* TODO: some defines for interrupt setup */
#define SERIAL_PIN_DDR DDRD
#define SERIAL_PIN_PORT PORTD
#define SERIAL_PIN_INPUT PIND
#define SERIAL_PIN_MASK _BV(PD0)
#define SERIAL_PIN_INTERRUPT INT0_vect
#define SERIAL_SLAVE_BUFFER_LENGTH ((MATRIX_COLS+7)/8 *MATRIX_ROWS/2)
#define SERIAL_MASTER_BUFFER_LENGTH 1
// Buffers for master - slave communication
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
void serial_master_init(void);
void serial_slave_init(void);
int serial_update_buffers(void);
bool serial_slave_data_corrupt(void);
#endif
#ifndef MY_SERIAL_H
#define MY_SERIAL_H
#include "config.h"
#include <stdbool.h>
/* TODO: some defines for interrupt setup */
#define SERIAL_PIN_DDR DDRD
#define SERIAL_PIN_PORT PORTD
#define SERIAL_PIN_INPUT PIND
#define SERIAL_PIN_MASK _BV(PD0)
#define SERIAL_PIN_INTERRUPT INT0_vect
#define SERIAL_SLAVE_BUFFER_LENGTH ((MATRIX_COLS+7)/8 *MATRIX_ROWS/2)
#define SERIAL_MASTER_BUFFER_LENGTH 1
// Buffers for master - slave communication
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
void serial_master_init(void);
void serial_slave_init(void);
int serial_update_buffers(void);
bool serial_slave_data_corrupt(void);
#endif

View File

@@ -1,81 +1,81 @@
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/eeprom.h>
#include "split_util.h"
#include "matrix.h"
#include "keyboard.h"
#include "config.h"
#ifdef USE_I2C
# include "i2c.h"
#else
# include "serial.h"
#endif
volatile bool isLeftHand = true;
static void setup_handedness(void) {
#ifdef EE_HANDS
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
#else
// I2C_MASTER_RIGHT is deprecated use MASTER_RIGHT instead since this works for both serial and i2c
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
isLeftHand = !has_usb();
#else
isLeftHand = has_usb();
#endif
#endif
}
static void keyboard_master_setup(void) {
#ifdef USE_I2C
i2c_master_init();
#else
serial_master_init();
#endif
}
static void keyboard_slave_setup(void) {
#ifdef USE_I2C
i2c_slave_init(SLAVE_I2C_ADDRESS);
#else
serial_slave_init();
#endif
}
bool has_usb(void) {
USBCON |= (1 << OTGPADE); //enables VBUS pad
_delay_us(5);
return (USBSTA & (1<<VBUS)); //checks state of VBUS
}
void split_keyboard_setup(void) {
setup_handedness();
if (has_usb()) {
keyboard_master_setup();
} else {
keyboard_slave_setup();
}
sei();
}
void keyboard_slave_loop(void) {
matrix_init();
while (1) {
matrix_slave_scan();
}
}
// this code runs before the usb and keyboard is initialized
void matrix_setup(void) {
split_keyboard_setup();
if (!has_usb()) {
keyboard_slave_loop();
}
}
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/eeprom.h>
#include "split_util.h"
#include "matrix.h"
#include "keyboard.h"
#include "config.h"
#ifdef USE_I2C
# include "i2c.h"
#else
# include "serial.h"
#endif
volatile bool isLeftHand = true;
static void setup_handedness(void) {
#ifdef EE_HANDS
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
#else
// I2C_MASTER_RIGHT is deprecated use MASTER_RIGHT instead since this works for both serial and i2c
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
isLeftHand = !has_usb();
#else
isLeftHand = has_usb();
#endif
#endif
}
static void keyboard_master_setup(void) {
#ifdef USE_I2C
i2c_master_init();
#else
serial_master_init();
#endif
}
static void keyboard_slave_setup(void) {
#ifdef USE_I2C
i2c_slave_init(SLAVE_I2C_ADDRESS);
#else
serial_slave_init();
#endif
}
bool has_usb(void) {
USBCON |= (1 << OTGPADE); //enables VBUS pad
_delay_us(5);
return (USBSTA & (1<<VBUS)); //checks state of VBUS
}
void split_keyboard_setup(void) {
setup_handedness();
if (has_usb()) {
keyboard_master_setup();
} else {
keyboard_slave_setup();
}
sei();
}
void keyboard_slave_loop(void) {
matrix_init();
while (1) {
matrix_slave_scan();
}
}
// this code runs before the usb and keyboard is initialized
void matrix_setup(void) {
split_keyboard_setup();
if (!has_usb()) {
keyboard_slave_loop();
}
}

View File

@@ -1,22 +1,22 @@
#ifndef SPLIT_KEYBOARD_UTIL_H
#define SPLIT_KEYBOARD_UTIL_H
#include <stdbool.h>
#ifdef EE_HANDS
#define EECONFIG_BOOTMAGIC_END (uint8_t *)10
#define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END
#endif
#define SLAVE_I2C_ADDRESS 0x32
extern volatile bool isLeftHand;
// slave version of matix scan, defined in matrix.c
void matrix_slave_scan(void);
void split_keyboard_setup(void);
bool has_usb(void);
void keyboard_slave_loop(void);
#endif
#ifndef SPLIT_KEYBOARD_UTIL_H
#define SPLIT_KEYBOARD_UTIL_H
#include <stdbool.h>
#ifdef EE_HANDS
#define EECONFIG_BOOTMAGIC_END (uint8_t *)10
#define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END
#endif
#define SLAVE_I2C_ADDRESS 0x32
extern volatile bool isLeftHand;
// slave version of matix scan, defined in matrix.c
void matrix_slave_scan(void);
void split_keyboard_setup(void);
bool has_usb(void);
void keyboard_slave_loop(void);
#endif

View File

@@ -63,7 +63,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case FN:
if (record->event.pressed) {
@@ -73,8 +73,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_FN);
dk60_esc_led_off();
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -148,7 +148,7 @@ void persistant_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -157,7 +157,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -167,7 +167,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -177,10 +177,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
void matrix_init_user(void) {

View File

@@ -258,10 +258,10 @@ void matrix_scan_user(void) {
}
};
//bool process_record_user(uint16_t keycode, keyrecord_t *record) {
//level_t process_user(uint16_t keycode, keyrecord_t *record) {
// switch (keycode) {
// case QWERTY:
// return false
// return STOP_PROCESSING
// break;
// case LOWER:
// if (record->event.pressed) {
@@ -271,7 +271,7 @@ void matrix_scan_user(void) {
// layer_off(_LOWER);
// update_tri_layer(_LOWER, _RAISE, _ADJUST);
// }
// return false;
// return STOP_PROCESSING;
// break;
// case RAISE:
// if (record->event.pressed) {
@@ -281,9 +281,9 @@ void matrix_scan_user(void) {
// layer_off(_RAISE);
// update_tri_layer(_LOWER, _RAISE, _ADJUST);
// }
// return false;
// return STOP_PROCESSING;
// break;
// }
// return true;
// return CONTINUE_PROCESSING;
//}

View File

@@ -267,7 +267,7 @@ void send_chord(void)
virtser_send(0);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record)
level_t process_user(uint16_t keycode, keyrecord_t *record)
{
// We need to track keypresses in all modes, in case the user
// changes mode whilst pressing other keys.
@@ -275,7 +275,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
pressed_count++;
else
pressed_count--;
return true;
return CONTINUE_PROCESSING;
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)

View File

@@ -357,23 +357,23 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case EPRM:
if (record->event.pressed) {
eeconfig_init();
}
return false;
return STOP_PROCESSING;
break;
case VRSN:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
// Runs just one time when the keyboard initializes.

View File

@@ -1043,7 +1043,7 @@ const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
UCIS_SYM("tm", 0x2122)
);
bool process_record_user (uint16_t keycode, keyrecord_t *record) {
level_t process_user (uint16_t keycode, keyrecord_t *record) {
#if KEYLOGGER_ENABLE
if (log_enable) {
uint8_t layer = biton32(layer_state);
@@ -1086,11 +1086,11 @@ bool process_record_user (uint16_t keycode, keyrecord_t *record) {
ang_tap (KC_4, KC_SPC, KC_D, KC_A, KC_Y, KC_S, KC_QUOT, 0);
return false;
return STOP_PROCESSING;
}
}
return true;
return CONTINUE_PROCESSING;
}
void qk_ucis_symbol_fallback (void) {

View File

@@ -247,7 +247,7 @@ void matrix_scan_user(void) {
}
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case BEL_F0:
if(record->event.pressed){
@@ -260,7 +260,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(SWPH);
}
return false;
return STOP_PROCESSING;
}
break;
case BEL_F1:
@@ -268,7 +268,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(SYMB);
layer_off(NUMP);
return false;
return STOP_PROCESSING;
}
break;
case E_SHRUG: // ¯\_(ツ)_/¯
@@ -287,7 +287,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
tap(KC_SLSH); // Arm
process_unicode((0x00AF|QK_UNICODE), record); // Hand
}
return false;
return STOP_PROCESSING;
break;
case E_TFLIP: // (╯°□°)╯ ︵ ┻━┻
if (record->event.pressed) {
@@ -309,7 +309,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
process_unicode((0x2501|QK_UNICODE), record); // Table
process_unicode((0x253B|QK_UNICODE), record); // Table
}
return false;
return STOP_PROCESSING;
break;
case E_TSET: // ┬──┬ ( ゜-゜ノ)
if (record->event.pressed) {
@@ -331,11 +331,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
tap(KC_0);
unregister_code(KC_RSFT);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
void belak_td_each(qk_tap_dance_state_t *state, void *user_data) {

View File

@@ -168,20 +168,20 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case EPRM:
if (record->event.pressed) {
eeconfig_init();
}
return false;
return STOP_PROCESSING;
break;
case VRSN:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
return STOP_PROCESSING;
break;
case RGB_SLD:
if (record->event.pressed) {
@@ -189,10 +189,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_mode(1);
#endif
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
// Runs just one time when the keyboard initializes.

View File

@@ -165,20 +165,20 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case EPRM:
if (record->event.pressed) {
eeconfig_init();
}
return false;
return STOP_PROCESSING;
break;
case VRSN:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
return STOP_PROCESSING;
break;
case RGB_SLD:
if (record->event.pressed) {
@@ -186,10 +186,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_mode(1);
#endif
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
// Runs just one time when the keyboard initializes.

View File

@@ -159,7 +159,7 @@ void matrix_init_user(void) {
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case RGB_FF00BB:
@@ -170,10 +170,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_setrgb(0xff,0x00,0xbb);
#endif
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
LEADER_EXTERNS();

View File

@@ -1,365 +0,0 @@
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#include "version.h"
#include "keymap_french.h"
#define BASE 0 // default Colemak Mod-DH layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys
#define ACC 3 // accented characters
#define QCOPY 0 // Qubes OS VM to VM copy
#define QPASTE 1 // Qubes OS VM to VM paste
#define M_ACIRC 2 // â
#define M_ECIRC 3 // ê
#define M_ICIRC 4 // î
#define M_OCIRC 5 // ô
#define M_UCIRC 6 // û
#define M_YCIRC 7 // ŷ
#define M_AUMLT 8 // ä
#define M_EUMLT 9 // ë
#define M_IUMLT 10 // ï
#define M_OUMLT 11 // ö
#define M_UUMLT 12 // ü
#define M_YUMLT 13 // ÿ
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Base Colemak Mod-DH layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | Esc | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | Q | W | F | P | B | TO(0)| |TO(2) | J | L | U | Y | ; | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | Tab | A | R | S | T | G |------| |------| M | N | E | I | O | Bcksp |
* |--------+------+------+------+------+------| TO(1)| |OSL(3)|------+------+------+------+------+--------|
* | LShift | Z | X | C | D | V | | | | K | H | , | . | : | Rshift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | Ins | Caps | Left | Right| MO(2)| | MO(2)| Down | Up | PgDn | PgUp |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* |QCopy | Ralt | | Ralt |QPaste|
* ,------|------|------| |------+------+------.
* | | | Home | | End | | |
* | Space| Ctrl |------| |------| Ctrl |Enter |
* | | | LAlt | | LAlt | | |
* `--------------------' `--------------------'
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
[BASE] = KEYMAP( // layer 0 : default
// left hand
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS,
KC_TRNS, FR_Q, FR_W, KC_F, KC_P, KC_B, TO(BASE),
KC_TAB, FR_A, KC_R, KC_S, KC_T, KC_G,
KC_LSFT, FR_Z, KC_X, KC_C, KC_D, KC_V, TO(SYMB),
KC_INS, KC_CAPS, KC_LEFT,KC_RIGHT, MO(SYMB),
M(QCOPY), KC_RALT,
KC_HOME,
KC_SPC,KC_LCTRL, KC_LALT,
// right hand
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
TO(MDIA), KC_J, KC_L, KC_U, KC_Y, FR_SCLN, KC_TRNS,
FR_M, KC_N, KC_E, KC_I, KC_O, KC_BSPC,
OSL(ACC), KC_K, KC_H, FR_COMM, FR_DOT, FR_COLN, KC_RSFT,
MO(SYMB), KC_DOWN, KC_UP, KC_PGDN, KC_PGUP,
KC_RALT, M(QPASTE),
KC_END,
KC_LALT,KC_RCTL, KC_ENT
),
/* Keymap 1: Symbol Layer
* // TODO missing: ¤
* ,--------------------------------------------------. ,--------------------------------------------------.
* |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | § | < | { | \ | ~ | | | | % | @ | } | > | µ | F12 |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | ' | = | - | ( | + |------| |------| * | ) | _ | / | " | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | ` | ? | # | [ | | | | | | & | ] | $ | ! | ^ | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | € | £ | $ | | | | | | | ß | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// SYMBOLS
[SYMB] = KEYMAP(
// left hand
M(0), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS,FR_SECT,FR_LESS, FR_LCBR,FR_BSLS,FR_TILD,KC_TRNS,
KC_TRNS,FR_APOS,FR_EQL, FR_MINS,FR_LPRN,FR_PLUS,
KC_TRNS,FR_GRV,FR_QUES,FR_HASH,FR_LBRC,FR_PIPE,KC_TRNS,
FR_EURO,FR_PND,FR_DLR,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
// right hand
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, FR_PERC, FR_AT, FR_RCBR, FR_GRTR, FR_MU, KC_F12,
FR_ASTR, FR_RPRN, FR_UNDS, FR_SLSH, FR_QUOT, KC_TRNS,
KC_TRNS, FR_AMP, FR_RBRC, FR_DLR, FR_EXLM, FR_CIRC, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, ALGR(KC_S), KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
/* Keymap 2: Media and mouse keys
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | MsUp | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | |MsLeft|MsDown|MsRght| |------| |------| | Lclk | Rclk | | | Play |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | Prev | Next | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | |Brwser|
* | | |------| |------| |Back |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// MEDIA AND MOUSE
[MDIA] = KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_TRNS, KC_MPLY,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_WBAK
),
/* Keymap 3: accented characters
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | à | â | ä | | | | | | | î | ï | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | é | è | ê | ë | |------| |------| | | ô | ö | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | ù | û | ü | | | | | | | ŷ | ÿ | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// ACCENTED CHARACTERS
[ACC] = KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, FR_AGRV, M(M_ACIRC), M(M_AUMLT), KC_TRNS, KC_TRNS,
KC_TRNS, FR_EACU, FR_EGRV, M(M_ECIRC), M(M_EUMLT), KC_TRNS,
KC_TRNS, KC_TRNS, FR_UGRV, M(M_UCIRC), M(M_UUMLT), KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, M(M_ICIRC), M(M_IUMLT), KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, M(M_OCIRC), M(M_OUMLT), KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, M(M_YCIRC), M(M_YUMLT), KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case QCOPY:
if (record->event.pressed) {
return MACRO(I(255),
D(LCTRL),
T(C),
D(LSFT),
T(C),
U(LCTRL),
U(LSFT),
END);
}
break;
case QPASTE:
if (record->event.pressed) {
return MACRO(I(255),
D(LCTRL),
D(LSFT),
T(V),
U(LCTRL),
T(INS),
U(LSFT),
END);
}
break;
case M_ACIRC:
if (record->event.pressed) {
return MACRO(T(LBRC), // FR_CIRC
T(Q), // FR_A
END);
}
break;
case M_ECIRC:
if (record->event.pressed) {
return MACRO(T(LBRC), // FR_CIRC
T(E),
END);
}
break;
case M_UCIRC:
if (record->event.pressed) {
return MACRO(T(LBRC), // FR_CIRC
T(U),
END);
}
break;
case M_ICIRC:
if (record->event.pressed) {
return MACRO(T(LBRC), // FR_CIRC
T(I),
END);
}
break;
case M_OCIRC:
if (record->event.pressed) {
return MACRO(T(LBRC), // FR_CIRC
T(O),
END);
}
break;
case M_YCIRC:
if (record->event.pressed) {
return MACRO(T(LBRC), // FR_CIRC
T(Y),
END);
}
break;
case M_AUMLT:
if (record->event.pressed) {
return MACRO(D(LSFT),
T(LBRC),
U(LSFT),
T(Q),
END);
}
break;
case M_EUMLT:
if (record->event.pressed) {
return MACRO(D(LSFT),
T(LBRC),
U(LSFT),
T(E),
END);
}
break;
case M_UUMLT:
if (record->event.pressed) {
return MACRO(D(LSFT),
T(LBRC),
U(LSFT),
T(U),
END);
}
break;
case M_IUMLT:
if (record->event.pressed) {
return MACRO(D(LSFT),
T(LBRC),
U(LSFT),
T(I),
END);
}
break;
case M_OUMLT:
if (record->event.pressed) {
return MACRO(D(LSFT),
T(LBRC),
U(LSFT),
T(O),
END);
}
break;
case M_YUMLT:
if (record->event.pressed) {
return MACRO(D(LSFT),
T(LBRC),
U(LSFT),
T(Y),
END);
}
break;
}
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
case SYMB:
ergodox_right_led_1_on();
break;
case MDIA:
ergodox_right_led_2_on();
break;
case ACC:
ergodox_right_led_3_on();
break;
default:
// none
break;
}
};

View File

@@ -1,30 +0,0 @@
# French hacker layout
## Introduction
[Colemak Mod-DH](https://colemakmods.github.io/mod-dh/) layout for
users keeping an `azerty` layout configuration on their OS.
This keymap is for users keeping their operating systems configured with
`azerty` - for typing passwords or in their native languages - but who
wants a Colemak Mod-DH layout on their mechanical.
The symbols layers was done after analysing various programming
languages sources codes and should be close to optimal for typing
confort.
Special macros for [Qubes OS](https://www.qubes-os.org/) are included.
There is an accented characters layer for infrequent typing of french
accents.
Special macros for [Qubes OS](https://www.qubes-os.org/) are included.
## Build
cd keyboards/ergodox
make french_hacker
## Design explanations
See my [blog post](http://dialectical-computing.de/blog/blog/2017/01/29/a-better-coder-layout-for-the-ergodox-ez-keyboard/).

View File

@@ -165,20 +165,20 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case EPRM:
if (record->event.pressed) {
eeconfig_init();
}
return false;
return STOP_PROCESSING;
break;
case VRSN:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
return STOP_PROCESSING;
break;
case RGB_SLD:
if (record->event.pressed) {
@@ -186,10 +186,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_mode(1);
#endif
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
// Runs just one time when the keyboard initializes.

View File

@@ -82,20 +82,20 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case EPRM:
if (record->event.pressed) {
eeconfig_init();
}
return false;
return STOP_PROCESSING;
break;
case VRSN:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
return STOP_PROCESSING;
break;
case RGB_SLD:
if (record->event.pressed) {
@@ -103,10 +103,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_mode(1);
#endif
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
// Runs just one time when the keyboard initializes.

View File

@@ -62,7 +62,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
};
bool status_led1_on = false, status_led2_on = false, status_led3_on = false;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case RGB_FF0000:
@@ -72,7 +72,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
register_code(KC_1); unregister_code(KC_1);
#endif
}
return false;
return STOP_PROCESSING;
break;
case RGB_00FF00:
if (record->event.pressed) {
@@ -81,7 +81,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
register_code(KC_2); unregister_code(KC_2);
#endif
}
return false;
return STOP_PROCESSING;
break;
case RGB_0000FF:
if (record->event.pressed) {
@@ -90,7 +90,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
register_code(KC_3); unregister_code(KC_3);
#endif
}
return false;
return STOP_PROCESSING;
break;
case RGB_FFFFFF:
if (record->event.pressed) {
@@ -99,7 +99,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
register_code(KC_4); unregister_code(KC_4);
#endif
}
return false;
return STOP_PROCESSING;
break;
case RGB_TOGGLE:
if (record->event.pressed) {
@@ -108,7 +108,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
register_code(KC_EQL); unregister_code(KC_EQL);
#endif
}
return false;
return STOP_PROCESSING;
break;
case LED1:
if (record->event.pressed) {
@@ -120,7 +120,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
status_led1_on = true;
}
}
return false;
return STOP_PROCESSING;
break;
case LED2:
if (record->event.pressed) {
@@ -132,7 +132,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
status_led2_on = true;
}
}
return false;
return STOP_PROCESSING;
break;
case LED3:
if (record->event.pressed) {
@@ -144,8 +144,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
status_led3_on = true;
}
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -189,20 +189,20 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case EPRM:
if (record->event.pressed) {
eeconfig_init();
}
return false;
return STOP_PROCESSING;
break;
case VRSN:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
return STOP_PROCESSING;
break;
case RGB_SLD:
if (record->event.pressed) {
@@ -210,10 +210,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_mode(1);
#endif
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
// Runs just one time when the keyboard initializes.

View File

@@ -14,11 +14,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {
@@ -54,8 +54,8 @@ void matrix_scan_user(void) {
}
__attribute__ ((weak))
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
__attribute__ ((weak))

View File

@@ -132,8 +132,8 @@ void matrix_init_user(void) {
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -12,11 +12,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -250,7 +250,7 @@ void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -259,7 +259,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -268,7 +268,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -291,7 +291,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -314,7 +314,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
TOG_STATUS = false;
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case BACKLIT:
if (record->event.pressed) {
@@ -325,7 +325,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(KC_RSFT);
}
return false;
return STOP_PROCESSING;
break;
case RGB_MOD:
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
@@ -334,10 +334,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_step();
RGB_current_mode = rgblight_config.mode;
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
void matrix_init_user(void) {

View File

@@ -252,7 +252,7 @@ void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -261,7 +261,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -284,7 +284,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -307,7 +307,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
TOG_STATUS = false;
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case BACKLIT:
if (record->event.pressed) {
@@ -318,7 +318,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(KC_RSFT);
}
return false;
return STOP_PROCESSING;
break;
//my attempt for RGB layer lock indication via changing the mode, still have to figure out how to not have other keypress not override this mode
case TG_NUMLAY:
@@ -335,7 +335,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_mode(RGB_current_mode);
layer_off(_NUMLAY); }
}
return false;
return STOP_PROCESSING;
break;
case RGB_MOD:
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
@@ -344,10 +344,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_step();
RGB_current_mode = rgblight_config.mode;
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
void matrix_init_user(void) {

View File

@@ -55,8 +55,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -150,7 +150,7 @@ float tone_colemak[][2] = SONG(COLEMAK_SOUND);
#endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWR:
if (record->event.pressed) {
@@ -159,7 +159,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
layer_off(_CDH);
}
return false;
return STOP_PROCESSING;
break;
case CDH:
@@ -169,7 +169,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
layer_on(_CDH);
}
return false;
return STOP_PROCESSING;
break;
case SYM:
@@ -178,11 +178,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_SYM);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -152,7 +152,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -170,7 +170,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -179,7 +179,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -189,7 +189,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -199,7 +199,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case BACKLIT:
if (record->event.pressed) {
@@ -210,10 +210,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(KC_RSFT);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
};
void matrix_init_user(void) {

View File

@@ -393,8 +393,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -45,7 +45,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
};
bool process_record_user (uint16_t keycode, keyrecord_t *record) {
level_t process_user (uint16_t keycode, keyrecord_t *record) {
switch(keycode) {
case KC_FN0:
if (record->event.pressed) {
@@ -64,5 +64,5 @@ bool process_record_user (uint16_t keycode, keyrecord_t *record) {
}
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -14,11 +14,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -191,7 +191,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -200,7 +200,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -209,7 +209,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -218,7 +218,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -228,7 +228,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -238,7 +238,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case BACKLIT:
if (record->event.pressed) {
@@ -249,10 +249,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(KC_RSFT);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
};
void matrix_init_user(void) {

View File

@@ -79,8 +79,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -14,11 +14,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -1012,7 +1012,7 @@ uint32_t layer_state_set_kb(uint32_t state)
return state;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
static bool lshift = false;
static bool rshift = false;
static uint8_t layer = 0;
@@ -1059,11 +1059,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// double-space enter space layer
case LSPACE:
process_doublespace(record->event.pressed, &lspace_active, &rspace_active, &lspace_emitted);
return false;
return STOP_PROCESSING;
break;
case RSPACE:
process_doublespace(record->event.pressed, &rspace_active, &lspace_active, &rspace_emitted);
return false;
return STOP_PROCESSING;
break;
#endif
@@ -1116,7 +1116,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
unregister_code(KC_COMM);
}
}
return false;
return STOP_PROCESSING;
break;
case KC_DOT:
if (record->event.pressed) {
@@ -1128,7 +1128,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
unregister_code(KC_DOT);
}
}
return false;
return STOP_PROCESSING;
break;
// layout switchers
@@ -1136,14 +1136,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
#ifdef LAYOUT_DVORAK
case DVORAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
#endif
#ifdef LAYOUT_COLEMAK
@@ -1151,7 +1151,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
#endif
#ifdef LAYOUT_WORKMAN
@@ -1159,7 +1159,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_WORKMAN);
}
return false;
return STOP_PROCESSING;
break;
#endif
#ifdef LAYOUT_NORMAN
@@ -1167,7 +1167,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_NORMAN);
}
return false;
return STOP_PROCESSING;
break;
#endif
@@ -1181,7 +1181,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
register_code(keycode);
unregister_code(keycode);
}
return false;
return STOP_PROCESSING;
break;
// layer switcher
@@ -1199,7 +1199,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_GREEKU);
layer_off(_GREEKL);
}
return false;
return STOP_PROCESSING;
break;
// OS switchers
@@ -1208,21 +1208,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef RGBSPS_ENABLE
led_set_unicode_input_mode();
#endif
return false;
return STOP_PROCESSING;
break;
case WIN:
set_unicode_input_mode(UC_WINC);
#ifdef RGBSPS_ENABLE
led_set_unicode_input_mode();
#endif
return false;
return STOP_PROCESSING;
break;
case OSX:
set_unicode_input_mode(UC_OSX);
#ifdef RGBSPS_ENABLE
led_set_unicode_input_mode();
#endif
return false;
return STOP_PROCESSING;
break;
// glow mode changer
@@ -1236,7 +1236,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
led_reset();
rgbsps_send();
}
return false;
return STOP_PROCESSING;
break;
#endif
@@ -1258,11 +1258,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef RGBSPS_DEMO_ENABLE
case RGBDEMO:
led_demo();
return false;
return STOP_PROCESSING;
break;
#endif
}
return true;
return CONTINUE_PROCESSING;
}
void set_output_user(uint8_t output) {

View File

@@ -294,8 +294,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -45,11 +45,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -178,9 +178,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
};
// For Dynamic Macros.
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_dynamic_macro(keycode, record)) {
return false;
return STOP_PROCESSING;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -151,26 +151,26 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -241,8 +241,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
};
bool process_record_user (uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user (uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
// Runs just one time when the keyboard initializes.

View File

@@ -251,13 +251,13 @@ void persistant_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -267,7 +267,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -277,10 +277,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
/*

View File

@@ -288,25 +288,25 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -316,7 +316,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -326,7 +326,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case BACKLIT:
if (record->event.pressed) {
@@ -337,7 +337,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(KC_RSFT);
}
return false;
return STOP_PROCESSING;
break;
case PLOVER:
if (record->event.pressed) {
@@ -352,16 +352,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
return false;
return STOP_PROCESSING;
break;
case EXT_PLV:
if (record->event.pressed) {
layer_off(_PLOVER);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
/*

View File

@@ -147,8 +147,8 @@ void matrix_init_user(void) {
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -1,61 +0,0 @@
// This is the 60% layout preferred by u/merlin36 the host of the MechMerlin YouTube channel.
// The layout is highly influenced by the WKL B.Face and KBP V60 standard layouts.
// Layout designed for use on KC60 with no inswitch or underglow lighting.
#include "kc60.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP( /* Basic QWERTY */
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_NO, KC_RSFT, \
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_NO, MO(2), KC_RALT, KC_RGUI, KC_RCTL \
),
[1] = KEYMAP( /* HHKB-ish Base Layout */
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, \
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_DEL, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_NO, KC_RSFT, \
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_NO, MO(3), KC_RALT, KC_RGUI, KC_RCTL \
),
[2] = KEYMAP( /* FN Layer 1 - Basic QWERTY */
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \
KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_NO, KC_PGUP, \
KC_TRNS, KC_TRNS, KC_TRNS, TG(4), KC_NO, KC_TRNS, KC_HOME, KC_PGDN, KC_END \
),
[3] = KEYMAP( /* FN Layer 2 - HHKB-ish Base Layout */
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, \
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_BSPC, \
KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, KC_NO, KC_TRNS, \
KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_PGDN, KC_DOWN, KC_NO, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \
),
[4] = KEYMAP( /* Arrow Layers - Basic QWERTY ONLY */
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \
KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_UP, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT \
),
[5] = KEYMAP( /* Blank Layer for later usage */
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \
KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \
),
};
const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
return MACRO_NONE;
};

View File

@@ -1,20 +0,0 @@
MechMerlin's KC60 Layout
======================
This is the 60% layout used by u/merlin36, host of the MechMerlin YouTube channel.
It has 5 layers, base QWERTY, base HHKB, FN 1, FN 2(HHKB), and an arrows only layer.
Merlin's KC60 was acquired from Massdrop: https://www.massdrop.com/buy/kc60-mechanical-keyboard and is the Co-Star stabilizer version
If you would like to program your KC60 using the manufacturer recommended approach, please follow the guide on keychatter: https://www.keychatter.com/2015/07/05/programming-the-kc60/.
## Keymap Notes
- Highly influenced by the KBP V60 and WKL B.Face standard layouts
- Does not support any form of inswitch or underglow lighting as Merlin hates them.
- Arrow toggle switch is FN + Space
- Reset is FN + R
- HHKB keymap is approximate as keyboard is not built like HHKB
### Build
To build this keymap, simply run `make KEYMAP=mechmerlin`.

View File

@@ -78,11 +78,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -81,8 +81,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -84,8 +84,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -375,8 +375,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -14,11 +14,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -42,8 +42,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -219,7 +219,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
uint8_t layer;
layer = biton32(layer_state);
if (layer == PROG2) {
@@ -238,5 +238,5 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -14,11 +14,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -88,8 +88,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -88,8 +88,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -29,11 +29,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_init_ports(void) {

View File

@@ -201,7 +201,7 @@ void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -210,7 +210,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -219,7 +219,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -228,7 +228,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -247,7 +247,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -266,7 +266,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
TOG_STATUS = false;
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case BACKLIT:
if (record->event.pressed) {
@@ -277,7 +277,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(KC_RSFT);
}
return false;
return STOP_PROCESSING;
break;
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
case RGB_MOD:
@@ -286,10 +286,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rgblight_step();
RGB_current_mode = rgblight_config.mode;
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}
void matrix_init_user(void) {

View File

@@ -152,7 +152,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -170,7 +170,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -179,7 +179,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -189,7 +189,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -199,7 +199,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -207,8 +207,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -152,7 +152,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -170,7 +170,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -179,7 +179,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -189,7 +189,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -199,7 +199,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -207,8 +207,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -143,7 +143,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -152,7 +152,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -170,7 +170,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -180,7 +180,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -190,7 +190,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -198,8 +198,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -173,7 +173,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -182,7 +182,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -191,7 +191,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -200,7 +200,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -210,7 +210,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -220,7 +220,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -228,8 +228,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -157,7 +157,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -166,7 +166,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -175,7 +175,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -184,7 +184,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -194,7 +194,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -204,7 +204,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -212,8 +212,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -1,19 +0,0 @@
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
USE_I2C = yes
TAP_DANCE_ENABLE = yes
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View File

@@ -1,47 +0,0 @@
/*
This is the c configuration file for the keymap
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
*/
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
#define TAPPING_TOGGLE 1
#define TAPPING_TERM 200
#define ONESHOT_TAP_TOGGLE 2
#define ONESHOT_LAYER_TOGGLE 2
#define ONESHOT_TIMEOUT 300
/* Use I2C or Serial, not both */
// #define USE_SERIAL
#define USE_I2C
#define MOUSEKEY_INTERVAL 50
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 7
#define MOUSEKEY_WHEEL_DELAY 0
#define MOUSEKEY_WHEEL_MAX_SPEED 8
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
// #define MASTER_LEFT
// #define _MASTER_RIGHT
#define EE_HANDS
#define PREVENT_STUCK_MODIFIERS
//#define IGNORE_MOD_TAP_INTERRUPT
#define PERMISSIVE_HOLD
#endif

View File

@@ -1,353 +0,0 @@
#include "lets_split.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
#define _COLEMAK 0
#define _KAMELOC 1
#define _IKAPILA 2
#define _IKASHFT 3
#define _ARROWKY 4
#define _FNCTION 5
#define _NINEKEY 6
#define _NAVIGAT 7
#define _QWERTY 8
#define _GRVTABL 15
enum custom_keycodes {
COLEMAK = SAFE_RANGE,
KAMELOC,
IKAPILA,
IKASHFT,
ARROWKY,
FNCTION,
NINEKEY,
NAVIGAT,
QWERTY,
GRVTABL,
};
//TD Declarations
enum {
VOM = 0,
PRN,
EGT,
HRD,
DSH,
QUT,
ESC,
EQE,
PGN,
UND,
BSDEL,
bsdel_mods,
BOOTME,
};
#define _______ KC_TRNS
#define XXXXXXX KC_NO
// action-TAP for key/mod behavior LT(layer, kc)
#define XK_TAB LT(_FNCTION, KC_TAB)
#define XK_BSP LT(_KAMELOC, M(3))
#define XK_HARD LT(_FNCTION, M(1))
#define XK_SPC LT(_IKAPILA, KC_SPC)
#define XK_ENT LT(_IKAPILA, KC_ENT)
#define XK_PGDN LT(_NAVIGAT, TD(PGN))
#define XK_PREN LT(_IKASHFT, M(0))
#define PIPBOY LT(_FNCTION, KC_BSLS)
#define XK_DEL LT(_KAMELOC, KC_DEL)
#define XK_GRV LT(_GRVTABL, KC_GRV)
// mod-TAP for mod/key behavior MT(modkey, kc)
#define ESC_IT MT(MOD_MEH, TD(ESC))
#define ALT_IT MT(MOD_LALT, KC_SCLN)
#define CTL_IT MT(MOD_LCTL, KC_SLSH)
#define XK_EGPT MT((MOD_LCTL | MOD_LALT | MOD_LGUI), M(2))
#define SFT_IT MT(MOD_RSFT, TG(_NAVIGAT))
#define SFT_ENT MT(MOD_RSFT, KC_ENT)
//sticky modifiers
#define KYCTL OSM(MOD_LCTL)
#define KYGUI OSM(MOD_LGUI)
#define KYSFT OSM(MOD_LSFT)
#define KYALT OSM(MOD_LALT)
#define CAKY OSM(MOD_LCTL | MOD_LALT)
//shortcuts
#define CADEL LALT(LCTL(KC_DEL))
#define CAINS LALT(LCTL(KC_INS))
#define TGNKRO MAGIC_TOGGLE_NKRO
#define NAVCH LCTL(KC_HOME)
#define NAVCPD LCTL(KC_PGDN)
#define NAVCPU LCTL(KC_PGUP)
#define NAVCE LCTL(KC_END)
#define NAVCU LCTL(KC_UP)
#define NAVCD LCTL(KC_DOWN)
#define NAVCL LCTL(KC_LEFT)
#define NAVCR LCTL(KC_RGHT)
#define NAVGU LGUI(KC_UP)
#define NAVGD LGUI(KC_DOWN)
#define NAVGL LGUI(KC_LEFT)
#define NAVGR LGUI(KC_RGHT)
#define KC_NDSH LCTL(KC_PMNS)
#define KC_MDSH LALT(LCTL(KC_PMNS))
//!not sure if this old TMK code will work
//#define BOOTME ACTION_FUNCTION(BOOTLOADER)
#define LCLEAR ACTION_LAYER_SET_CLEAR(0)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
TAP
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│TAB │ Q │ W │ F │ P │ B │ │ J │ L │ U │ Y │ ; │DEL │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│BKSP│ A │ R │ S │ T │ G │ │ M │ N │ E │ I │ O │ ' │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│OSFT│ X │ C │ D │ V │ Z │ │ K │ H │ , │ . │ / │LNAV│
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│OCTL│OALT│L9KY│ [] │OGUI│SPC │ │ENT │PGDN│ () │ {} │ \ │ ` │
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
HOLD
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│L FN│ │ │ │ │ │ │ │ │ │ │ALT │L!@#│
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│L OH│ │ │ │ │ │ │ │ │ │ │ │L OH│
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│SFT │ │ │ │ │ │ │ │ │ │ │CTL │SFT │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│CTL │ALT │L9KY│L!@#│GUI │L123│ │L123│LNAV│L!@#│MEH │L FN│LGRV│
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
DOUBLETAP
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│ │!F4 │ │ │ │ │ │ │ │ │ │ │ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│OSML│ │ │ │ │UNDO│ │ │ │ │ │ │ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│OSML│OSML│ESC │ │OSML│ │ │ │PGUP│ │ │ │ │
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
Switch type
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│Br │Z │Z │Z │Z │Z │ │Z │Z │Z │Z │Br │G │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│G │Z │Z │Z │Z │Z │ │Z │Z │Z │Z │Z │Z │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│Y │Z │Z │Z │Z │Z │ │Z │Z │Z │Z │B │Y │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│Y │Y │C │Z │BLK │BLK │ │BLK │BLK │Z │Z │B │G │
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
*/
// Colemak PB&J (Mod-DH)
[_COLEMAK] = KEYMAP( \
XK_TAB, TD(QUT), KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, ALT_IT, XK_GRV, \
XK_BSP, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, XK_DEL, \
KYSFT, KC_X, KC_C, KC_D, KC_V, TD(UND), KC_K, KC_H, KC_COMM, KC_DOT, CTL_IT, SFT_IT, \
KYCTL, KYALT, ESC_IT, XK_HARD, KYGUI, XK_SPC, XK_ENT, XK_PGDN, XK_PREN, XK_EGPT, PIPBOY, XK_GRV \
),
// useful for one-handed typing
[_KAMELOC] = KEYMAP( \
_______, KC_SCLN, KC_Y, KC_U, KC_L, KC_J, KC_B, KC_P, KC_F, KC_W, TD(QUT), _______, \
_______, KC_O, KC_I, KC_E, KC_N, KC_M, KC_G, KC_T, KC_S, KC_R, KC_A, _______, \
_______, KC_SLSH, KC_DOT, KC_COMM, KC_H, KC_K, TD(UND), KC_V, KC_D, KC_C, KC_X, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
/*
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│ ~ │ 1 │ 2 │ 3 │ 4 │ 5 │ │ 6 │ 7 │ 8 │ 9 │ 0 │ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │DASH│MV- │ V+ │NEXT│PLAY│ │ ← │ ↓ │ ↑ │ → │INS │ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ - │ = │ [ │ ] │ \ │ │HOME│PGDN│PGUP│END │ \ │ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
*/
[_IKAPILA] = KEYMAP( \
KC_TILD, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \
_______, TD(DSH), TD(VOM), KC_VOLU, KC_MNXT, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_INS, _______, \
_______, KC_MINS, KC_EQL, TD(HRD), KC_RBRC, KC_BSLS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_BSLS, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
/*
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│ │ ! │ @ │ # │ $ │ % │ │ ^ │ & │ * │ ( │ ) │ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │DASH│MV- │ V+ │NEXT│PLAY│ │HOME│PGDN│PGUP│END │PSCR│ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ _ │ + │ { │ } │ | │ │ ← │ ↓ │ ↑ │ → │ │ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
*/
[_IKASHFT] = KEYMAP( \
_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
KC_DEL, TD(DSH), TD(VOM), KC_VOLU, KC_MNXT, KC_MPLY, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_PSCR, _______, \
_______, KC_UNDS, KC_PLUS, TD(EGT), KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_PAUS, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
/*
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│ │ → │ ↑ │ ← │ ↓ │ → │ │ → │ ↓ │ ← │ ↑ │ ↑ │ │ just in case someone hacks my IP with a 10MeG pipe, you know?
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ ← │ ↓ │ → │ ↑ │ ← │ │ ↑ │ ← │ ↓ │ → │ ← │ │ hacker_evasion layer
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ >>init network SEQUENCE
│ │ ↑ │ ← │ ↓ │ → │ ↑ │ │ ↓ │ ← │ ↑ │ → │ ← │ │ sleep 11; echo "DONE\n"
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ throttle INPUT 11001001 OUTPUT 010011001 ? FULL )); \
│ │ │ │ → │ ← │ ↓ │ │ → │ ↑ │ ← │ ↓ │ ↑ │ │ <<chkconfig cargoCode ==== "'1'"
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘ up down left right kc_b kc_a GUI
*/
[_ARROWKY] = KEYMAP( \
_______, KC_RGHT, KC_UP, KC_LEFT, KC_DOWN, KC_RGHT, KC_UP, KC_LEFT, KC_DOWN, KC_RGHT, KC_UP, _______, \
_______, KC_LEFT, KC_DOWN, KC_RGHT, KC_UP, KC_LEFT, KC_DOWN, KC_RGHT, KC_UP, KC_LEFT, KC_DOWN, _______, \
_______, KC_UP, KC_LEFT, KC_DOWN, KC_RGHT, KC_UP, KC_LEFT, KC_DOWN, KC_RGHT, KC_UP, KC_LEFT, _______, \
_______, _______, KC_RGHT, KC_UP, KC_LEFT, KC_DOWN, KC_RGHT, KC_UP, KC_LEFT, KC_DOWN, KC_RGHT, _______ \
),
/*
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│ │ F1 │ F2 │ F3 │ F4 │ F5 │ │ F6 │ F7 │ F8 │ F9 │ F10│ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ F11│ F12│ F13│ F14│ F15│ │ F16│ F17│ F18│ F19│ F20│ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ F21│ F22│ F23│ F24│PAUS│ │ │ │BOOT│RSET│NKRO│CAPS│
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
*/
[_FNCTION] = KEYMAP( \
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, \
_______, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, _______, \
_______, KC_F21, KC_F22, KC_F23, KC_F24, _______, _______, _______,M(BOOTME), RESET, TGNKRO, KC_CAPS, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
/*
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│ │ → │ F7 │ F8 │ F9 │ ↑ │ │NLCK│ P7 │ P8 │ P9 │ P- │BDEL│
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ ← │ F4 │ F5 │ F6 │ ↓ │ │^INS│ P4 │ P5 │ P6 │ P+ │ () │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │CALT│ F1 │ F2 │ F3 │ │ │CALT│ P1 │ P2 │ P3 │ P* │ = │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ │ F0?│ │ │ │ │TGL │ P0 │ 0 │ P. │ P/ │ │
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
*/
[_NINEKEY] = KEYMAP( \
_______, KC_RGHT, KC_F7, KC_F8, KC_F9, KC_UP, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, M(BSDEL), \
_______, KC_LEFT, KC_F4, KC_F5, KC_F6, KC_DOWN, CAINS, KC_P4, KC_P5, KC_P6, KC_PPLS, XK_PREN, \
_______, CAKY, KC_F1, KC_F2, KC_F3, _______, CAKY, KC_P1, KC_P2, KC_P3, KC_PAST, TD(EQE), \
_______, _______, _______, KC_F11, _______, _______, TG(_NINEKEY), KC_P0, KC_0, KC_PDOT, KC_PSLS, _______ \
),
/*
┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
│ESC │^PGD│^UP │^PGU│^PGU│^HOM│ │ │MW_L│ MU │MW_R│ AC2│ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │^LFT│^DWN│^RGT│^PGD│^END│ │ │ ML │ MD │ MR │ AC1│ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ M2 │ M4 │ M3 │ M1 │ M5 │ │ │MW_D│MW_U│SLCK│ AC0│ │
├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
│ │ │ │ │ │ │ │ │ │ │ │ │ │
└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
*/
[_NAVIGAT] = KEYMAP( \
KC_ESC, NAVCPD, NAVCU, NAVCPU, NAVCPU, NAVCH, XXXXXXX, KC_WH_L, KC_MS_U, KC_WH_R, KC_ACL2, _______, \
_______, NAVCL, NAVCD, NAVCR, NAVCPD, NAVCE, XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_R, KC_ACL1, _______, \
_______, KC_BTN2, KC_BTN4, KC_BTN3, KC_BTN1, KC_BTN5, XXXXXXX, KC_WH_D, KC_WH_U, KC_SLCK, KC_ACL0, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
//ew. jk
[_QWERTY] = KEYMAP( \
_______, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
_______, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
/*
//add greek symbols
//set_unicode_input_mode(UC_WINC); // Windows (with WinCompose, see wiki)
//UC(0x250C),UC(0x252C),UC(0x2510),UC(0x2500),UC(0x2502)
//UC(0x251C),UC(0x253C),UC(0x2524),
//UC(0x2514),UC(0x2534),UC(0x2518),
*/
[_GRVTABL] = KEYMAP( \
TG(5), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), \
TG(1), XXXXXXX, TD(VOM), KC_VOLU, KC_MNXT, KC_MPLY, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(1), \
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(0), XXXXXXX, TG(4), XXXXXXX, TG(8), LCLEAR, \
XXXXXXX, XXXXXXX, TG(6), TG(3), XXXXXXX, TG(2), TG(2), TG(7), TG(3), OSM(MOD_MEH), TG(5), _______ \
)};
qk_tap_dance_action_t tap_dance_actions[] = {
[VOM] = ACTION_TAP_DANCE_DOUBLE(KC_VOLD, KC_MUTE),
[PRN] = ACTION_TAP_DANCE_DOUBLE(KC_LPRN, KC_RPRN),
[EGT] = ACTION_TAP_DANCE_DOUBLE(KC_LCBR, KC_RCBR),
[HRD] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, KC_RBRC),
[DSH] = ACTION_TAP_DANCE_DOUBLE(KC_NDSH, KC_MDSH),
[QUT] = ACTION_TAP_DANCE_DOUBLE(KC_Q, LALT(KC_F4)),
[ESC] = ACTION_TAP_DANCE_DOUBLE(TT(_NINEKEY), KC_ESC),
[EQE] = ACTION_TAP_DANCE_DOUBLE(KC_EQL, KC_ENT),
[PGN] = ACTION_TAP_DANCE_DOUBLE(KC_PGDN, KC_PGUP),
[UND] = ACTION_TAP_DANCE_DOUBLE(KC_Z, LCTL(KC_Z)),
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
if (record->event.pressed) {
switch(id) {
case 0:
return MACRO(D(LSHIFT),T(9), T(0),U(LSHIFT), T(LEFT), END);
case 1:
return MACRO(T(LBRC), T(RBRC), T(LEFT), END);
case 2:
return MACRO(D(LSHIFT),T(LBRC), T(RBRC),U(LSHIFT), T(ENT), T(UP), END);
case 3:
return MACRO(T(BSPC), END);
/* static bool bsdel_mods = false;
case BSDEL: {
uint8_t kc = KC_BSPC;
if (record->event.pressed) {
if (keyboard_report->mods) {
kc = KC_DEL;
}
register_code (kc);
bsdel_mods = keyboard_report->mods;
}
else {
if (bsdel_mods) {
kc = KC_DEL;
}
unregister_code (kc);
}
}
*/ case 4:
if (!record->event.pressed) {
// bootloader();
}
}
}
return MACRO_NONE;
};

View File

@@ -146,25 +146,25 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -174,7 +174,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -184,8 +184,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -21,7 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include "wait.h"
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "print.h"
#include "debug.h"
#include "util.h"
@@ -29,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "split_util.h"
#include "pro_micro.h"
#include "config.h"
#include "timer.h"
#ifdef USE_I2C
# include "i2c.h"
@@ -37,29 +38,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "serial.h"
#endif
#ifndef DEBOUNCING_DELAY
# define DEBOUNCING_DELAY 5
#ifndef DEBOUNCE
# define DEBOUNCE 5
#endif
#if (DEBOUNCING_DELAY > 0)
static uint16_t debouncing_time;
static bool debouncing = false;
#endif
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
# define matrix_bitpop(i) bitpop(matrix[i])
# define ROW_SHIFTER ((uint8_t)1)
#else
# error "Currently only supports 8 COLS"
#endif
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
#define ERROR_DISCONNECT_COUNT 5
#define ROWS_PER_HAND (MATRIX_ROWS/2)
static uint8_t debouncing = DEBOUNCE;
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
static uint8_t error_count = 0;
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
@@ -69,19 +55,11 @@ static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
static matrix_row_t matrix[MATRIX_ROWS];
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
#if (DIODE_DIRECTION == COL2ROW)
static void init_cols(void);
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
static void unselect_rows(void);
static void select_row(uint8_t row);
static void unselect_row(uint8_t row);
#elif (DIODE_DIRECTION == ROW2COL)
static void init_rows(void);
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
static void unselect_cols(void);
static void unselect_col(uint8_t col);
static void select_col(uint8_t col);
#endif
static matrix_row_t read_cols(void);
static void init_cols(void);
static void unselect_rows(void);
static void select_row(uint8_t row);
__attribute__ ((weak))
void matrix_init_quantum(void) {
matrix_init_kb();
@@ -140,54 +118,33 @@ void matrix_init(void)
}
matrix_init_quantum();
}
uint8_t _matrix_scan(void)
{
// Right hand is stored after the left in the matirx so, we need to offset it
int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
#if (DIODE_DIRECTION == COL2ROW)
// Set row, read cols
for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
# if (DEBOUNCING_DELAY > 0)
bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row);
if (matrix_changed) {
debouncing = true;
debouncing_time = timer_read();
PORTD ^= (1 << 2);
}
# else
read_cols_on_row(matrix+offset, current_row);
# endif
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
select_row(i);
_delay_us(30); // without this wait read unstable value.
matrix_row_t cols = read_cols();
if (matrix_debouncing[i+offset] != cols) {
matrix_debouncing[i+offset] = cols;
debouncing = DEBOUNCE;
}
unselect_rows();
}
#elif (DIODE_DIRECTION == ROW2COL)
// Set col, read rows
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
# if (DEBOUNCING_DELAY > 0)
bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col);
if (matrix_changed) {
debouncing = true;
debouncing_time = timer_read();
}
# else
read_rows_on_col(matrix+offset, current_col);
# endif
}
#endif
# if (DEBOUNCING_DELAY > 0)
if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
if (debouncing) {
if (--debouncing) {
_delay_ms(1);
} else {
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
matrix[i+offset] = matrix_debouncing[i+offset];
}
debouncing = false;
}
# endif
}
return 1;
}
@@ -243,7 +200,9 @@ int serial_transaction(void) {
uint8_t matrix_scan(void)
{
uint8_t ret = _matrix_scan();
int ret = _matrix_scan();
#ifdef USE_I2C
if( i2c_transaction() ) {
@@ -274,10 +233,11 @@ uint8_t matrix_scan(void)
void matrix_slave_scan(void) {
_matrix_scan();
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2);
#ifdef USE_I2C
for (int i = 0; i < ROWS_PER_HAND; ++i) {
/* i2c_slave_buffer[i] = matrix[offset+i]; */
i2c_slave_buffer[i] = matrix[offset+i];
}
#else // USE_SERIAL
@@ -324,141 +284,33 @@ uint8_t matrix_key_count(void)
return count;
}
#if (DIODE_DIRECTION == COL2ROW)
static void init_cols(void)
static void init_cols(void)
{
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
uint8_t pin = col_pins[x];
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
for(int x = 0; x < MATRIX_COLS; x++) {
_SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
_SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
}
}
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
static matrix_row_t read_cols(void)
{
// Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[current_row];
// Clear data in matrix row
current_matrix[current_row] = 0;
// Select row and wait for row selecton to stabilize
select_row(current_row);
wait_us(30);
// For each col...
for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
// Select the col pin to read (active low)
uint8_t pin = col_pins[col_index];
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
// Populate the matrix row with the state of the col pin
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
matrix_row_t result = 0;
for(int x = 0; x < MATRIX_COLS; x++) {
result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
}
// Unselect row
unselect_row(current_row);
return (last_row_value != current_matrix[current_row]);
}
static void select_row(uint8_t row)
{
uint8_t pin = row_pins[row];
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
}
static void unselect_row(uint8_t row)
{
uint8_t pin = row_pins[row];
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
return result;
}
static void unselect_rows(void)
{
for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
uint8_t pin = row_pins[x];
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
for(int x = 0; x < ROWS_PER_HAND; x++) {
_SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
_SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
}
}
#elif (DIODE_DIRECTION == ROW2COL)
static void init_rows(void)
static void select_row(uint8_t row)
{
for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
uint8_t pin = row_pins[x];
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
}
_SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
_SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
}
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
{
bool matrix_changed = false;
// Select col and wait for col selecton to stabilize
select_col(current_col);
wait_us(30);
// For each row...
for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++)
{
// Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[row_index];
// Check row pin state
if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0)
{
// Pin LO, set col bit
current_matrix[row_index] |= (ROW_SHIFTER << current_col);
}
else
{
// Pin HI, clear col bit
current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
}
// Determine if the matrix changed state
if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
{
matrix_changed = true;
}
}
// Unselect col
unselect_col(current_col);
return matrix_changed;
}
static void select_col(uint8_t col)
{
uint8_t pin = col_pins[col];
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
}
static void unselect_col(uint8_t col)
{
uint8_t pin = col_pins[col];
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
}
static void unselect_cols(void)
{
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
uint8_t pin = col_pins[x];
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
}
}
#endif

View File

@@ -8,7 +8,6 @@
#include "matrix.h"
#include "keyboard.h"
#include "config.h"
#include "timer.h"
#ifdef USE_I2C
# include "i2c.h"
@@ -43,7 +42,6 @@ static void keyboard_master_setup(void) {
}
static void keyboard_slave_setup(void) {
timer_init();
#ifdef USE_I2C
i2c_slave_init(SLAVE_I2C_ADDRESS);
#else

View File

@@ -124,7 +124,7 @@ void persistant_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -133,7 +133,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -143,7 +143,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -153,7 +153,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -161,8 +161,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -132,7 +132,7 @@ void persistant_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -141,7 +141,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -151,7 +151,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -169,8 +169,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -137,7 +137,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
static bool singular_key = false;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
uint8_t layer;
layer = biton32(layer_state); // get the current layer
@@ -155,7 +155,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
update_tri_layer(_FUNCTION, _SHIFTED, _FUNCSHIFT);
return false;
return STOP_PROCESSING;
break;
//SHIFT is handled as LSHIFT in the general case
case SHIFT:
@@ -171,7 +171,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
update_tri_layer(_FUNCTION, _SHIFTED, _FUNCSHIFT);
return false;
return STOP_PROCESSING;
break;
//If any other key was pressed during the layer mod hold period,
@@ -195,7 +195,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
return true;
return CONTINUE_PROCESSING;
};
void matrix_scan_user(void) {

View File

@@ -80,8 +80,8 @@ void matrix_init_user(void) {
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -80,8 +80,8 @@ void matrix_init_user(void) {
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -142,8 +142,8 @@ void matrix_init_user(void) {
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -14,11 +14,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_set_kb(uint8_t usb_led) {

View File

@@ -170,7 +170,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -179,7 +179,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -188,7 +188,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -197,7 +197,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -207,7 +207,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -217,7 +217,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -225,8 +225,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -156,7 +156,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -165,7 +165,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -174,7 +174,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -183,7 +183,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -193,7 +193,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -203,7 +203,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -211,8 +211,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -91,7 +91,7 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
@@ -100,7 +100,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
return STOP_PROCESSING;
break;
case COLEMAK:
if (record->event.pressed) {
@@ -109,7 +109,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
return STOP_PROCESSING;
break;
case DVORAK:
if (record->event.pressed) {
@@ -118,7 +118,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
return STOP_PROCESSING;
break;
case LOWER:
if (record->event.pressed) {
@@ -128,7 +128,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case RAISE:
if (record->event.pressed) {
@@ -138,7 +138,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
return STOP_PROCESSING;
break;
case ADJUST:
if (record->event.pressed) {
@@ -146,8 +146,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_off(_ADJUST);
}
return false;
return STOP_PROCESSING;
break;
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -98,15 +98,15 @@ void matrix_scan_user(void)
}
/* Mixes in KM_HAXHAX via RALT modifier without shadowing the RALT key combinations. */
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
uint8_t modifiers = get_mods();
if (modifiers & MOD_BIT(KC_RALT) && record->event.pressed) {
uint16_t kc = keymap_key_to_keycode(KM_HAXHAX, record->event.key);
if (kc != KC_TRNS) {
register_code(kc);
unregister_code(kc);
return false;
return STOP_PROCESSING;
}
}
return true;
return CONTINUE_PROCESSING;
}

View File

@@ -68,8 +68,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -68,8 +68,8 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
level_t process_user(uint16_t keycode, keyrecord_t *record) {
return CONTINUE_PROCESSING;
}
void led_set_user(uint8_t usb_led) {

View File

@@ -29,11 +29,11 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
return CONTINUE_PROCESSING;
}
void led_init_ports(void) {

View File

@@ -339,18 +339,18 @@ void plover_lookup(void) {
unregister_code(PV_RG);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
level_t process_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<BASE_QWERTY_LAYER);
}
return false;
return STOP_PROCESSING;
case COLEMAK:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<BASE_COLEMAK_LAYER);
}
return false;
return STOP_PROCESSING;
case LOWER:
if (record->event.pressed) {
layer_on(LOWER_LAYER);
@@ -359,7 +359,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(LOWER_LAYER);
update_tri_layer(LOWER_LAYER, RAISE_LAYER, KEYBOARD_LAYER);
}
return false;
return STOP_PROCESSING;
case RAISE:
if (record->event.pressed) {
layer_on(RAISE_LAYER);
@@ -368,7 +368,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(RAISE_LAYER);
update_tri_layer(LOWER_LAYER, RAISE_LAYER, KEYBOARD_LAYER);
}
return false;
return STOP_PROCESSING;
case STENO:
if (record->event.pressed) {
layer_off(RAISE_LAYER);
@@ -383,20 +383,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
eeconfig_update_keymap(keymap_config.raw);
plover_resume();
}
return false;
return STOP_PROCESSING;
case PV_EXIT:
if (record->event.pressed) {
plover_suspend();
layer_off(BASE_STENO_LAYER);
}
return false;
return STOP_PROCESSING;
case PV_LOOK:
if (record->event.pressed) {
plover_lookup();
}
return false;
return STOP_PROCESSING;
}
return true;
return CONTINUE_PROCESSING;
}
void matrix_init_user(void) {

Some files were not shown because too many files have changed in this diff Show More