Basic keymap (no FN). Compiles.
parent
c796944354
commit
714e0da960
|
@ -1,162 +0,0 @@
|
||||||
#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
|
|
|
@ -1,49 +0,0 @@
|
||||||
#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 400000L
|
|
||||||
|
|
||||||
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
|
||||||
|
|
||||||
void i2c_master_init(void);
|
|
||||||
uint8_t i2c_master_start(uint8_t address);
|
|
||||||
void i2c_master_stop(void);
|
|
||||||
uint8_t i2c_master_write(uint8_t data);
|
|
||||||
uint8_t i2c_master_read(int);
|
|
||||||
void i2c_reset_state(void);
|
|
||||||
void i2c_slave_init(uint8_t address);
|
|
||||||
|
|
||||||
|
|
||||||
static inline unsigned char i2c_start_read(unsigned char addr) {
|
|
||||||
return i2c_master_start((addr << 1) | I2C_READ);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned char i2c_start_write(unsigned char addr) {
|
|
||||||
return i2c_master_start((addr << 1) | I2C_WRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// from SSD1306 scrips
|
|
||||||
extern unsigned char i2c_rep_start(unsigned char addr);
|
|
||||||
extern void i2c_start_wait(unsigned char addr);
|
|
||||||
extern unsigned char i2c_readAck(void);
|
|
||||||
extern unsigned char i2c_readNak(void);
|
|
||||||
extern unsigned char i2c_read(unsigned char ack);
|
|
||||||
|
|
||||||
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -7,148 +7,97 @@ extern keymap_config_t keymap_config;
|
||||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||||
// entirely and just use numbers.
|
// entirely and just use numbers.
|
||||||
#define _QWERTY 0
|
#define _QWERTY 0
|
||||||
#define _COLEMAK 1
|
#define _NUMPAD 1
|
||||||
#define _DVORAK 2
|
|
||||||
#define _LOWER 3
|
|
||||||
#define _RAISE 4
|
#define _RAISE 4
|
||||||
#define _ADJUST 16
|
|
||||||
|
|
||||||
enum custom_keycodes {
|
enum custom_keycodes {
|
||||||
QWERTY = SAFE_RANGE,
|
QWERTY = SAFE_RANGE,
|
||||||
COLEMAK,
|
NUMPAD,
|
||||||
DVORAK,
|
RAISE
|
||||||
LOWER,
|
|
||||||
RAISE,
|
|
||||||
ADJUST,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fillers to make layering more clear
|
// Fillers to make layering more clear
|
||||||
#define _______ KC_TRNS
|
#define _______ KC_TRNS
|
||||||
#define XXXXXXX KC_NO
|
#define XXXXXXX KC_NO
|
||||||
|
#define NP_STAR KC_KP_ASTERISK
|
||||||
|
#define NP_SLSH KC_KP_SLASH
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
/* Qwerty
|
/*
|
||||||
* ,-----------------------------------------------------------------------------------.
|
* ,-----------------------------------------------------------.
|
||||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
|
* |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
|
||||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |
|
||||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
|
* |FN | A| S| D| F| G| H| J| K| L| ;| '|Return |
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* |Adjust| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
|
* |Shift | Z| X| C| V| B| N| M| ,| .| /| Shift |
|
||||||
* `-----------------------------------------------------------------------------------'
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl|Gui |Alt | NUM | Space | Space |Alt |FN |Menu |Ctrl |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
[_QWERTY] = LAYOUT_ortho_4x12(
|
/* Layer 0: Qwerty */
|
||||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
|
[_QWERTY] = LAYOUT_split60( \
|
||||||
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
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, \
|
||||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
RAISE, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
|
||||||
),
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \
|
||||||
|
KC_LCTL, KC_LGUI, KC_LALT, NUMPAD, KC_SPC, KC_SPC, KC_RALT, RAISE, KC_MENU, KC_RCTL \
|
||||||
|
),
|
||||||
|
|
||||||
/* Colemak
|
/*
|
||||||
* ,-----------------------------------------------------------------------------------.
|
* ,-----------------------------------------------------------.
|
||||||
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
|
* | | | | | | | | | /| *| -| | | |
|
||||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* | Esc | A | R | S | T | D | H | N | E | I | O | ' |
|
* | | | | | | | | 7| 8| 9| +| | | |
|
||||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
|
* | | | | | | | | 4| 5| 6|Bspc| |Return |
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
|
* | | | | | | | | 1| 2| 3| .| |
|
||||||
* `-----------------------------------------------------------------------------------'
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | QWE | | 0 | . | | | |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
[_COLEMAK] = LAYOUT_ortho_4x12( \
|
|
||||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
|
|
||||||
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
|
|
||||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
|
||||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
|
||||||
),
|
|
||||||
|
|
||||||
/* Dvorak
|
/* Layer 1: Numpad */
|
||||||
* ,-----------------------------------------------------------------------------------.
|
[_NUMPAD] = LAYOUT_split60( \
|
||||||
* | Tab | ' | , | . | P | Y | F | G | C | R | L | Bksp |
|
_______, _______, _______, _______, _______, _______, _______, _______, NP_SLSH, NP_STAR, KC_MINUS, _______, _______, KC_BSPC, \
|
||||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
_______, _______, _______, _______, _______, _______, _______, KC_7, KC_8, KC_9, KC_PLUS, _______, _______, KC_BSLS, \
|
||||||
* | Esc | A | O | E | U | I | D | H | T | N | S | / |
|
_______, _______, _______, _______, _______, _______, _______, KC_4, KC_5, KC_6, KC_BSPC, _______, _______, \
|
||||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
_______, _______, _______, _______, _______, _______, _______, KC_1, KC_2, KC_3, KC_DOT, _______, \
|
||||||
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
|
_______, _______, _______, QWERTY, KC_SPC, KC_0, KC_DOT, RAISE, _______, _______ \
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
),
|
||||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
|
|
||||||
* `-----------------------------------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
[_DVORAK] = LAYOUT_ortho_4x12( \
|
|
||||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
|
|
||||||
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
|
|
||||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
|
||||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
|
||||||
),
|
|
||||||
|
|
||||||
/* Lower
|
/*
|
||||||
* ,-----------------------------------------------------------------------------------.
|
* ,-----------------------------------------------------------.
|
||||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del |
|
* | | | | | | | | | | | | | | |
|
||||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
|
* | | | ^ | | | | |pUp| ^ |pDn| | | | |
|
||||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | | |
|
* | | < | v | > | | |Hom| < | v | > | | | |
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
* |-----------------------------------------------------------|
|
||||||
* | | | | | | | | Next | Vol- | Vol+ | Play |
|
* | | | | | | |End| | | | | |
|
||||||
* `-----------------------------------------------------------------------------------'
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | | | | | | | |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
[_LOWER] = LAYOUT_ortho_4x12( \
|
|
||||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
|
|
||||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
|
||||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \
|
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
|
||||||
),
|
|
||||||
|
|
||||||
/* Raise
|
/* Layer 2: RAISE */
|
||||||
* ,-----------------------------------------------------------------------------------.
|
[_RAISE] = LAYOUT_split60( \
|
||||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del |
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
|
||||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | | |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | | | | | | | | Next | Vol- | Vol+ | Play |
|
|
||||||
* `-----------------------------------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
[_RAISE] = LAYOUT_ortho_4x12( \
|
|
||||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
|
||||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
|
||||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
|
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
|
||||||
),
|
|
||||||
|
|
||||||
/* Adjust (Lower + Raise)
|
|
||||||
* ,-----------------------------------------------------------------------------------.
|
|
||||||
* | | Reset| | | | | | | | | | Del |
|
|
||||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
|
||||||
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
|
|
||||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
|
||||||
* | | | | | | | | | | | | |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | | | | | | | | | | | |
|
|
||||||
* `-----------------------------------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
[_ADJUST] = LAYOUT_ortho_4x12( \
|
|
||||||
_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
|
|
||||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
|
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
float tone_numpad[][2] = SONG(DVORAK_SOUND);
|
||||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void persistent_default_layer_set(uint16_t default_layer) {
|
|
||||||
eeconfig_update_default_layer(default_layer);
|
|
||||||
default_layer_set(default_layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case QWERTY:
|
case QWERTY:
|
||||||
|
@ -156,53 +105,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
PLAY_SONG(tone_qwerty);
|
PLAY_SONG(tone_qwerty);
|
||||||
#endif
|
#endif
|
||||||
persistent_default_layer_set(1UL<<_QWERTY);
|
default_layer_set(1UL<<_QWERTY);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case COLEMAK:
|
case NUMPAD:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
PLAY_SONG(tone_colemak);
|
PLAY_SONG(tone_numpad);
|
||||||
#endif
|
#endif
|
||||||
persistent_default_layer_set(1UL<<_COLEMAK);
|
default_layer_set(1UL<<_NUMPAD);
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case DVORAK:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
PLAY_SONG(tone_dvorak);
|
|
||||||
#endif
|
|
||||||
persistent_default_layer_set(1UL<<_DVORAK);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case LOWER:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
layer_on(_LOWER);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
} else {
|
|
||||||
layer_off(_LOWER);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case RAISE:
|
case RAISE:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
layer_on(_RAISE);
|
layer_on(_RAISE);
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
} else {
|
} else {
|
||||||
layer_off(_RAISE);
|
layer_off(_RAISE);
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case ADJUST:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
layer_on(_ADJUST);
|
|
||||||
} else {
|
|
||||||
layer_off(_ADJUST);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,16 +1 @@
|
||||||
#include "lets_split.h"
|
#include "lets_split.h"
|
||||||
|
|
||||||
#ifdef SWAP_HANDS_ENABLE
|
|
||||||
__attribute__ ((weak))
|
|
||||||
const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
|
|
||||||
{{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}},
|
|
||||||
{{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}},
|
|
||||||
{{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}},
|
|
||||||
{{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}},
|
|
||||||
{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}},
|
|
||||||
{{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}},
|
|
||||||
{{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}},
|
|
||||||
{{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}},
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -5,27 +5,24 @@
|
||||||
|
|
||||||
#ifdef KEYBOARD_lets_split_rev1
|
#ifdef KEYBOARD_lets_split_rev1
|
||||||
#include "rev1.h"
|
#include "rev1.h"
|
||||||
#elif KEYBOARD_lets_split_rev2
|
|
||||||
#include "rev2.h"
|
|
||||||
#elif KEYBOARD_lets_split_sockets
|
|
||||||
#include "sockets.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Used to create a keymap using only KC_ prefixed keys
|
// Used to create a keymap using only KC_ prefixed keys
|
||||||
#define LAYOUT_kc( \
|
#define LAYOUT_kc( \
|
||||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
L00, L01, L02, L03, L04, L05, L06, L07, R00, R01, R02, R03, R04, R05, R06, R07, \
|
||||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
L10, L11, L12, L13, L14, L15, L16, L17, R10, R11, R12, R13, R14, R15, R16, R17, \
|
||||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
L20, L21, L22, L23, L24, L25, L26, L27, R20, R21, R22, R23, R24, R25, R26, R27, \
|
||||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
|
L30, L31, L32, L33, L34, L35, L36, L37, R30, R31, R32, R33, R34, R35, R36, R37, \
|
||||||
|
L40, L41, L42, L43, L44, L45, L46, L47, R40, R41, R42, R43, R44, R45, R46, R47 \
|
||||||
) \
|
) \
|
||||||
LAYOUT( \
|
LAYOUT( \
|
||||||
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
|
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##L06, KC_##L07, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, KC_##R06, KC_##R07,\
|
||||||
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
|
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##L16, KC_##L17, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, KC_##R16, KC_##R17,\
|
||||||
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
|
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##L26, KC_##L27, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, KC_##R26, KC_##R27,\
|
||||||
KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \
|
KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##L36, KC_##L37, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, KC_##R36, KC_##R37 \
|
||||||
)
|
)
|
||||||
|
|
||||||
#define LAYOUT_kc_ortho_4x12 LAYOUT_kc
|
#define LAYOUT_XEAL LAYOUT_kc
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,22 +22,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "config_common.h"
|
#include "config_common.h"
|
||||||
|
|
||||||
/* USB Device descriptor parameter */
|
/* USB Device descriptor parameter */
|
||||||
#define VENDOR_ID 0xFEED
|
#define VENDOR_ID 0x4131
|
||||||
#define PRODUCT_ID 0x3060
|
#define PRODUCT_ID 0x5141
|
||||||
#define DEVICE_VER 0x0001
|
#define DEVICE_VER 0x0001
|
||||||
#define MANUFACTURER Wootpatoot
|
#define MANUFACTURER XeaLouS
|
||||||
#define PRODUCT Lets Split v1
|
#define PRODUCT XeaL60
|
||||||
#define DESCRIPTION A split keyboard for the cheap makers
|
#define DESCRIPTION A split keyboard
|
||||||
|
|
||||||
/* key matrix size */
|
/* key matrix size */
|
||||||
// Rows are doubled-up
|
// Rows are doubled-up
|
||||||
#define MATRIX_ROWS 8
|
#define MATRIX_ROWS 10
|
||||||
#define MATRIX_COLS 6
|
#define MATRIX_COLS 8
|
||||||
|
|
||||||
// wiring of each half
|
// wiring of each half
|
||||||
#define MATRIX_ROW_PINS { B5, B4, E6, D7 }
|
//ascii art of pro micro
|
||||||
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
|
// PORT
|
||||||
// #define MATRIX_COL_PINS { B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order
|
//PD3 TX0 RAW
|
||||||
|
//PD2 RX1 GND
|
||||||
|
// GND RESET
|
||||||
|
// GND VCC
|
||||||
|
//PD1 2 A3 PF4
|
||||||
|
//PD0 3 A2 PF5
|
||||||
|
//PD4 4 A1 PF6
|
||||||
|
//PC6 5 A0 PF7
|
||||||
|
//PD7 6 15 PB1
|
||||||
|
//PE6 7 14 PB3
|
||||||
|
//PB4 8 13 PB2
|
||||||
|
//PB5 9 10 PB6
|
||||||
|
|
||||||
|
#define MATRIX_ROW_PINS { B5, B4, E6, D7, C6 }
|
||||||
|
#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6, F5 }
|
||||||
|
|
||||||
/* define if matrix has ghost */
|
/* define if matrix has ghost */
|
||||||
//#define MATRIX_HAS_GHOST
|
//#define MATRIX_HAS_GHOST
|
||||||
|
@ -58,13 +72,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
)
|
)
|
||||||
|
|
||||||
/* ws2812 RGB LED */
|
|
||||||
#define RGB_DI_PIN D3
|
|
||||||
#define RGBLIGHT_TIMER
|
|
||||||
#define RGBLED_NUM 16 // Number of LEDs
|
|
||||||
#define ws2812_PORTREG PORTD
|
|
||||||
#define ws2812_DDRREG DDRD
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Feature disable options
|
* Feature disable options
|
||||||
* These options are also useful to firmware size reduction.
|
* These options are also useful to firmware size reduction.
|
||||||
|
|
|
@ -9,22 +9,25 @@
|
||||||
//void promicro_bootloader_jmp(bool program);
|
//void promicro_bootloader_jmp(bool program);
|
||||||
|
|
||||||
#define LAYOUT( \
|
#define LAYOUT( \
|
||||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \
|
||||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
L10, L11, L12, L13, L14, L15, L16, L17, R11, R12, R13, R14, R15, R16, \
|
||||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
L20, L21, L22, L23, L24, L25, L26, R21, R22, R23, R24, R25, R26, \
|
||||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
|
L30, L31, L32, L33, L34, L35, R31, R32, R33, R34, R35, R36, \
|
||||||
|
L40, L41, L42, L43, L44, R42, R43, R44, R45, R46 \
|
||||||
) \
|
) \
|
||||||
{ \
|
{ \
|
||||||
{ L00, L01, L02, L03, L04, L05 }, \
|
{ L00, L01, L02, L03, L04, L05, L06 }, \
|
||||||
{ L10, L11, L12, L13, L14, L15 }, \
|
{ L10, L11, L12, L13, L14, L15, L16, L17 }, \
|
||||||
{ L20, L21, L22, L23, L24, L25 }, \
|
{ L20, L21, L22, L23, L24, L25, L26 }, \
|
||||||
{ L30, L31, L32, L33, L34, L35 }, \
|
{ L30, L31, L32, L33, L34, L35 }, \
|
||||||
{ R00, R01, R02, R03, R04, R05 }, \
|
{ L40, L41, L42, L43, L44 }, \
|
||||||
{ R10, R11, R12, R13, R14, R15 }, \
|
{ R00, R01, R02, R03, R04, R05, R06}, \
|
||||||
{ R20, R21, R22, R23, R24, R25 }, \
|
{ R11, R12, R13, R14, R15, R16 }, \
|
||||||
{ R30, R31, R32, R33, R34, R35 } \
|
{ R21, R22, R23, R24, R25, R26 }, \
|
||||||
|
{ R31, R32, R33, R34, R35, R36 }, \
|
||||||
|
{ R42, R43, R44, R45, R46 } \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LAYOUT_ortho_4x12 LAYOUT
|
#define LAYOUT_split60 LAYOUT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
SRC += matrix.c \
|
SRC += matrix.c \
|
||||||
i2c.c \
|
|
||||||
split_util.c \
|
split_util.c \
|
||||||
serial.c \
|
serial.c \
|
||||||
ssd1306.c
|
ssd1306.c
|
||||||
|
@ -53,12 +52,12 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||||
# change to "no" to disable the options, or define them in the Makefile in
|
# change to "no" to disable the options, or define them in the Makefile in
|
||||||
# the appropriate keymap folder that will get included automatically
|
# the appropriate keymap folder that will get included automatically
|
||||||
#
|
#
|
||||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
MIDI_ENABLE = no # MIDI controls
|
MIDI_ENABLE = no # MIDI controls
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
@ -66,7 +65,8 @@ UNICODE_ENABLE = no # Unicode
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
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.
|
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||||
SUBPROJECT_rev1 = yes
|
SUBPROJECT_rev1 = yes
|
||||||
USE_I2C = yes
|
USE_I2C = no
|
||||||
|
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue