add basic keymap

This commit is contained in:
Charlotte 🦝 Delenk 2022-07-24 10:32:21 +01:00
parent e8d2aca2e9
commit ecc4868376
15 changed files with 1339 additions and 87 deletions

View file

@ -3,9 +3,15 @@
#pragma once
#define SPLIT_HAND_PIN GP21
#define SPLIT_HAND_PIN GP16
#define SPLIT_HAND_PIN_LOW_IS_LEFT
#define SPLIT_USB_DETECT
// Rows are doubled up for split keyboard support
#define MATRIX_ROWS 10
#define MATRIX_COLS 6
#define DEBUG_MATRIX_SCAN_RATE
#define UNICODE_SELECTED_MODES UC_LNX, UC_MAC, UC_WINC
/*
* Feature disable options

View file

@ -9,17 +9,17 @@ void cos_i2c_init(void) {
if (!is_initialized) {
is_initialized = true;
gpio_set_function(24, GPIO_FUNC_I2C);
gpio_set_function(25, GPIO_FUNC_I2C);
gpio_pull_up(24);
gpio_pull_up(25);
gpio_set_function(18, GPIO_FUNC_I2C);
gpio_set_function(19, GPIO_FUNC_I2C);
gpio_pull_up(18);
gpio_pull_up(19);
}
}
static bool enabled = false;
static void init_i2c(void) {
if(!enabled) {
i2c_init(i2c0, 100 * 1000); // 100kb/s
if (!enabled) {
i2c_init(i2c1, 100 * 1000); // 100kb/s
enabled = true;
}
}
@ -27,10 +27,8 @@ static void init_i2c(void) {
static uint8_t i2c_address;
static i2c_status_t pico_to_qmk(int result) {
if(result == PICO_ERROR_TIMEOUT)
return I2C_STATUS_TIMEOUT;
if(result < 0)
return I2C_STATUS_ERROR;
if (result == PICO_ERROR_TIMEOUT) return I2C_STATUS_TIMEOUT;
if (result < 0) return I2C_STATUS_ERROR;
return I2C_STATUS_SUCCESS;
}
@ -40,14 +38,14 @@ i2c_status_t cos_i2c_start(uint8_t address) {
return I2C_STATUS_SUCCESS;
}
i2c_status_t cos_i2c_transmit(uint8_t address, const uint8_t *data, uint16_t length, uint16_t timeout) {
i2c_status_t cos_i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) {
cos_i2c_start(address);
return pico_to_qmk(i2c_write_timeout_us(i2c0, address, data, (size_t)length, false, (uint32_t)timeout * 1000));
return pico_to_qmk(i2c_write_timeout_us(i2c1, address, data, (size_t)length, false, (uint32_t)timeout * 1000));
}
i2c_status_t cos_i2c_receive(uint8_t address, uint8_t * data, uint16_t length, uint16_t timeout) {
i2c_status_t cos_i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) {
cos_i2c_start(address);
return pico_to_qmk(i2c_read_timeout_us(i2c0, address, data, (size_t)length, false, (uint32_t)timeout * 1000));
return pico_to_qmk(i2c_read_timeout_us(i2c1, address, data, (size_t)length, false, (uint32_t)timeout * 1000));
}
i2c_status_t cos_i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) {
@ -59,16 +57,15 @@ i2c_status_t cos_i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* d
return cos_i2c_transmit(devaddr, complete_packet, length + 1, timeout);
}
i2c_status_t cos_i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout){
i2c_status_t cos_i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) {
cos_i2c_start(devaddr);
// TODO: uses 2x timeout
i2c_status_t reg_result = cos_i2c_transmit(devaddr, &regaddr, 1, timeout);
if(reg_result != I2C_STATUS_SUCCESS)
return reg_result;
if (reg_result != I2C_STATUS_SUCCESS) return reg_result;
return cos_i2c_receive(devaddr, data, length, timeout);
}
void cos_i2c_stop(void) {
enabled = false;
i2c_deinit(i2c0);
i2c_deinit(i2c1);
}

View file

@ -7,40 +7,35 @@
// Code taken from here: https://github.com/harsha-vk/weeder_bot/blob/0bb2ac3f627dc2b3867480d210c0536ae0f684a5/assets/raspberry_pi_pico_code/src/i2c_slave.cpp
static volatile bool is_callback_executor = false;
volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT];
static volatile bool is_callback_executor = false;
volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT];
static volatile uint8_t buffer_address;
static volatile bool sub_has_register_set = false;
static volatile bool transfer_in_progress = false;
enum i2c_event_t {
I2C_SUB_RECEIVE,
I2C_SUB_REQUEST,
I2C_SUB_FINISH
};
enum i2c_event_t { I2C_SUB_RECEIVE, I2C_SUB_REQUEST, I2C_SUB_FINISH };
static void i2c_sub_handler(enum i2c_event_t event) {
//uint8_t ack = 1;
switch(event) {
// uint8_t ack = 1;
switch (event) {
case I2C_SUB_RECEIVE: {
while(i2c_get_read_available(i2c0)) {
if(!sub_has_register_set) {
i2c_read_raw_blocking(i2c0, (uint8_t *)&buffer_address, 1);
while (i2c_get_read_available(i2c1)) {
if (!sub_has_register_set) {
i2c_read_raw_blocking(i2c1, (uint8_t *)&buffer_address, 1);
if (buffer_address >= I2C_SLAVE_REG_COUNT) {
//ack = 0;
// ack = 0;
buffer_address = 0;
}
sub_has_register_set = true;
is_callback_executor = buffer_address == split_transaction_table[I2C_EXECUTE_CALLBACK].initiator2target_offset;
} else {
// find out how many bytes we can safely read
uint32_t bytes_left = I2C_SLAVE_REG_COUNT - buffer_address;
uint32_t bytes_to_read = i2c_get_read_available(i2c0);
uint32_t num_bytes = (bytes_left < bytes_to_read) ? bytes_left : bytes_to_read;
i2c_read_raw_blocking(i2c0, (uint8_t *)i2c_slave_reg + buffer_address, num_bytes);
uint32_t bytes_left = I2C_SLAVE_REG_COUNT - buffer_address;
uint32_t bytes_to_read = i2c_get_read_available(i2c1);
uint32_t num_bytes = (bytes_left < bytes_to_read) ? bytes_left : bytes_to_read;
i2c_read_raw_blocking(i2c1, (uint8_t *)i2c_slave_reg + buffer_address, num_bytes);
buffer_address += num_bytes;
if(buffer_address >= I2C_SLAVE_REG_COUNT)
buffer_address = 0;
if (buffer_address >= I2C_SLAVE_REG_COUNT) buffer_address = 0;
// If we're intending to execute a transaction callback, do so, as we've just received the transaction ID
if (is_callback_executor) {
split_transaction_desc_t *trans = &split_transaction_table[split_shmem->transaction_id];
@ -50,10 +45,9 @@ static void i2c_sub_handler(enum i2c_event_t event) {
}
}
}
}
break;
} break;
case I2C_SUB_REQUEST: {
i2c_write_raw_blocking(i2c0, (uint8_t*)i2c_slave_reg + buffer_address, 1);
i2c_write_raw_blocking(i2c1, (uint8_t *)i2c_slave_reg + buffer_address, 1);
buffer_address++;
break;
}
@ -71,26 +65,26 @@ static void finish_transfer(void) {
}
static void i2c_handler(void) {
i2c_hw_t *hw = i2c_get_hw(i2c0);
uint32_t intr_stat = hw->intr_stat;
if(intr_stat == 0) return; // spurious
if(intr_stat & I2C_IC_INTR_STAT_R_TX_ABRT_BITS) {
i2c_hw_t *hw = i2c_get_hw(i2c1);
uint32_t intr_stat = hw->intr_stat;
if (intr_stat == 0) return; // spurious
if (intr_stat & I2C_IC_INTR_STAT_R_TX_ABRT_BITS) {
hw->clr_tx_abrt;
finish_transfer();
}
if(intr_stat & I2C_IC_INTR_STAT_R_START_DET_BITS) {
if (intr_stat & I2C_IC_INTR_STAT_R_START_DET_BITS) {
hw->clr_start_det;
finish_transfer();
}
if(intr_stat & I2C_IC_INTR_STAT_R_STOP_DET_BITS) {
if (intr_stat & I2C_IC_INTR_STAT_R_STOP_DET_BITS) {
hw->clr_stop_det;
finish_transfer();
}
if(intr_stat & I2C_IC_INTR_STAT_R_RX_FULL_BITS) {
if (intr_stat & I2C_IC_INTR_STAT_R_RX_FULL_BITS) {
transfer_in_progress = true;
i2c_sub_handler(I2C_SUB_RECEIVE);
}
if(intr_stat & I2C_IC_INTR_STAT_R_RD_REQ_BITS) {
if (intr_stat & I2C_IC_INTR_STAT_R_RD_REQ_BITS) {
hw->clr_rd_req;
transfer_in_progress = true;
i2c_sub_handler(I2C_SUB_REQUEST);
@ -98,22 +92,20 @@ static void i2c_handler(void) {
}
void cos_i2c_slave_init(uint8_t address) {
i2c_init(i2c0, 100 * 1000);
i2c_set_slave_mode(i2c0, true, address);
gpio_set_function(24, GPIO_FUNC_I2C);
gpio_set_function(25, GPIO_FUNC_I2C);
gpio_pull_up(24);
gpio_pull_up(25);
i2c_init(i2c1, 100 * 1000);
i2c_set_slave_mode(i2c1, true, address);
gpio_set_function(18, GPIO_FUNC_I2C);
gpio_set_function(19, GPIO_FUNC_I2C);
gpio_pull_up(18);
gpio_pull_up(19);
i2c_hw_t *hw = i2c_get_hw(i2c0);
i2c_hw_t *hw = i2c_get_hw(i2c1);
hw->intr_mask = I2C_IC_INTR_MASK_M_RX_FULL_BITS | I2C_IC_INTR_MASK_M_RD_REQ_BITS | I2C_IC_RAW_INTR_STAT_TX_ABRT_BITS | I2C_IC_INTR_MASK_M_STOP_DET_BITS | I2C_IC_INTR_MASK_M_START_DET_BITS;
irq_set_exclusive_handler(I2C0_IRQ, i2c_handler);
irq_set_enabled(I2C0_IRQ, true);
irq_set_exclusive_handler(I2C1_IRQ, i2c_handler);
irq_set_enabled(I2C1_IRQ, true);
}
void cos_i2c_slave_stop(void) {
i2c_set_slave_mode(i2c0, false, 0);
i2c_deinit(i2c0);
i2c_set_slave_mode(i2c1, false, 0);
i2c_deinit(i2c1);
}

View file

@ -27,6 +27,21 @@
"pid": "0x0000",
"vid": "0xE621"
},
"split": {
"enabled": true,
"matrix_pins": {
"right": {
"cols": ["GP10", "GP9", "GP8", "GP7", "GP6", "GP5"],
"rows": ["GP0", "GP1", "GP2", "GP3", "GP4"]
}
},
"transport": {
"protocol": "custom"
},
"usb_detect": {
"enabled": true
}
},
"layouts": {
"LAYOUT_ortho_4x6_2x2uc": {
"layout": [
@ -57,7 +72,35 @@
{ "matrix": [4, 2], "x": 2, "y": 4 },
{ "matrix": [4, 3], "x": 3, "y": 4 },
{ "matrix": [4, 4], "x": 4, "y": 4 },
{ "matrix": [4, 5], "x": 5, "y": 4 }
{ "matrix": [4, 5], "x": 5, "y": 4 },
{ "matrix": [5, 0], "x": 6, "y": 0 },
{ "matrix": [5, 1], "x": 7, "y": 0 },
{ "matrix": [5, 2], "x": 8, "y": 0 },
{ "matrix": [5, 3], "x": 9, "y": 0 },
{ "matrix": [5, 4], "x": 10, "y": 0 },
{ "matrix": [5, 5], "x": 11, "y": 0 },
{ "matrix": [6, 0], "x": 6, "y": 1 },
{ "matrix": [6, 1], "x": 7, "y": 1 },
{ "matrix": [6, 2], "x": 8, "y": 1 },
{ "matrix": [6, 3], "x": 9, "y": 1 },
{ "matrix": [6, 4], "x": 10, "y": 1 },
{ "matrix": [6, 5], "x": 11, "y": 1 },
{ "matrix": [7, 0], "x": 6, "y": 2 },
{ "matrix": [7, 1], "x": 7, "y": 2 },
{ "matrix": [7, 2], "x": 8, "y": 2 },
{ "matrix": [7, 3], "x": 9, "y": 2 },
{ "matrix": [7, 4], "x": 10, "y": 2 },
{ "matrix": [7, 5], "x": 11, "y": 2 },
{ "matrix": [8, 0], "x": 6, "y": 3 },
{ "matrix": [8, 1], "x": 7, "y": 3 },
{ "matrix": [8, 2], "x": 8, "y": 3 },
{ "matrix": [8, 3], "x": 9, "y": 3 },
{ "matrix": [8, 4], "x": 10, "y": 3 },
{ "matrix": [8, 5], "x": 11, "y": 3 },
{ "matrix": [9, 2], "x": 8, "y": 4 },
{ "matrix": [9, 3], "x": 9, "y": 4 },
{ "matrix": [9, 4], "x": 10, "y": 4 },
{ "matrix": [9, 5], "x": 11, "y": 4 }
]
}
},

View file

@ -0,0 +1,295 @@
#pragma once
const struct decoded_key key_neo2_mapping[] = {
{KC_SPC, 1, 0}, // " "
{KC_Y, 3, 0}, // !
{KC_COMM, 3, 0}, // "
{KC_Z, 3, 0}, // #
{KC_X, 3, 0}, // $
{KC_M, 3, 0}, // %
{KC_P, 3, 0}, // &
{KC_DOT, 3, 0}, // '
{KC_J, 3, 0}, // (
{KC_K, 3, 0}, // )
{KC_G, 3, 0}, // *
{KC_B, 3, 0}, // +
{KC_COMM, 1, 0}, // ,
{KC_L, 3, 0}, // -
{KC_DOT, 1, 0}, // .
{KC_S, 3, 0}, // /
{KC_0, 1, 0}, // 0
{KC_1, 1, 0}, // 1
{KC_2, 1, 0}, // 2
{KC_3, 1, 0}, // 3
{KC_4, 1, 0}, // 4
{KC_5, 1, 0}, // 5
{KC_6, 1, 0}, // 6
{KC_7, 1, 0}, // 7
{KC_8, 1, 0}, // 8
{KC_9, 1, 0}, // 9
{KC_SCLN, 3, 0}, // :
{KC_SLSH, 3, 0}, // ;
{KC_U, 3, 0}, // <
{KC_O, 3, 0}, // =
{KC_I, 3, 0}, // >
{KC_H, 3, 0}, // ?
{KC_QUOT, 3, 0}, // @
{KC_D, 2, 0}, // A
{KC_N, 2, 0}, // B
{KC_R, 2, 0}, // C
{KC_SCLN, 2, 0}, // D
{KC_F, 2, 0}, // E
{KC_O, 2, 0}, // F
{KC_I, 2, 0}, // G
{KC_U, 2, 0}, // H
{KC_S, 2, 0}, // I
{KC_SLSH, 2, 0}, // J
{KC_Y, 2, 0}, // K
{KC_E, 2, 0}, // L
{KC_M, 2, 0}, // M
{KC_J, 2, 0}, // N
{KC_G, 2, 0}, // O
{KC_V, 2, 0}, // P
{KC_P, 2, 0}, // Q
{KC_K, 2, 0}, // R
{KC_H, 2, 0}, // S
{KC_L, 2, 0}, // T
{KC_A, 2, 0}, // U
{KC_W, 2, 0}, // V
{KC_T, 2, 0}, // W
{KC_Q, 2, 0}, // X
{KC_QUOT, 2, 0}, // Y
{KC_B, 2, 0}, // Z
{KC_E, 3, 0}, // [
{KC_A, 3, 0}, // '\'
{KC_R, 3, 0}, // ]
{KC_T, 3, 0}, // ^
{KC_W, 3, 0}, // _
{KC_B, 3, 0}, // `
{KC_D, 1, 0}, // a
{KC_N, 1, 0}, // b
{KC_R, 1, 0}, // c
{KC_SCLN, 1, 0}, // d
{KC_F, 1, 0}, // e
{KC_O, 1, 0}, // f
{KC_I, 1, 0}, // g
{KC_U, 1, 0}, // h
{KC_S, 1, 0}, // i
{KC_SLSH, 1, 0}, // j
{KC_Y, 1, 0}, // k
{KC_E, 1, 0}, // l
{KC_M, 1, 0}, // m
{KC_J, 1, 0}, // n
{KC_G, 1, 0}, // o
{KC_V, 1, 0}, // p
{KC_P, 1, 0}, // q
{KC_K, 1, 0}, // r
{KC_H, 1, 0}, // s
{KC_L, 1, 0}, // t
{KC_A, 1, 0}, // u
{KC_W, 1, 0}, // v
{KC_T, 1, 0}, // w
{KC_Q, 1, 0}, // x
{KC_QUOT, 1, 0}, // y
{KC_B, 1, 0}, // z
{KC_D, 3, 0}, // {
{KC_C, 3, 0}, // |
{KC_F, 3, 0}, // }
{KC_V, 3, 0}, // ~
{KC_SPC, 5, 0}, //   (U+00A0)
{KC_Y, 4, 0}, // ¡
{KC_6, 3, 0}, // ¢
{KC_6, 4, 0}, // £
{KC_7, 4, 0}, // ¤
{KC_7, 3, 0}, // ¥
{KC_2, 2, 0}, // §
{KC_1, 4, 0}, // ª
{KC_5, 2, 0}, // «
{KC_1, 6, 0}, // ¬
{KC_MINS, 6, 0}, // ­ (U+00AD)
{KC_1, 2, 0}, // °
{KC_PPLS, 3, 0}, // ±
{KC_2, 3, 0}, // ²
{KC_3, 3, 0}, // ³
{KC_5, 4, 0}, // ·
{KC_1, 3, 0}, // ¹
{KC_2, 4, 0}, // º
{KC_4, 2, 0}, // »
{KC_H, 4, 0}, // ¿
{KC_C, 2, 0}, // Ä
{KC_X, 2, 0}, // Ö
{KC_Y, 6, 0}, // ×
{KC_Z, 2, 0}, // Ü
{KC_LBRC, 1, 0}, // ß
{KC_C, 1, 0}, // ä
{KC_X, 3, 0}, // ö
{KC_PSLS, 3, 0}, // ÷
{KC_Z, 3, 0}, // ü
{KC_LBRC, 3, 0}, // ſ
{KC_I, 6, 0}, // Γ
{KC_SCLN, 6, 0}, // Δ
{KC_SLSH, 6, 0}, // Θ
{KC_E, 6, 0}, // Λ
{KC_Q, 6, 0}, // Ξ
{KC_V, 6, 0}, // Π
{KC_H, 6, 0}, // Σ
{KC_O, 6, 0}, // Φ
{KC_U, 6, 0}, // Ψ
{KC_T, 6, 0}, // Ω
{KC_D, 5, 0}, // α
{KC_N, 5, 0}, // β
{KC_I, 5, 0}, // γ
{KC_N, 5, 0}, // δ
{KC_F, 5, 0}, // ε
{KC_B, 5, 0}, // ζ
{KC_C, 5, 0}, // η
{KC_SLSH, 5, 0}, // θ
{KC_S, 5, 0}, // ι
{KC_Y, 5, 0}, // κ
{KC_E, 5, 0}, // λ
{KC_M, 5, 0}, // μ
{KC_J, 5, 0}, // ν
{KC_Q, 5, 0}, // ξ
{KC_G, 5, 0}, // ο
{KC_V, 5, 0}, // π
{KC_K, 5, 0}, // ρ
{KC_LBRC, 5, 0}, // ς
{KC_H, 5, 0}, // σ
{KC_L, 5, 0}, // τ
{KC_QUOT, 5, 0}, // υ
{KC_O, 5, 0}, // φ
{KC_R, 5, 0}, // χ
{KC_U, 5, 0}, // ψ
{KC_T, 5, 0}, // ω
{KC_DOT, 5, 0}, // ϑ
{KC_P, 5, 0}, // ϕ
{KC_7, 5, 0}, // ϰ
{KC_COMM, 5, 0}, // ϱ
{KC_X, 5, 0}, // ϵ
{KC_LBRC, 2, 0}, // ẞ
{KC_MINS, 5, 0}, // (U+2011)
{KC_COMM, 2, 0}, //
{KC_MINS, 2, 0}, // —
{KC_9, 3, 0}, //
{KC_0, 3, 0}, //
{KC_8, 3, 0}, //
{KC_9, 2, 0}, // “
{KC_0, 2, 0}, // ”
{KC_8, 2, 0}, // „
{KC_P9, 2, 0}, // †
{KC_DOT, 2, 0}, // •
{KC_P6, 2, 0}, // ‣
{KC_Q, 3, 0}, // …
{KC_SPC, 6, 0}, // (U+202F)
{KC_P0, 5, 0}, // ‰
{KC_PDOT, 5, 0}, //
{KC_PDOT, 6, 0}, // ″
{KC_5, 3, 0}, //
{KC_4, 3, 0}, //
{KC_PSLS, 4, 0}, //
{KC_0, 5, 0}, // ₀
{KC_1, 5, 0}, // ₁
{KC_2, 5, 0}, // ₂
{KC_3, 5, 0}, // ₃
{KC_7, 2, 0}, // €
{KC_R, 6, 0}, //
{KC_3, 2, 0}, //
{KC_J, 6, 0}, //
{KC_3, 4, 0}, // №
{KC_P, 6, 0}, //
{KC_K, 6, 0}, //
{KC_B, 6, 0}, //
{KC_C, 6, 0}, // ℵ
{KC_P4, 3, 0}, // ←
{KC_P8, 3, 0}, // ↑
{KC_P6, 3, 0}, // →
{KC_P2, 3, 0}, // ↓
{KC_P1, 3, 0}, // ↔
{KC_P7, 3, 0}, // ↕
{KC_DOT, 6, 0}, // ↦
{KC_P3, 3, 0}, // ⇌
{KC_N, 6, 0}, // ⇐
{KC_COMM, 6, 0}, // ⇒
{KC_M, 6, 0}, // ⇔
{KC_D, 6, 0}, // ∀
{KC_L, 6, 0}, // ∂
{KC_F, 6, 0}, // ∃
{KC_0, 6, 0}, // ∅
{KC_QUOT, 6, 0}, // ∇
{KC_G, 6, 0}, // ∈
{KC_LBRC, 4, 0}, //
{KC_PPLS, 4, 0}, // ∓
{KC_PPLS, 6, 0}, // ∔
{KC_PMNS, 4, 0}, //
{KC_LBRC, 6, 0}, // ∘
{KC_W, 6, 0}, // √
{KC_9, 6, 0}, // ∝
{KC_8, 6, 0}, // ∞
{KC_5, 6, 0}, // ∡
{KC_PSLS, 6, 0}, //
{KC_6, 6, 0}, // ∥
{KC_3, 6, 0}, // ∧
{KC_2, 6, 0}, //
{KC_X, 6, 0}, // ∩
{KC_Z, 6, 0}, //
{KC_S, 6, 0}, // ∫
{KC_PMNS, 6, 0}, // ∸
{KC_NLCK, 5, 0}, // ≈
{KC_NLCK, 4, 0}, // ≠
{KC_NLCK, 6, 0}, // ≡
{KC_P1, 5, 0}, // ≤
{KC_P3, 5, 0}, // ≥
{KC_P7, 5, 0}, // ≪
{KC_P9, 5, 0}, // ≫
{KC_A, 6, 0}, // ⊂
{KC_P6, 5, 0}, // ⊃
{KC_P4, 6, 0}, // ⊆
{KC_P6, 6, 0}, // ⊇
{KC_PPLS, 5, 0}, // ⊕
{KC_PMNS, 5, 0}, // ⊖
{KC_PAST, 6, 0}, // ⊛
{KC_PAST, 5, 0}, // ⊙
{KC_4, 6, 0}, // ⊥
{KC_P5, 5, 0}, // ⊶
{KC_P5, 6, 0}, // ⊷
{KC_P8, 6, 0}, // ⋂
{KC_P2, 6, 0}, //
{KC_PAST, 3, 0}, // ⋅
{KC_PSLS, 5, 0}, // ⌀
{KC_P7, 6, 0}, // ⌈
{KC_P9, 6, 0}, // ⌉
{KC_P1, 6, 0}, // ⌊
{KC_P3, 6, 0}, // ⌋
{KC_P0, 2, 0}, // ␣
{KC_P0, 6, 0}, // □
{KC_P3, 2, 0}, // ♠
{KC_P4, 2, 0}, // ♣
{KC_P2, 2, 0}, // ♥
{KC_P1, 2, 0}, // ♦
{KC_4, 5, 0}, // ♀
{KC_5, 5, 0}, // ♂
{KC_6, 5, 0}, // ⚥
{KC_P7, 2, 0}, // ✔
{KC_P8, 2, 0}, // ✘
{KC_8, 5, 0}, // ⟨
{KC_9, 5, 0}, // ⟩
{KC_GRV, 1, DECODED_KEY_ONESHOT}, // ^
{KC_GRV, 2, DECODED_KEY_ONESHOT}, // ̌
{KC_GRV, 3, DECODED_KEY_ONESHOT}, // ↻
{KC_GRV, 4, DECODED_KEY_ONESHOT}, // ̇
{KC_GRV, 5, DECODED_KEY_ONESHOT}, // ˞
{KC_GRV, 6, DECODED_KEY_ONESHOT}, // .
{KC_EQL, 1, DECODED_KEY_ONESHOT}, // `
{KC_EQL, 2, DECODED_KEY_ONESHOT}, // ¸
{KC_EQL, 3, DECODED_KEY_ONESHOT}, // °
{KC_EQL, 4, DECODED_KEY_ONESHOT}, // ̈
{KC_EQL, 5, DECODED_KEY_ONESHOT}, //
{KC_EQL, 5, DECODED_KEY_ONESHOT}, // ̄
{KC_RBRC, 1, DECODED_KEY_ONESHOT}, // ´
{KC_RBRC, 2, DECODED_KEY_ONESHOT}, // ˜
{KC_RBRC, 3, DECODED_KEY_ONESHOT}, // /
{KC_RBRC, 4, DECODED_KEY_ONESHOT}, // ˝
{KC_RBRC, 5, DECODED_KEY_ONESHOT}, // ᾿
{KC_RBRC, 6, DECODED_KEY_ONESHOT}, // ˘
};

View file

@ -0,0 +1,99 @@
#pragma once
const struct decoded_key key_qwerty_mapping[] = {
{KC_SPC, 1, 0}, // " "
{KC_1, 2, 0}, // !
{KC_QUOT, 2, 0}, // "
{KC_3, 2, 0}, // #
{KC_4, 2, 0}, // $
{KC_5, 2, 0}, // %
{KC_7, 2, 0}, // &
{KC_QUOT, 1, 0}, // '
{KC_9, 2, 0}, // (
{KC_0, 2, 0}, // )
{KC_8, 2, 0}, // *
{KC_EQL, 2, 0}, // +
{KC_COMM, 1, 0}, // ,
{KC_MINS, 1, 0}, // -
{KC_DOT, 1, 0}, // .
{KC_SLSH, 1, 0}, // /
{KC_0, 1, 0}, // 0
{KC_1, 1, 0}, // 1
{KC_2, 1, 0}, // 2
{KC_3, 1, 0}, // 3
{KC_4, 1, 0}, // 4
{KC_5, 1, 0}, // 5
{KC_6, 1, 0}, // 6
{KC_7, 1, 0}, // 7
{KC_8, 1, 0}, // 8
{KC_9, 1, 0}, // 9
{KC_SCLN, 2, 0}, // :
{KC_SCLN, 1, 0}, // ;
{KC_COMM, 2, 0}, // <
{KC_EQL, 1, 0}, // =
{KC_DOT, 2, 0}, // >
{KC_SLSH, 2, 0}, // ?
{KC_2, 2, 0}, // @
{KC_A, 2, 0}, // A
{KC_B, 2, 0}, // B
{KC_C, 2, 0}, // C
{KC_D, 2, 0}, // D
{KC_E, 2, 0}, // E
{KC_F, 2, 0}, // F
{KC_G, 2, 0}, // G
{KC_H, 2, 0}, // H
{KC_I, 2, 0}, // I
{KC_J, 2, 0}, // J
{KC_K, 2, 0}, // K
{KC_L, 2, 0}, // L
{KC_M, 2, 0}, // M
{KC_N, 2, 0}, // N
{KC_O, 2, 0}, // O
{KC_P, 2, 0}, // P
{KC_Q, 2, 0}, // Q
{KC_R, 2, 0}, // R
{KC_S, 2, 0}, // S
{KC_T, 2, 0}, // T
{KC_U, 2, 0}, // U
{KC_V, 2, 0}, // V
{KC_W, 2, 0}, // W
{KC_X, 2, 0}, // X
{KC_Y, 2, 0}, // Y
{KC_Z, 2, 0}, // Z
{KC_LBRC, 1, 0}, // [
{KC_NUHS, 1, 0}, // '\'
{KC_RBRC, 1, 0}, // ]
{KC_6, 2, 0}, // ^
{KC_MINS, 2, 0}, // _
{KC_GRV, 1, 0}, // `
{KC_A, 1, 0}, // a
{KC_B, 1, 0}, // b
{KC_C, 1, 0}, // c
{KC_D, 1, 0}, // d
{KC_E, 1, 0}, // e
{KC_F, 1, 0}, // f
{KC_G, 1, 0}, // g
{KC_H, 1, 0}, // h
{KC_I, 1, 0}, // i
{KC_J, 1, 0}, // j
{KC_K, 1, 0}, // k
{KC_L, 1, 0}, // l
{KC_M, 1, 0}, // m
{KC_N, 1, 0}, // n
{KC_O, 1, 0}, // o
{KC_P, 1, 0}, // p
{KC_Q, 1, 0}, // q
{KC_R, 1, 0}, // r
{KC_S, 1, 0}, // s
{KC_T, 1, 0}, // t
{KC_U, 1, 0}, // u
{KC_V, 1, 0}, // v
{KC_W, 1, 0}, // w
{KC_X, 1, 0}, // x
{KC_Y, 1, 0}, // y
{KC_Z, 1, 0}, // z
{KC_LBRC, 2, 0}, // {
{KC_NUHS, 2, 0}, // |
{KC_RBRC, 2, 0}, // }
{KC_GRV, 2, 0} // ~
};

View file

@ -0,0 +1,164 @@
#pragma once
// Only contains ASCII characters, because the rest is sparsely mapped
const struct decoded_key key_qwertz_mapping[] = {
{KC_SPC, 1, 0}, // " "
{KC_1, 2, 0}, // !
{KC_2, 2, 0}, // "
{KC_NUHS, 1, 0}, // #
{KC_4, 2, 0}, // $
{KC_5, 2, 0}, // %
{KC_6, 2, 0}, // &
{KC_NUHS, 2, 0}, // '
{KC_8, 2, 0}, // (
{KC_9, 2, 0}, // )
{KC_RBRC, 2, 0}, // *
{KC_RBRC, 1, 0}, // +
{KC_COMM, 1, 0}, // ,
{KC_SLSH, 1, 0}, // -
{KC_DOT, 1, 0}, // .
{KC_7, 2, 0}, // /
{KC_0, 1, 0}, // 0
{KC_1, 1, 0}, // 1
{KC_2, 1, 0}, // 2
{KC_3, 1, 0}, // 3
{KC_4, 1, 0}, // 4
{KC_5, 1, 0}, // 5
{KC_6, 1, 0}, // 6
{KC_7, 1, 0}, // 7
{KC_8, 1, 0}, // 8
{KC_9, 1, 0}, // 9
{KC_DOT, 2, 0}, // :
{KC_COMM, 2, 0}, // ;
{KC_NUBS, 1, 0}, // <
{KC_0, 2, 0}, // =
{KC_NUBS, 2, 0}, // >
{KC_MINS, 2, 0}, // ?
{KC_Q, 4, 0}, // @
{KC_A, 2, 0}, // A
{KC_B, 2, 0}, // B
{KC_C, 2, 0}, // C
{KC_D, 2, 0}, // D
{KC_E, 2, 0}, // E
{KC_F, 2, 0}, // F
{KC_G, 2, 0}, // G
{KC_H, 2, 0}, // H
{KC_I, 2, 0}, // I
{KC_J, 2, 0}, // J
{KC_K, 2, 0}, // K
{KC_L, 2, 0}, // L
{KC_M, 2, 0}, // M
{KC_N, 2, 0}, // N
{KC_O, 2, 0}, // O
{KC_P, 2, 0}, // P
{KC_Q, 2, 0}, // Q
{KC_R, 2, 0}, // R
{KC_S, 2, 0}, // S
{KC_T, 2, 0}, // T
{KC_U, 2, 0}, // U
{KC_V, 2, 0}, // V
{KC_W, 2, 0}, // W
{KC_X, 2, 0}, // X
{KC_Z, 2, 0}, // Y
{KC_Y, 2, 0}, // Z
{KC_8, 4, 0}, // [
{KC_MINS, 4, 0}, // '\'
{KC_9, 4, 0}, // ]
{KC_NO, 0, DECODED_KEY_SPECIAL}, // ^
{KC_SLSH, 2, 0}, // _
{KC_NO, 0, DECODED_KEY_SPECIAL}, // `
{KC_A, 1, 0}, // a
{KC_B, 1, 0}, // b
{KC_C, 1, 0}, // c
{KC_D, 1, 0}, // d
{KC_E, 1, 0}, // e
{KC_F, 1, 0}, // f
{KC_G, 1, 0}, // g
{KC_H, 1, 0}, // h
{KC_I, 1, 0}, // i
{KC_J, 1, 0}, // j
{KC_K, 1, 0}, // k
{KC_L, 1, 0}, // l
{KC_M, 1, 0}, // m
{KC_N, 1, 0}, // n
{KC_O, 1, 0}, // o
{KC_P, 1, 0}, // p
{KC_Q, 1, 0}, // q
{KC_R, 1, 0}, // r
{KC_S, 1, 0}, // s
{KC_T, 1, 0}, // t
{KC_U, 1, 0}, // u
{KC_V, 1, 0}, // v
{KC_W, 1, 0}, // w
{KC_X, 1, 0}, // x
{KC_Z, 1, 0}, // y
{KC_Y, 1, 0}, // z
{KC_7, 4, 0}, // {
{KC_NUBS, 4, 0}, // |
{KC_0, 4, 0}, // }
{KC_RBRC, 4, 0} // ~
};
struct sparse_decoded_key {
uint16_t key;
struct decoded_key decoded_key;
};
const struct sparse_decoded_key key_qwertz_sparse_mapping[] = {{NBSPACE, {KC_SPC, 4, 0}}, // Non-breaking space
{INVEXCL, {KC_5, 4, 0}}, // ¡
{SECTION, {KC_3, 2, 0}}, // §
{LDGUILM, {KC_V, 4, 0}}, // «
{SHYPHEN, {KC_SLSH, 4, 0}}, // soft hyphen
{DEGREE, {KC_GRV, 2, 0}}, // °
{SUPTWO, {KC_2, 4, 0}}, // ²
{SUPTHRE, {KC_3, 4, 0}}, // ³
{MIDDOT, {KC_DOT, 7, 0}}, // ·
{SUPONE, {KC_I, 7, 0}}, // ¹
{RDGUILM, {KC_C, 4, 0}}, // »
{INVQMRK, {KC_6, 4, 0}}, // ¿
{CA_DIA, {KC_QUOT, 2, 0}}, // Ä
{CO_DIA, {KC_SCLN, 2, 0}}, // Ö
{MULTSGN, {KC_GRV, 4, 0}}, // ×
{CU_DIA, {KC_LBRC, 2, 0}}, // Ü
{SZLIG, {KC_MINS, 1, 0}}, // ß
{A_DIA, {KC_QUOT, 1, 0}}, // ä
{O_DIA, {KC_SCLN, 1, 0}}, // ö
{U_DIA, {KC_LBRC, 1, 0}}, // ü
{LONG_S, {KC_LBRC, 7, 0}}, // ſ
{MU, {KC_M, 4, 0}}, // μ
{CSZLIG, {KC_H, 4, 0}}, // ẞ
{ENDASH, {KC_N, 4, 0}}, //
{EMDASH, {KC_4, 4, 0}}, // —
{LSQUOT, {KC_DOT, 4, 0}}, //
{RSQUOT, {KC_1, 4, 0}}, //
{LDQUOT, {KC_V, 7, 0}}, // “
{RDQUOT, {KC_B, 7, 0}}, // ”
{LODQUOT, {KC_X, 7, 0}}, // „
{ELLIPS, {KC_DOT, 4, 0}}, // …
{NNBSP, {KC_SPC, 7, 0}}, // narrow non-breaking space
{PRIME, {KC_F, 4, 0}}, //
{DPRIME, {KC_G, 4, 0}}, // ″
{LSGUILM, {KC_B, 4, 0}}, //
{RSGUILM, {KC_Z, 4, 0}}, //
{EURO, {KC_E, 4, 0}}, // €
{EMPTYST, {KC_D, 4, 0}}, // ∅
{LEQUAL, {KC_A, 4, 0}}, // ≤
{GEQUAL, {KC_O, 4, 0}}, // ≥
{CIRCUM, {KC_GRV, 1, DECODED_KEY_ONESHOT}},
{HACEK, {KC_W, 3, DECODED_KEY_ONESHOT}},
{DOTABVE, {KC_EQL, 3, DECODED_KEY_ONESHOT}},
{DOTBLOW, {KC_SCLN, 3, DECODED_KEY_ONESHOT}},
{GRAVE, {KC_EQL, 2, DECODED_KEY_ONESHOT}},
{CEDILLE, {KC_J, 4, DECODED_KEY_ONESHOT}},
// TODO: disambiguate CEDILLE and OGONEK somehow
{OGONEK, {KC_L, 4, DECODED_KEY_ONESHOT}},
{DIARESS, {KC_R, 4, DECODED_KEY_ONESHOT}},
{MACRON, {KC_T, 4, DECODED_KEY_ONESHOT}},
{ACUTE, {KC_EQL, 1, DECODED_KEY_ONESHOT}},
{TILDE, {KC_I, 4, DECODED_KEY_ONESHOT}},
{DBLACUT, {KC_Y, 4, DECODED_KEY_ONESHOT}},
{SPLENIS, {KC_LBRC, 4, DECODED_KEY_ONESHOT}},
{BREVE, {KC_U, 4, DECODED_KEY_ONESHOT}},
{0, {0, 0, 0}}};

View file

@ -0,0 +1,6 @@
#pragma once
static const char* key_unicode_mappings[] = {
" ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "\u00a0", "¡", "¢", "£", "¤", "¥", "§", "ª", "«", "¬", "\u00ad", "°", "±", "²", "³", "·", "¹", "º", "»", "¿", "Ä", "Ö", "×", "Ü", "ß", "ä", "ö", "÷", "ü", "ſ", "Γ", "Δ", "Θ", "Λ", "Ξ", "Π", "Σ", "Φ", "Ψ", "Ω", "α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ",
"μ", "ν", "ξ", "ο", "π", "ρ", "ς", "σ", "τ", "υ", "φ", "χ", "ψ", "ω", "ϑ", "ϕ", "ϰ", "ϱ", "ϵ", "", "\u2011", "", "", "", "", "", "", "", "", "", "", "", "", "\u202f", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "^", "ˇ", "", "˙", "˞", ".", "`", "¸", "˛", "°", "¨", "", "¯", "´", "˜", "/", "˝", "᾿", "˘",
};

View file

@ -1,30 +1,679 @@
#include QMK_KEYBOARD_H
// I dont take constructive criticism sorry
enum custom_keycodes {
COMPOSE = SAFE_RANGE
SPACE = SAFE_RANGE, // " "
EXCLAM, // !
QUOT, // "
NUMBER, // #
DOLLAR, // $
PERCENT, // %
AMPSAND, // &
AAPOSTR, // '
LPARENS, // (
RPARENS, // )
ASTERSK, // *
PLUS, // +
COMMA, // ,
HYPHMIN, // -
PERIOD, // .
FSLASH, // /
ZERO, // 0
ONE, // 1
TWO, // 2
THREE, // 3
FOUR, // 4
FIVE, // 5
SIX, // 6
SEVEN, // 7
EIGHT, // 8
NINE, // 9
COLON, // :
SEMCOL, // ;
LESSTHN, // <
EQUALS, // =
GREATER, // >
QUESTN, // ?
AT, // @
CA, // A
CB, // B
CC, // C
CD, // D
CE, // E
CF, // F
CG, // G
CH, // H
CI, // I
CJ, // J
CK, // K
CL, // L
CM, // M
CN, // N
CO, // O
CP, // P
CQ, // Q
CR, // R
CS, // S
CT, // T
CU, // U
CV, // V
CW, // W
CX, // X
CY, // Y
CZ, // Z
LBRACKT, // [
BSLASH, // '\'
RBRACKT, // ]
ACIRCUM, // ^
LOWLINE, // _
AGRAVE, // `
A, // a
B, // b
C, // c
D, // d
E, // e
F, // f
G, // g
H, // h
I, // i
J, // j
K, // k
L, // l
M, // m
N, // n
O, // o
P, // p
Q, // q
R, // r
S, // s
T, // t
U, // u
V, // v
W, // w
X, // x
Y, // y
Z, // z
LBRACE, // {
VRTLINE, // |
RBRACE, // }
ATILDE, // ~
NBSPACE, //   (U+00A0)
INVEXCL, // ¡
CENTSGN, // ¢
POUND, // £
CURENCY, // ¤
YEN, // ¥
SECTION, // §
FEMORD, // ª
LDGUILM, // «
NOTSIGN, // ¬
SHYPHEN, // ­ (U+00AD)
DEGREE, // °
PLSMNS, // ±
SUPTWO, // ²
SUPTHRE, // ³
MIDDOT, // ·
SUPONE, // ¹
MASCORD, // º
RDGUILM, // »
INVQMRK, // ¿
CA_DIA, // Ä
CO_DIA, // Ö
MULTSGN, // ×
CU_DIA, // Ü
SZLIG, // ß
A_DIA, // ä
O_DIA, // ö
DIVSGN, // ÷
U_DIA, // ü
LONG_S, // ſ
CGAMMA, // Γ
CDELTA, // Δ
CTHETA, // Θ
CLAMBDA, // Λ
CXI, // Ξ
CPI, // Π
CSIGMA, // Σ
CPHI, // Φ
CPSI, // Ψ
COMEGA, // Ω
ALPHA, // α
BETA, // β
GAMMA, // γ
DELTA, // δ
EPSILON, // ε
ZETA, // ζ
ETA, // η
THETA, // θ
IOTA, // ι
KAPPA, // κ
LAMBDA, // λ
MU, // μ
NU, // ν
XI, // ξ
OMICRON, // ο
PI, // π
RHO, // ρ
FSIGMA, // ς
SIGMA, // σ
TAU, // τ
UPSILON, // υ
PHI, // φ
CHI, // χ
PSI, // ψ
OMEGA, // ω
VRTHETA, // ϑ
VARPHI, // ϕ
VARKPPA, // ϰ
VARRHO, // ϱ
LUNEPS, // ϵ
CSZLIG, // ẞ
NBHYP, // (U+2011)
ENDASH, //
EMDASH, // —
LSQUOT, //
RSQUOT, //
LOSQUOT, //
LDQUOT, // “
RDQUOT, // ”
LODQUOT, // „
DAGGER, // †
BULLET, // •
TRIBLLT, // ‣
ELLIPS, // …
NNBSP, // (U+202F)
PERMILL, // ‰
PRIME, //
DPRIME, // ″
LSGUILM, //
RSGUILM, //
FRACTSL, //
SUBZERO, // ₀
SUBONE, // ₁
SUBTWO, // ₂
SUBTHRE, // ₃
EURO, // €
COMPLEX, //
SCRIPTL, //
NATURAL, //
NUMERO, // №
RATIONL, //
REAL, //
INTEGER, //
ALEF, // ℵ
LEFTARR, // ←
UPARROW, // ↑
RIGHTAR, // →
DOWNARR, // ↓
LRARROW, // ↔
UDARROW, // ↕
RARRBAR, // ↦
RLHARPO, // ⇌
LDBLARR, // ⇐
RDBLARR, // ⇒
LRDBARR, // ⇔
FORALL, // ∀
PARTDRV, // ∂
THREXST, // ∃
EMPTYST, // ∅
NABLA, // ∇
ELEMOF, // ∈
MINUS, //
MINPLS, // ∓
DOTPLUS, // ∔
SETMINS, //
RINGOP, // ∘
SQRT, // √
PROPTO, // ∝
INFINIT, // ∞
MEASANG, // ∡
DIVIDES, //
PARALLL, // ∥
LAND, // ∧
LOR, //
INTRSCT, // ∩
UNION, //
INTEGRL, // ∫
DOTMINS, // ∸
ALMSTEQ, // ≈
NOTEQAL, // ≠
IDENTCL, // ≡
LEQUAL, // ≤
GEQUAL, // ≥
MCHLESS, // ≪
MCHGRTR, // ≫
SUBSET, // ⊂
SUPRSET, // ⊃
SUBEQL, // ⊆
SUPREQL, // ⊇
CPLUS, // ⊕
CMINUS, // ⊖
CTIMES, // ⊛
CDOT, // ⊙
UPTACK, // ⊥
ORIGNAL, // ⊶
IMAGEOF, // ⊷
NARYINT, // ⋂
NARYUNI, //
DOTOPER, // ⋅
DIAMETR, // ⌀
LCEILNG, // ⌈
RCEILNG, // ⌉
LFLOOR, // ⌊
RFLOOR, // ⌋
OPNBOX, // ␣
WHTSQAR, // □
SPADE, // ♠
CLUBS, // ♣
HEART, // ♥
DIAMOND, // ♦
FEMALE, // ♀
MALE, // ♂
MALEFEM, // ⚥
CHECKMK, // ✔
XBALLOT, // ✘
LANGLE, // ⟨
RANGLE, // ⟩
CIRCUM, // ^
HACEK, // ̌
TURNED, // ↻
DOTABVE, // ̇
HOOK, // ˞
DOTBLOW, // .
GRAVE, // `
CEDILLE, // ¸
OGONEK = CEDILLE, // ˛
RING, // °
DIARESS, // ̈
SPASPER, //
MACRON, // ̄
ACUTE, // ´
TILDE, // ˜
SOLIDUS, // /
DBLACUT, // ˝
SPLENIS, // ᾿
BREVE, // ˘
COMPOSE,
PASTHRU,
NUMPAD,
STENO,
LLOCK,
NEO2,
QWERTZ,
QWERTY,
};
static void register_layer1(uint16_t key) {
register_code16(key);
}
static void register_layer2(uint16_t key) {
register_code16(S(key));
}
static void register_layer3(uint16_t key) {
register_code(KC_CAPS_LOCK);
register_code16(key);
}
static void register_layer4(uint16_t key) {
register_code(KC_RALT);
register_code16(key);
}
static void register_layer5(uint16_t key) {
register_code(KC_CAPS_LOCK);
register_code16(S(key));
}
static void register_layer6(uint16_t key) {
register_code(KC_CAPS_LOCK);
register_code(KC_RALT);
register_code16(key);
}
static void tap_layer4(uint16_t key);
static void register_layer7(uint16_t key) {
tap_layer4(KC_GRV);
register_code16(key);
}
static void unregister_layer1(uint16_t key) {
unregister_code16(key);
}
static void unregister_layer2(uint16_t key) {
unregister_code16(S(key));
}
static void unregister_layer3(uint16_t key) {
unregister_code(KC_CAPS_LOCK);
unregister_code16(key);
}
static void unregister_layer4(uint16_t key) {
unregister_code(KC_RALT);
unregister_code16(key);
}
static void unregister_layer5(uint16_t key) {
unregister_code(KC_CAPS_LOCK);
unregister_code16(S(key));
}
static void unregister_layer6(uint16_t key) {
unregister_code(KC_CAPS_LOCK);
unregister_code(KC_RALT);
unregister_code16(key);
}
static void unregister_layer7(uint16_t key) {
unregister_code16(key);
}
static void tap_layer1(uint16_t key) {
register_layer1(key);
wait_ms(1);
unregister_layer1(key);
}
static void tap_layer2(uint16_t key) {
register_layer2(key);
wait_ms(1);
unregister_layer2(key);
}
static void tap_layer3(uint16_t key) {
register_layer3(key);
wait_ms(1);
unregister_layer3(key);
}
static void tap_layer4(uint16_t key) {
register_layer4(key);
wait_ms(1);
unregister_layer4(key);
}
static void tap_layer5(uint16_t key) {
register_layer5(key);
wait_ms(1);
unregister_layer5(key);
}
static void tap_layer6(uint16_t key) {
register_layer6(key);
wait_ms(1);
unregister_layer6(key);
}
static void tap_layer7(uint16_t key) {
tap_layer4(KC_GRV);
tap_code16(key);
}
static void register_on_layer(uint16_t key, uint8_t layer) {
switch (layer) {
case 1:
register_layer1(key);
break;
case 2:
register_layer2(key);
break;
case 3:
register_layer3(key);
break;
case 4:
register_layer4(key);
break;
case 5:
register_layer5(key);
break;
case 6:
register_layer6(key);
break;
case 7:
register_layer7(key);
break;
}
}
static void unregister_on_layer(uint16_t key, uint8_t layer) {
switch (layer) {
case 1:
unregister_layer1(key);
break;
case 2:
unregister_layer2(key);
break;
case 3:
unregister_layer3(key);
break;
case 4:
unregister_layer4(key);
break;
case 5:
unregister_layer5(key);
break;
case 6:
unregister_layer6(key);
break;
case 7:
unregister_layer7(key);
break;
}
}
static void tap_on_layer(uint16_t key, uint8_t layer) {
switch (layer) {
case 1:
tap_layer1(key);
break;
case 2:
tap_layer2(key);
break;
case 3:
tap_layer3(key);
break;
case 4:
tap_layer4(key);
break;
case 5:
tap_layer5(key);
break;
case 6:
tap_layer6(key);
break;
case 7:
tap_layer7(key);
break;
}
}
enum layers { _L1, _L2, _L3, _L4, _L5, _L6, _L7, _L8, _L9, FN };
#define LSHCTL S(KC_LCTL)
#define LSHGUI S(KC_LGUI)
#define LSHALT S(KC_LALT)
#define RSHCTL S(KC_RCTL)
#define RSHGUI S(KC_RGUI)
#define SHAPP S(KC_APP)
#define RSHALT S(KC_RALT)
#define RLTCTL RALT(KC_LCTL)
#define RLTGUI RALT(KC_LGUI)
#define RLTALT RALT(KC_LALT)
#define RLTRCTL RALT(KC_RCTL)
#define RLTRGUI RALT(KC_RGUI)
#define RLTAPP RALT(KC_APP)
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, KC_Q, KC_W, KC_E, KC_R, KC_T,
KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B,
KC_LCTL, KC_NO,KC_LGUI,KC_LALT,KC_NO,KC_NO,
KC_NO, KC_NO, KC_NO, KC_SPC
[_L1] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, X, V, L, C, W, K, H, G, F, Q, SZLIG,
CIRCUM, U, I, A, E, O, S, N, R, T, D, Y,
DIARESS, U_DIA, O_DIA, A_DIA, P, Z, B, M, COMMA, PERIOD, J, XXXXXXX,
KC_LCTL, OSL(FN), KC_LGUI, KC_LALT, PASTHRU, NUMPAD, STENO, LLOCK, KC_RALT, KC_RGUI, KC_APP, KC_RCTL,
TT(_L6), TT(_L2), TT(_L3), KC_SPC, TT(_L7), TT(_L4), TT(_L5), KC_SPC
),
[_L2] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, CX, CV, CL, CC, CW, CK, CH, CG, CF, CQ, CSZLIG,
HACEK, CU, CI, CA, CE, CO, CS, CN, CR, CT, CD, CY,
SPASPER, CU_DIA, CO_DIA, CA_DIA, CP, CZ, CB, CM, ENDASH, BULLET, CJ, XXXXXXX,
LSHCTL, OSL(FN), LSHGUI, LSHALT, PASTHRU, NUMPAD, STENO, LLOCK, RSHALT, RSHGUI, SHAPP, RSHCTL,
TT(_L6), TT(_L2), TT(_L6), KC_SPC, XXXXXXX, XXXXXXX, TT(_L8), KC_SPC
),
[_L3] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, ELLIPS, LOWLINE, LBRACKT, RBRACKT, ACIRCUM, EXCLAM, LESSTHN, GREATER, EQUALS, AMPSAND, LONG_S,
DOTABVE, BSLASH, FSLASH, LBRACE, RBRACE, ASTERSK, QUESTN, LPARENS, RPARENS, HYPHMIN, COLON, AT,
ACUTE, NUMBER, DOLLAR, VRTLINE, ATILDE, AGRAVE, PLUS, PERCENT, QUOT, AAPOSTR, SEMCOL, XXXXXXX,
KC_LCTL, OSL(FN), KC_LGUI, KC_LALT, PASTHRU, NUMPAD, STENO, LLOCK, KC_RALT, KC_RGUI, KC_APP, KC_RCTL,
TT(_L6), TT(_L6), TT(_L3), KC_SPC, TT(_L7), TT(_L7), XXXXXXX, KC_SPC
),
[_L4] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, KC_PGUP, KC_BSPC, KC_UP, KC_DEL, KC_PGDN, INVEXCL, SEVEN, EIGHT, NINE, PLUS, MINUS,
DOTBLOW, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, INVQMRK, FOUR, FIVE, SIX, COMMA, PERIOD,
SOLIDUS, KC_ESC, KC_TAB, KC_PSTE, KC_ENT, KC_UNDO, COLON, ONE, TWO, THREE, SEMCOL, KC_RSFT,
RLTCTL, OSL(FN), RLTGUI, RLTALT, PASTHRU, NUMPAD, STENO, LLOCK, KC_RALT, RLTRGUI, RLTAPP, RLTRCTL,
XXXXXXX, XXXXXXX, TT(_L7), ZERO, TT(_L7), TT(_L4), TT(_L9), ZERO
),
[_L5] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, ZERO, HYPHMIN,
CEDILLE, DEGREE, SECTION, SCRIPTL, RDGUILM, LDGUILM, DOLLAR, EURO, LODQUOT, LDQUOT, RDQUOT, EMDASH,
SPLENIS, SUPONE, SUPTWO, SUPTHRE, RSGUILM, LSGUILM, CENTSGN, YEN, LOSQUOT, LSQUOT, RSQUOT, HYPHMIN,
KC_LCTL, OSL(FN), KC_LGUI, KC_LALT, PASTHRU, NUMPAD, STENO, LLOCK, KC_RALT, KC_RGUI, KC_APP, KC_RCTL,
XXXXXXX, TT(_L8), XXXXXXX, KC_SPC, TT(_L9), XXXXXXX, TT(_L5), KC_SPC
),
[_L6] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, XI, XXXXXXX, LAMBDA, CHI, OMEGA, KAPPA, PSI, GAMMA, PHI, VARPHI, FSIGMA,
TURNED, XXXXXXX, IOTA, ALPHA, EPSILON, OMICRON, SIGMA, NU, RHO, TAU, DELTA, UPSILON,
MACRON, XXXXXXX, LUNEPS, ETA, PI, ZETA, BETA, MU, VARRHO, VRTHETA, THETA, XXXXXXX,
LSHCTL, OSL(FN), LSHGUI, LSHALT, PASTHRU, NUMPAD, STENO, LLOCK, RSHALT, RSHGUI, SHAPP, RSHCTL,
TT(_L6), TT(_L6), TT(_L6), KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC
),
[_L7] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, CXI, SQRT, CLAMBDA, COMPLEX, COMEGA, MULTSGN, CPSI, CGAMMA, CPHI, RATIONL, RINGOP,
HOOK, SUBSET, INTEGRL, FORALL, THREXST, ELEMOF, CSIGMA, NATURAL, REAL, PARTDRV, CDELTA, NABLA,
TILDE, UNION, INTRSCT, ALEF, CPI, INTEGER, LDBLARR, LRDBARR, RDBLARR, RARRBAR, CTHETA, XXXXXXX,
RLTCTL, OSL(FN), RLTGUI, RLTALT, PASTHRU, NUMPAD, STENO, LLOCK, KC_RALT, RLTRGUI, RLTAPP, RLTRCTL,
XXXXXXX, XXXXXXX, TT(_L7), KC_SPC, TT(_L7), TT(_L7), XXXXXXX, KC_SPC
),
[_L8] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, FEMORD, MASCORD, NUMERO, XXXXXXX, MIDDOT, POUND, CURENCY, KC_TAB, FSLASH, ASTERSK, HYPHMIN,
RING, SUBONE, SUBTWO, SUBTHRE, FEMALE, MALE, MALEFEM, VARKPPA, LANGLE, RANGLE, SUBZERO, NBHYP,
BREVE, NOTSIGN, LOR, LAND, UPTACK, MEASANG, PARALLL, RIGHTAR, INFINIT, PROPTO, EMPTYST, SHYPHEN,
KC_LCTL, OSL(FN), KC_LGUI, KC_LALT, PASTHRU, NUMPAD, STENO, LLOCK, KC_RALT, KC_RGUI, KC_APP, KC_RCTL,
XXXXXXX, TT(_L8), XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, TT(_L8), KC_SPC
),
[_L9] = LAYOUT_ortho_4x6_2x2uc(
COMPOSE, XXXXXXX, KC_BTN1, KC_MS_U, KC_BTN2, XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN3, KC_WH_U, KC_BTN4, XXXXXXX,
GRAVE, XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_R, XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN6, KC_WH_D, KC_BTN5, XXXXXXX,
DBLACUT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_LCTL, OSL(FN), KC_LGUI, KC_LALT, PASTHRU, NUMPAD, STENO, LLOCK, KC_RALT, KC_RGUI, KC_APP, KC_RCTL,
XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, TT(_L9), XXXXXXX, TT(_L9), KC_SPC
),
[FN] = LAYOUT_ortho_4x6_2x2uc(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, NEO2, XXXXXXX, XXXXXXX, XXXXXXX, QWERTY,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QWERTZ, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
)
};
// clang-format on
uint16_t layout = NEO2;
bool lock_layer_held = false;
#define DECODED_KEY_USE_UNICODE 1
#define DECODED_KEY_ONESHOT 2
#define DECODED_KEY_SPECIAL 4
struct decoded_key {
uint16_t keycode;
uint8_t layer;
uint8_t flags;
};
#include "key_unicode_table.h"
#include "key_neo2_table.h"
#include "key_qwerty_table.h"
#include "key_qwertz_table.h"
static struct decoded_key decode_key_neo2(uint16_t keycode, keyrecord_t *record) {
return key_neo2_mapping[keycode - SAFE_RANGE];
}
static struct decoded_key decode_key_qwerty(uint16_t keycode, keyrecord_t *record) {
struct decoded_key dk = {0, 0, DECODED_KEY_USE_UNICODE};
if (keycode > ATILDE) return dk;
return key_qwerty_mapping[keycode - SAFE_RANGE];
}
static struct decoded_key decode_key_qwertz(uint16_t keycode, keyrecord_t *record) {
struct decoded_key dk = {KC_NO, 0, DECODED_KEY_SPECIAL};
if (keycode >= SAFE_RANGE && keycode <= ATILDE) dk = key_qwertz_mapping[keycode - SAFE_RANGE];
if (!(dk.flags & DECODED_KEY_SPECIAL)) return dk;
for (int i = 0; key_qwertz_sparse_mapping[i].key != 0; i++) {
if (key_qwertz_sparse_mapping[i].key == keycode) {
return key_qwertz_sparse_mapping[i].decoded_key;
}
}
switch (keycode) {
default:
dk.keycode = KC_NO;
dk.layer = 0;
dk.flags = DECODED_KEY_USE_UNICODE;
break;
case ACIRCUM:
tap_on_layer(KC_GRV, 1);
tap_on_layer(KC_GRV, 1);
break;
case AGRAVE:
tap_on_layer(KC_EQL, 2);
tap_on_layer(KC_EQL, 2);
break;
}
return dk;
}
static const char *decode_key_unicode(uint16_t keycode) {
return key_unicode_mappings[keycode - SAFE_RANGE];
}
static void process_key(uint16_t keycode, keyrecord_t *record) {
struct decoded_key key;
switch (layout) {
case NEO2:
key = decode_key_neo2(keycode, record);
break;
case QWERTY:
key = decode_key_qwerty(keycode, record);
break;
case QWERTZ:
key = decode_key_qwertz(keycode, record);
break;
}
if (key.flags & DECODED_KEY_SPECIAL) return; // Already handled
if (!(key.flags & DECODED_KEY_USE_UNICODE)) {
if (record->event.pressed) {
if (key.flags & DECODED_KEY_ONESHOT) {
tap_on_layer(key.keycode, key.layer);
} else {
register_on_layer(key.keycode, key.layer);
}
} else {
if (!(key.flags & DECODED_KEY_ONESHOT)) {
unregister_on_layer(key.keycode, key.layer);
}
}
} else {
// its oneshot, we cant replicate press-and-hold cases
send_unicode_string(decode_key_unicode(keycode));
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch(keycode) {
case COMPOSE:
switch (keycode) {
case LLOCK:
if (record->event.pressed) {
register_code(KC_TAB);
register_code(KC_CAPS_LOCK);
lock_layer_held = true;
} else {
unregister_code(KC_TAB);
unregister_code(KC_CAPS_LOCK);
lock_layer_held = false;
}
break;
case NEO2:
case QWERTY:
case QWERTZ:
if (record->event.pressed) {
layout = keycode;
}
break;
default:
if ((keycode >= SPACE) && (keycode < COMPOSE)) {
process_key(keycode, record);
}
break;
}
#ifdef CONSOLE_ENABLE
uprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %u, time: %u, interrupt: %u, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
#endif
return true;
}

View file

@ -4,6 +4,7 @@ void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
debug_enable=true;
debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
debug_keyboard=true;
debug_mouse=true;
}

View file

@ -1,9 +1,9 @@
SPLIT_KEYBOARD = yes
SPLIT_TRANSPORT = custom
RP2040_INTRINSICS_ENABLED = yes
UNICODE_ENABLE = yes
SRC += i2c_slave.c i2c_master.c
QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c $(QUANTUM_DIR)/split_common/transactions.c
OPT_DEFS += -DSPLIT_COMMON_TRANSACTIONS
COMMON_VPATH += $(QUANTUM_PATH)/split_common
EXTRAINCDIRS += $(BOARD_PATH)
CFLAGS += -Wl,--defsym=__unhandled_user_irq=_unhandled_exception

View file

@ -17,7 +17,7 @@
#pragma once
enum serial_transaction_id {
#ifdef USE_I2C
#if 1
I2C_EXECUTE_CALLBACK,
#endif // USE_I2C

View file

@ -914,7 +914,7 @@ split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = {
// Set defaults
[0 ...(NUM_TOTAL_TRANSACTIONS - 1)] = {0, 0, 0, 0, 0},
#ifdef USE_I2C
#if 1
[I2C_EXECUTE_CALLBACK] = trans_initiator2target_initializer(transaction_id),
#endif // USE_I2C

View file

@ -22,7 +22,7 @@
#include "transaction_id_define.h"
#include "atomic_util.h"
#ifdef USE_I2C
#if 1
# ifndef SLAVE_I2C_TIMEOUT
# define SLAVE_I2C_TIMEOUT 100

View file

@ -147,7 +147,7 @@ typedef struct _rpc_sync_info_t {
#endif // defined(OS_DETECTION_ENABLE) && defined(SPLIT_DETECTED_OS_ENABLE)
typedef struct _split_shared_memory_t {
#ifdef USE_I2C
#if 1
int8_t transaction_id;
#endif // USE_I2C