summaryrefslogtreecommitdiff
path: root/keyboards/handwired
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/handwired')
-rw-r--r--keyboards/handwired/dactyl/matrix.c8
-rw-r--r--keyboards/handwired/frenchdev/matrix.c6
-rw-r--r--keyboards/handwired/not_so_minidox/config.h5
-rw-r--r--keyboards/handwired/not_so_minidox/i2c.c162
-rw-r--r--keyboards/handwired/not_so_minidox/i2c.h46
-rw-r--r--keyboards/handwired/not_so_minidox/keymaps/default/keymap.c56
-rw-r--r--keyboards/handwired/not_so_minidox/matrix.c308
-rw-r--r--keyboards/handwired/not_so_minidox/rules.mk17
-rw-r--r--keyboards/handwired/not_so_minidox/serial.c228
-rw-r--r--keyboards/handwired/not_so_minidox/serial.h23
-rw-r--r--keyboards/handwired/not_so_minidox/split_util.c84
-rw-r--r--keyboards/handwired/not_so_minidox/split_util.h17
-rw-r--r--keyboards/handwired/onekey/teensy_32/rules.mk3
-rw-r--r--keyboards/handwired/onekey/teensy_lc/rules.mk3
-rw-r--r--keyboards/handwired/promethium/matrix.c8
-rw-r--r--keyboards/handwired/pterodactyl/matrix.c8
-rw-r--r--keyboards/handwired/qc60/config.h2
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/rules.mk6
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/config.h1
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c2
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/rules.mk2
-rw-r--r--keyboards/handwired/tractyl_manuform/config.h5
-rw-r--r--keyboards/handwired/tractyl_manuform/tm_sync.c180
-rw-r--r--keyboards/handwired/tractyl_manuform/tractyl_manuform.c56
-rw-r--r--keyboards/handwired/tractyl_manuform/tractyl_manuform.h15
-rw-r--r--keyboards/handwired/wakizashi40/config.h20
-rw-r--r--keyboards/handwired/wakizashi40/info.json88
-rw-r--r--keyboards/handwired/wakizashi40/keymaps/default/keymap.c44
-rw-r--r--keyboards/handwired/wakizashi40/keymaps/via/keymap.c92
-rw-r--r--keyboards/handwired/wakizashi40/keymaps/via/rules.mk4
-rw-r--r--keyboards/handwired/wakizashi40/readme.md19
-rw-r--r--keyboards/handwired/wakizashi40/rules.mk1
32 files changed, 350 insertions, 1169 deletions
diff --git a/keyboards/handwired/dactyl/matrix.c b/keyboards/handwired/dactyl/matrix.c
index a21cd08e14..a70e8c5aca 100644
--- a/keyboards/handwired/dactyl/matrix.c
+++ b/keyboards/handwired/dactyl/matrix.c
@@ -281,14 +281,6 @@ uint8_t matrix_scan(void)
return 1;
}
-bool matrix_is_modified(void) // deprecated and evidently not called.
-{
-#if (DEBOUNCE > 0)
- if (debouncing) return false;
-#endif
- return true;
-}
-
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
diff --git a/keyboards/handwired/frenchdev/matrix.c b/keyboards/handwired/frenchdev/matrix.c
index 5ab254a6f9..a043f78538 100644
--- a/keyboards/handwired/frenchdev/matrix.c
+++ b/keyboards/handwired/frenchdev/matrix.c
@@ -174,12 +174,6 @@ uint8_t matrix_scan(void)
return 1;
}
-bool matrix_is_modified(void)
-{
- if (debouncing) return false;
- return true;
-}
-
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
diff --git a/keyboards/handwired/not_so_minidox/config.h b/keyboards/handwired/not_so_minidox/config.h
index de9286eda5..177552e2a6 100644
--- a/keyboards/handwired/not_so_minidox/config.h
+++ b/keyboards/handwired/not_so_minidox/config.h
@@ -40,6 +40,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define USE_SERIAL
+/*
+ * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
+ */
+#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
+
//#define EE_HANDS
#define MASTER_LEFT
diff --git a/keyboards/handwired/not_so_minidox/i2c.c b/keyboards/handwired/not_so_minidox/i2c.c
deleted file mode 100644
index 084c890c40..0000000000
--- a/keyboards/handwired/not_so_minidox/i2c.c
+++ /dev/null
@@ -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
diff --git a/keyboards/handwired/not_so_minidox/i2c.h b/keyboards/handwired/not_so_minidox/i2c.h
deleted file mode 100644
index 8910e70f10..0000000000
--- a/keyboards/handwired/not_so_minidox/i2c.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-
-#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();
diff --git a/keyboards/handwired/not_so_minidox/keymaps/default/keymap.c b/keyboards/handwired/not_so_minidox/keymaps/default/keymap.c
index 296a7a281d..435eed2f1f 100644
--- a/keyboards/handwired/not_so_minidox/keymaps/default/keymap.c
+++ b/keyboards/handwired/not_so_minidox/keymaps/default/keymap.c
@@ -8,17 +8,10 @@
#define _QWERTY 0
#define _LOWER 1
#define _RAISE 2
-#define _ADJUST 16
+#define _ADJUST 3
-enum custom_keycodes {
- QWERTY = SAFE_RANGE,
- LOWER,
- RAISE,
- ADJUST,
-};
-
-#define KC_LOWR LOWER
-#define KC_RASE RAISE
+#define KC_LOWR MO(_LOWER)
+#define KC_RASE MO(_RAISE)
#define KC_RST RESET
#define KC_CAD LCTL(LALT(KC_DEL))
@@ -72,45 +65,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case QWERTY:
- if (record->event.pressed) {
- set_single_persistent_default_layer(_QWERTY);
- }
- return false;
- break;
- case LOWER:
- if (record->event.pressed) {
- layer_on(_LOWER);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
- } else {
- layer_off(_LOWER);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
- }
- return false;
- break;
- case RAISE:
- if (record->event.pressed) {
- layer_on(_RAISE);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
- } else {
- layer_off(_RAISE);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
- }
- return false;
- break;
- case ADJUST:
- if (record->event.pressed) {
- layer_on(_ADJUST);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
- } else {
- layer_off(_ADJUST);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
- }
- return false;
- break;
- }
- return true;
+layer_state_t layer_state_set_user(layer_state_t state) {
+ return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
}
diff --git a/keyboards/handwired/not_so_minidox/matrix.c b/keyboards/handwired/not_so_minidox/matrix.c
deleted file mode 100644
index b7cec9370c..0000000000
--- a/keyboards/handwired/not_so_minidox/matrix.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
-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 "config.h"
-#include "quantum.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_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();
-
- setPinOutput(B0);
- setPinOutput(D5);
-
- // 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
- writePinLow(D5);
-
- 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
- writePinHigh(D5);
- 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++) {
- print_hex8(row); print(": ");
- print_bin_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);
-}
diff --git a/keyboards/handwired/not_so_minidox/rules.mk b/keyboards/handwired/not_so_minidox/rules.mk
index 3eab0fba7e..8f9772df22 100644
--- a/keyboards/handwired/not_so_minidox/rules.mk
+++ b/keyboards/handwired/not_so_minidox/rules.mk
@@ -7,19 +7,14 @@ BOOTLOADER = caterina
# Build Options
# change yes to no to disable
#
-BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
+BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
-EXTRAKEY_ENABLE = no # Audio control and System control
+EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
-COMMAND_ENABLE = yes # Commands for debug and configuration
+COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Enable N-Key Rollover
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
-RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
-USE_I2C = no
-CUSTOM_MATRIX = yes
-SRC += matrix.c \
- i2c.c \
- split_util.c \
- serial.c
+SPLIT_KEYBOARD = yes
diff --git a/keyboards/handwired/not_so_minidox/serial.c b/keyboards/handwired/not_so_minidox/serial.c
deleted file mode 100644
index 74bcbb6bf6..0000000000
--- a/keyboards/handwired/not_so_minidox/serial.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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"
-
-#ifndef USE_I2C
-
-// 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
diff --git a/keyboards/handwired/not_so_minidox/serial.h b/keyboards/handwired/not_so_minidox/serial.h
deleted file mode 100644
index 28fcc56ce7..0000000000
--- a/keyboards/handwired/not_so_minidox/serial.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-
-#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_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);
diff --git a/keyboards/handwired/not_so_minidox/split_util.c b/keyboards/handwired/not_so_minidox/split_util.c
deleted file mode 100644
index 39639c3b4b..0000000000
--- a/keyboards/handwired/not_so_minidox/split_util.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#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();
-#ifdef SSD1306OLED
- matrix_master_OLED_init ();
-#endif
-#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();
- }
-}
diff --git a/keyboards/handwired/not_so_minidox/split_util.h b/keyboards/handwired/not_so_minidox/split_util.h
deleted file mode 100644
index 807412cd38..0000000000
--- a/keyboards/handwired/not_so_minidox/split_util.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-
-#include <stdbool.h>
-#include "eeconfig.h"
-
-#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);
-
-void matrix_master_OLED_init (void);
diff --git a/keyboards/handwired/onekey/teensy_32/rules.mk b/keyboards/handwired/onekey/teensy_32/rules.mk
index c1b90d0d2b..937c9d5103 100644
--- a/keyboards/handwired/onekey/teensy_32/rules.mk
+++ b/keyboards/handwired/onekey/teensy_32/rules.mk
@@ -1,5 +1,8 @@
# MCU name
MCU = MK20DX256
+# Bootloader selection
+BOOTLOADER = halfkay
+
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
diff --git a/keyboards/handwired/onekey/teensy_lc/rules.mk b/keyboards/handwired/onekey/teensy_lc/rules.mk
index b3daabe317..0e3c7edf7a 100644
--- a/keyboards/handwired/onekey/teensy_lc/rules.mk
+++ b/keyboards/handwired/onekey/teensy_lc/rules.mk
@@ -2,5 +2,8 @@
MCU = MKL26Z64
USE_CHIBIOS_CONTRIB = yes
+# Bootloader selection
+BOOTLOADER = halfkay
+
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
diff --git a/keyboards/handwired/promethium/matrix.c b/keyboards/handwired/promethium/matrix.c
index e3a41af288..90dbce14a9 100644
--- a/keyboards/handwired/promethium/matrix.c
+++ b/keyboards/handwired/promethium/matrix.c
@@ -148,14 +148,6 @@ uint8_t matrix_scan(void)
return 1;
}
-bool matrix_is_modified(void)
-{
-#if (DEBOUNCE > 0)
- if (debouncing) return false;
-#endif
- return true;
-}
-
inline
bool matrix_is_on(uint8_t row, uint8_t col)
diff --git a/keyboards/handwired/pterodactyl/matrix.c b/keyboards/handwired/pterodactyl/matrix.c
index 21e6a128df..d0f74802a0 100644
--- a/keyboards/handwired/pterodactyl/matrix.c
+++ b/keyboards/handwired/pterodactyl/matrix.c
@@ -282,14 +282,6 @@ uint8_t matrix_scan(void)
return 1;
}
-bool matrix_is_modified(void) // deprecated and evidently not called.
-{
-#if (DEBOUNCE > 0)
- if (debouncing) return false;
-#endif
- return true;
-}
-
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
diff --git a/keyboards/handwired/qc60/config.h b/keyboards/handwired/qc60/config.h
index 0c27755910..db3d88dcf4 100644
--- a/keyboards/handwired/qc60/config.h
+++ b/keyboards/handwired/qc60/config.h
@@ -5,7 +5,7 @@
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x0C60
-#define DEVICE_VER 0x00C6
+#define DEVICE_VER 0x0100
#define MANUFACTURER PeiorisBoards
#define PRODUCT QC60
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk b/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk
index e83e9a7bba..c497bb2ee8 100644
--- a/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk
@@ -21,9 +21,7 @@ RGB_MATRIX_DRIVER = WS2812
POINTING_DEVICE_ENABLE = yes
-MOUSE_SHARED_EP = no
+POINTING_DEVICE_DRIVER = pmw3360
+MOUSE_SHARED_EP = yes
SPLIT_KEYBOARD = yes
-
-SRC += drivers/sensors/pmw3360.c
-QUANTUM_LIB_SRC += spi_master.c tm_sync.c
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h
index d7618912f7..b9d8e86c09 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/config.h
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h
@@ -52,5 +52,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define OLED_DISPLAY_128X64
-#define POINTING_DEVICE_TASK_THROTTLE
#define POINTING_DEVICE_RIGHT
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
index 958f694172..65f8a5260d 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
@@ -301,7 +301,7 @@ void oled_driver_render_logo_left(void) {
# endif
oled_set_cursor(6, 3);
# if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
- render_pointing_dpi_status(0);
+ render_pointing_dpi_status(kb_config_data.device_cpi, 0);
# endif
oled_set_cursor(0, 4);
}
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
index 37bbbb4dae..a689be3dd5 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
@@ -18,6 +18,4 @@ MOUSE_SHARED_EP = yes
SPLIT_KEYBOARD = yes
-QUANTUM_LIB_SRC += tm_sync.c
-
DEFAULT_FOLDER = handwired/tractyl_manuform/5x6_right/teensy2pp
diff --git a/keyboards/handwired/tractyl_manuform/config.h b/keyboards/handwired/tractyl_manuform/config.h
index cc8a7546f4..15c8102b8f 100644
--- a/keyboards/handwired/tractyl_manuform/config.h
+++ b/keyboards/handwired/tractyl_manuform/config.h
@@ -39,4 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
-#define SPLIT_TRANSACTION_IDS_KB RPC_ID_KB_CONFIG_SYNC, RPC_ID_POINTER_STATE_SYNC
+#define SPLIT_POINTING_ENABLE
+#define POINTING_DEVICE_TASK_THROTTLE_MS 1
+
+#define SPLIT_TRANSACTION_IDS_KB RPC_ID_KB_CONFIG_SYNC
diff --git a/keyboards/handwired/tractyl_manuform/tm_sync.c b/keyboards/handwired/tractyl_manuform/tm_sync.c
deleted file mode 100644
index 549a17a22f..0000000000
--- a/keyboards/handwired/tractyl_manuform/tm_sync.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
- * Copyright 2021 Dasky (@daskygit)
-
- * 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/>.
- */
-
-#include QMK_KEYBOARD_H
-#include "pointing_device.h"
-#include "transactions.h"
-#include <string.h>
-#ifdef MOUSEKEY_ENABLE
-# include "mousekey.h"
-#endif
-
-// typedef struct {
-// uint16_t device_cpi;
-// } kb_config_data_t;
-
-kb_config_data_t kb_config;
-static report_mouse_t shared_mouse_report;
-extern const pointing_device_driver_t pointing_device_driver;
-
-void kb_pointer_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
- shared_mouse_report = pointing_device_driver.get_report(shared_mouse_report);
- memcpy(target2initiator_buffer, &shared_mouse_report, sizeof(report_mouse_t));
- shared_mouse_report.x = 0;
- shared_mouse_report.y = 0;
- shared_mouse_report.h = 0;
- shared_mouse_report.v = 0;
-}
-
-void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
- if (initiator2target_buffer_size == sizeof(kb_config)) {
- memcpy(&kb_config, initiator2target_buffer, sizeof(kb_config));
- }
-
- static uint16_t cpi = 0;
- // Check if the state values are different
- if (cpi != kb_config.device_cpi) {
- cpi = kb_config.device_cpi;
- if (!is_keyboard_left()) {
- pointing_device_set_cpi(cpi);
- }
- }
-}
-
-void keyboard_pre_init_sync(void) {
- memset(&kb_config, 0, sizeof(kb_config));
- memset(&shared_mouse_report, 0, sizeof(shared_mouse_report));
-}
-
-void keyboard_post_init_sync(void) {
- // Register keyboard state sync split transaction
- transaction_register_rpc(RPC_ID_KB_CONFIG_SYNC, kb_config_sync_handler);
- transaction_register_rpc(RPC_ID_POINTER_STATE_SYNC, kb_pointer_sync_handler);
-}
-
-void housekeeping_task_sync(void) {
- if (is_keyboard_master()) {
- // Keep track of the last state, so that we can tell if we need to propagate to slave
- static kb_config_data_t last_kb_config;
- static uint32_t last_sync = 0;
- bool needs_sync = false;
-
- // Check if the state values are different
- if (memcmp(&kb_config, &last_kb_config, sizeof(kb_config))) {
- needs_sync = true;
- memcpy(&last_kb_config, &kb_config, sizeof(kb_config));
- }
- // Send to slave every 500ms regardless of state change
- if (timer_elapsed32(last_sync) > 500) {
- needs_sync = true;
- }
-
- // Perform the sync if requested
- if (needs_sync) {
- if (transaction_rpc_send(RPC_ID_KB_CONFIG_SYNC, sizeof(kb_config), &kb_config)) {
- last_sync = timer_read32();
- }
- }
- }
-}
-
-void trackball_set_cpi(uint16_t cpi) {
- kb_config.device_cpi = cpi;
- if (!is_keyboard_left()) {
- pointing_device_set_cpi(cpi);
- }
-}
-
-void pointing_device_task(void) {
- if (!is_keyboard_master()) {
- return;
- }
-
-#if defined(POINTING_DEVICE_TASK_THROTTLE)
- static uint32_t last_exec = 0;
- if (timer_elapsed32(last_exec) < 1) {
- return;
- }
- last_exec = timer_read32();
-#endif
-
- report_mouse_t local_report = pointing_device_get_report();
-
- // Gather report info
-#ifdef POINTING_DEVICE_MOTION_PIN
- if (!readPin(POINTING_DEVICE_MOTION_PIN))
-#endif
-#if defined(POINTING_DEVICE_COMBINED)
- local_report = pointing_device_driver.get_report(local_report);
- transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &shared_mouse_report);
- local_report.x = local_report.x | shared_mouse_report.x;
- local_report.y = local_report.y | shared_mouse_report.y;
- local_report.h = local_report.h | shared_mouse_report.h;
- local_report.v = local_report.v | shared_mouse_report.v;
-#elif defined(POINTING_DEVICE_LEFT)
- if (is_keyboard_left()) {
- local_report = pointing_device_driver.get_report(local_report);
- } else {
- transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &local_report);
- }
-#elif defined(POINTING_DEVICE_RIGHT)
- if (!is_keyboard_left()) {
- local_report = pointing_device_driver.get_report(local_report);
- } else {
- transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &local_report);
- }
-#else
-# error "You need to define the side(s) the pointing device is on. POINTING_DEVICE_COMBINED / POINTING_DEVICE_LEFT / POINTING_DEVICE_RIGHT"
-#endif
-
- // Support rotation of the sensor data
-#if defined(POINTING_DEVICE_ROTATION_90) || defined(POINTING_DEVICE_ROTATION_180) || defined(POINTING_DEVICE_ROTATION_270)
- int8_t x = local_report.x, y = local_report.y;
-# if defined(POINTING_DEVICE_ROTATION_90)
- local_report.x = y;
- local_report.y = -x;
-# elif defined(POINTING_DEVICE_ROTATION_180)
- local_report.x = -x;
- local_report.y = -y;
-# elif defined(POINTING_DEVICE_ROTATION_270)
- local_report.x = -y;
- local_report.y = x;
-# else
-# error "How the heck did you get here?!"
-# endif
-#endif
- // Support Inverting the X and Y Axises
-#if defined(POINTING_DEVICE_INVERT_X)
- local_report.x = -local_report.x;
-#endif
-#if defined(POINTING_DEVICE_INVERT_Y)
- local_report.y = -local_report.y;
-#endif
-
- // allow kb to intercept and modify report
- local_report = pointing_device_task_kb(local_report);
- // combine with mouse report to ensure that the combined is sent correctly
-#ifdef MOUSEKEY_ENABLE
- report_mouse_t mousekey_report = mousekey_get_report();
- local_report.buttons = local_report.buttons | mousekey_report.buttons;
-#endif
-#if defined(POINTING_DEVICE_COMBINED)
- local_report.buttons = local_report.buttons | shared_mouse_report.buttons;
-#endif
- pointing_device_set_report(local_report);
- pointing_device_send();
-}
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
index 6095bfb7e2..5bdc57ca09 100644
--- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
+++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
@@ -17,7 +17,6 @@
#include "tractyl_manuform.h"
#include "transactions.h"
#include <string.h>
-#include "drivers/sensors/pmw3360.h"
#ifndef TRACKBALL_DPI_OPTIONS
# define TRACKBALL_DPI_OPTIONS \
@@ -31,11 +30,10 @@
#endif
keyboard_config_t keyboard_config;
+kb_config_data_t kb_config_data;
uint16_t dpi_array[] = TRACKBALL_DPI_OPTIONS;
#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
-
-
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
if (!process_record_user(keycode, record)) {
return false;
@@ -49,7 +47,8 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE;
}
eeconfig_update_kb(keyboard_config.raw);
- trackball_set_cpi(dpi_array[keyboard_config.dpi_config]);
+ kb_config_data.device_cpi = dpi_array[keyboard_config.dpi_config];
+ pointing_device_set_cpi(kb_config_data.device_cpi);
}
#endif
@@ -69,7 +68,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
return true;
}
-__attribute__((weak)) void keyboard_pre_init_sync(void) {}
__attribute__((weak)) void keyboard_pre_init_sub(void) {}
void keyboard_pre_init_kb(void) {
// debug_enable = true;
@@ -83,20 +81,22 @@ void keyboard_pre_init_kb(void) {
writePin(DEBUG_LED_PIN, !debug_enable);
#endif
+ memset(&kb_config_data, 0, sizeof(kb_config_data));
+
keyboard_pre_init_sub();
- keyboard_pre_init_sync();
keyboard_pre_init_user();
}
-__attribute__((weak)) void keyboard_post_init_sync(void) {}
-void keyboard_post_init_kb(void) {
- keyboard_post_init_sync();
+void keyboard_post_init_kb(void) {
+ transaction_register_rpc(RPC_ID_KB_CONFIG_SYNC, kb_config_sync_handler);
+
keyboard_post_init_user();
}
#ifdef POINTING_DEVICE_ENABLE
void pointing_device_init_kb(void) {
- trackball_set_cpi(dpi_array[keyboard_config.dpi_config]);
+ kb_config_data.device_cpi = dpi_array[keyboard_config.dpi_config];
+ pointing_device_set_cpi(kb_config_data.device_cpi);
pointing_device_init_user();
}
@@ -111,7 +111,8 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
void eeconfig_init_kb(void) {
keyboard_config.dpi_config = TRACKBALL_DPI_DEFAULT;
#ifdef POINTING_DEVICE_ENABLE
- trackball_set_cpi(dpi_array[keyboard_config.dpi_config]);
+ kb_config_data.device_cpi = dpi_array[keyboard_config.dpi_config];
+ pointing_device_set_cpi(kb_config_data.device_cpi);
#endif
eeconfig_update_kb(keyboard_config.raw);
eeconfig_init_user();
@@ -135,12 +136,39 @@ void matrix_scan_kb(void) {
matrix_scan_user();
}
-__attribute__((weak)) void housekeeping_task_sync(void) {}
-void housekeeping_task_kb(void) {
- housekeeping_task_sync();
+void housekeeping_task_kb(void) {
+ if (is_keyboard_master()) {
+ // Keep track of the last state, so that we can tell if we need to propagate to slave
+ static kb_config_data_t last_kb_config;
+ static uint32_t last_sync = 0;
+ bool needs_sync = false;
+
+ // Check if the state values are different
+ if (memcmp(&kb_config_data, &last_kb_config, sizeof(kb_config_data))) {
+ needs_sync = true;
+ memcpy(&last_kb_config, &kb_config_data, sizeof(kb_config_data));
+ }
+ // Send to slave every 500ms regardless of state change
+ if (timer_elapsed32(last_sync) > 500) {
+ needs_sync = true;
+ }
+
+ // Perform the sync if requested
+ if (needs_sync) {
+ if (transaction_rpc_send(RPC_ID_KB_CONFIG_SYNC, sizeof(kb_config_data), &kb_config_data)) {
+ last_sync = timer_read32();
+ }
+ }
+ }
// no need for user function, is called already
}
+void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
+ if (initiator2target_buffer_size == sizeof(kb_config_data)) {
+ memcpy(&kb_config_data, initiator2target_buffer, sizeof(kb_config_data));
+ }
+}
+
#ifdef POINTING_DEVICE_ENABLE
void matrix_power_up(void) { pointing_device_task(); }
#endif
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h
index 6aa40fc18b..3f8aca4551 100644
--- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h
+++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h
@@ -32,21 +32,26 @@ typedef union {
};
} keyboard_config_t;
+typedef union {
+ uint32_t raw;
+ struct {
+ uint16_t device_cpi;
+ };
+} kb_config_data_t;
+
extern keyboard_config_t keyboard_config;
+extern kb_config_data_t kb_config_data;
enum ploopy_keycodes {
DPI_CONFIG = SAFE_RANGE,
KEYMAP_SAFE_RANGE,
};
-typedef struct {
- uint16_t device_cpi;
-} kb_config_data_t;
-
-void trackball_set_cpi(uint16_t cpi);
void matrix_init_sub_kb(void);
void matrix_scan_sub_kb(void);
void keyboard_pre_init_sync(void);
void keyboard_post_init_sync(void);
void housekeeping_task_sync(void);
+
+void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer);
diff --git a/keyboards/handwired/wakizashi40/config.h b/keyboards/handwired/wakizashi40/config.h
new file mode 100644
index 0000000000..78f85f2197
--- /dev/null
+++ b/keyboards/handwired/wakizashi40/config.h
@@ -0,0 +1,20 @@
+/* Copyright 2021 xiao (@xia0)
+ *
+ * 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/>.
+ */
+
+#pragma once
+
+#include "config_common.h"
+#define DYNAMIC_KEYMAP_LAYER_COUNT 12
diff --git a/keyboards/handwired/wakizashi40/info.json b/keyboards/handwired/wakizashi40/info.json
new file mode 100644
index 0000000000..b64ab55116
--- /dev/null
+++ b/keyboards/handwired/wakizashi40/info.json
@@ -0,0 +1,88 @@
+{
+ "manufacturer": "fumbucker",
+ "keyboard_name": "Wakizashi 40",
+ "maintainer": "fumbucker",
+ "debounce": 5,
+ "processor": "at90usb1286",
+ "diode_direction": "COL2ROW",
+ "features": {
+ "audio": false,
+ "backlight": false,
+ "bluetooth": false,
+ "bootmagic": true,
+ "command": false,
+ "console": true,
+ "extrakey": true,
+ "midi": false,
+ "mousekey": true,
+ "nkro": true,
+ "rgblight": false,
+ "unicode": false
+ },
+ "matrix_pins": {
+ "cols": ["C5", "C4", "D2", "D3", "D4", "D5", "C6", "D7", "B0", "B1", "B2", "B3", "B4"],
+ "rows": ["C0", "C1", "C2", "C3"]
+ },
+ "usb": {
+ "device_ver": "0x0001",
+ "pid": "0x7740",
+ "vid": "0x6662"
+ },
+ "layout_aliases": {
+ "LAYOUT": "LAYOUT_all"
+ },
+ "layouts": {
+ "LAYOUT_all": {
+ "layout": [
+ { "label": "TAB", "matrix": [0, 0], "w": 1.5, "x": 0, "y": 0 },
+ { "label": "Q", "matrix": [0, 2], "w": 1, "x": 1.5, "y": 0 },
+ { "label": "W", "matrix": [0, 3], "w": 1, "x": 2.5, "y": 0 },
+ { "label": "E", "matrix": [0, 4], "w": 1, "x": 3.5, "y": 0 },
+ { "label": "R", "matrix": [0, 5], "w": 1, "x": 4.5, "y": 0 },
+ { "label": "T", "matrix": [0, 6], "w": 1, "x": 5.5, "y": 0 },
+ { "label": "Y", "matrix": [0, 7], "w": 1, "x": 6.5, "y": 0 },
+ { "label": "U", "matrix": [0, 8], "w": 1, "x": 7.5, "y": 0 },
+ { "label": "I", "matrix": [0, 9], "w": 1, "x": 8.5, "y": 0 },
+ { "label": "O", "matrix": [0, 10], "w": 1, "x": 9.5, "y": 0 },
+ { "label": "P", "matrix": [0, 11], "w": 1, "x": 10.5, "y": 0 },
+ { "label": "BACKSPACE", "matrix": [0, 12], "w": 1.5, "x": 11.5, "y": 0 },
+
+ { "label": "CAPSLOCK", "matrix": [1, 0], "w": 1.25, "x": 0, "y": 1 },
+ { "label": "A", "matrix": [1, 1], "w": 1, "x": 1.25, "y": 1 },
+ { "label": "S", "matrix": [1, 2], "w": 1, "x": 2.25, "y": 1 },
+ { "label": "D", "matrix": [1, 3], "w": 1, "x": 3.25, "y": 1 },
+ { "label": "F", "matrix": [1, 4], "w": 1, "x": 4.25, "y": 1 },
+ { "label": "G", "matrix": [1, 5], "w": 1, "x": 5.75, "y": 1 },
+ { "label": "H", "matrix": [1, 7], "w": 1, "x": 6.75, "y": 1 },
+ { "label": "J", "matrix": [1, 8], "w": 1, "x": 7.75, "y": 1 },
+ { "label": "K", "matrix": [1, 9], "w": 1, "x": 8.75, "y": 1 },
+ { "label": "L", "matrix": [1, 10], "w": 1, "x": 9.75, "y": 1 },
+ { "label": "SEMICOLON", "matrix": [1, 11], "w": 1, "x": 10.75, "y": 1 },
+ { "label": "ENTER", "matrix": [1, 12], "w": 1.25, "x": 11.75, "y": 1 },
+
+ { "label": "LSHIFT", "matrix": [2, 0], "w": 1, "x": 0, "y": 2 },
+ { "label": "Z", "matrix": [2, 1], "w": 1, "x": 1, "y": 2 },
+ { "label": "X", "matrix": [2, 2], "w": 1, "x": 2, "y": 2 },
+ { "label": "C", "matrix": [2, 3], "w": 1, "x": 3, "y": 2 },
+ { "label": "V", "matrix": [2, 4], "w": 1, "x": 4, "y": 2 },
+ { "label": "B", "matrix": [2, 5], "w": 1, "x": 5, "y": 2 },
+ { "label": "ESCAPE", "matrix": [2, 6], "w": 1, "x": 6, "y": 2 },
+ { "label": "N", "matrix": [2, 7], "w": 1, "x": 7, "y": 2 },
+ { "label": "M", "matrix": [2, 8], "w": 1, "x": 8, "y": 2 },
+ { "label": "COMMA", "matrix": [2, 9], "w": 1, "x": 9, "y": 2 },
+ { "label": "PERIOD", "matrix": [2, 10], "w": 1, "x": 10, "y": 2 },
+ { "label": "SLASH", "matrix": [2, 11], "w": 1, "x": 11, "y": 2 },
+ { "label": "RSHIFT", "matrix": [2, 12], "w": 1, "x": 12, "y": 2 },
+
+ { "label": "LCTRL", "matrix": [3, 0], "w": 1.25, "x": 0, "y": 3 },
+ { "label": "LWIN", "matrix": [3, 1], "w": 1.25, "x": 1.25, "y": 3 },
+ { "label": "LALT", "matrix": [3, 3], "w": 1.25, "x": 2.5, "y": 3 },
+ { "label": "SPACE1", "matrix": [3, 5], "w": 2.75, "x": 3.75, "y": 3 },
+ { "label": "SPACE2", "matrix": [3, 7], "w": 2.75, "x": 6.5, "y": 3 },
+ { "label": "RALT", "matrix": [3, 9], "w": 1.25, "x": 9.25, "y": 3 },
+ { "label": "MENU", "matrix": [3, 11], "w": 1.25, "x": 10.5, "y": 3 },
+ { "label": "RCTRL", "matrix": [3, 12], "w": 1.25, "x": 11.75, "y": 3 }
+ ]
+ }
+ }
+}
diff --git a/keyboards/handwired/wakizashi40/keymaps/default/keymap.c b/keyboards/handwired/wakizashi40/keymaps/default/keymap.c
new file mode 100644
index 0000000000..910e5bde12
--- /dev/null
+++ b/keyboards/handwired/wakizashi40/keymaps/default/keymap.c
@@ -0,0 +1,44 @@
+/* Copyright 2021 xiao (@xia0)
+ *
+ * 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/>.
+ */
+
+#include QMK_KEYBOARD_H
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ [0] = LAYOUT_all(
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ MO(3), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
+ KC_LCTL, KC_LGUI, KC_LALT, LT(1, KC_SPC), LT(2, KC_SPC), KC_LALT, KC_MENU, KC_LCTL),
+
+ [1] = LAYOUT_all(
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F5, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
+ MO(3), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_TRNS, KC_EQL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [2] = LAYOUT_all(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS,
+ MO(11), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_QUOT,
+ 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_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [3] = LAYOUT_all(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_QUOT,
+ 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)
+
+};
diff --git a/keyboards/handwired/wakizashi40/keymaps/via/keymap.c b/keyboards/handwired/wakizashi40/keymaps/via/keymap.c
new file mode 100644
index 0000000000..d456b8b40a
--- /dev/null
+++ b/keyboards/handwired/wakizashi40/keymaps/via/keymap.c
@@ -0,0 +1,92 @@
+/* Copyright 2021 xiao (@xia0)
+ *
+ * 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/>.
+ */
+
+#include QMK_KEYBOARD_H
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ [0] = LAYOUT_all(
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ MO(3), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
+ KC_LCTL, KC_LGUI, KC_LALT, LT(1, KC_SPC), LT(2, KC_SPC), KC_LALT, KC_MENU, KC_LCTL),
+
+ [1] = LAYOUT_all(
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F5, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
+ MO(11), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_TRNS, KC_EQL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [2] = LAYOUT_all(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS,
+ MO(11), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_QUOT,
+ 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_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [3] = LAYOUT_all(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_QUOT,
+ 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),
+
+ [4] = LAYOUT_all(
+ 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [5] = LAYOUT_all(
+ 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [6] = LAYOUT_all(
+ 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [7] = LAYOUT_all(
+ 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [8] = LAYOUT_all(
+ 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [9] = LAYOUT_all(
+ 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [10] = LAYOUT_all(
+ 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [11] = LAYOUT_all(
+ 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_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)
+
+};
diff --git a/keyboards/handwired/wakizashi40/keymaps/via/rules.mk b/keyboards/handwired/wakizashi40/keymaps/via/rules.mk
new file mode 100644
index 0000000000..7a49719505
--- /dev/null
+++ b/keyboards/handwired/wakizashi40/keymaps/via/rules.mk
@@ -0,0 +1,4 @@
+# rules.mk overrides to enable VIA
+
+VIA_ENABLE = yes
+LTO_ENABLE = yes
diff --git a/keyboards/handwired/wakizashi40/readme.md b/keyboards/handwired/wakizashi40/readme.md
new file mode 100644
index 0000000000..d94a75651c
--- /dev/null
+++ b/keyboards/handwired/wakizashi40/readme.md
@@ -0,0 +1,19 @@
+# Wakizashi 40
+
+![Wakizashi40](https://cdn.thingiverse.com/renders/51/50/81/13/a9/7078248666f70b422127c6662cf79563_preview_featured.jpg)
+
+Reverse stagger 40% keyboard based on the Katana 60.
+
+* Keyboard Maintainer: [fumbucker](https://github.com/xia0)
+* Hardware Supported: Teensy2++
+* Hardware Availability: [thingiverse](https://www.thingiverse.com/thing:3467930)
+
+Make example for this keyboard (after setting up your build environment):
+
+ make handwired/wakizashi40:default
+
+See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
+
+## Bootloader
+
+* **Keycode in layout**: Press the key mapped to `RESET` if it is available (Capslock + R).
diff --git a/keyboards/handwired/wakizashi40/rules.mk b/keyboards/handwired/wakizashi40/rules.mk
new file mode 100644
index 0000000000..6e7633bfe0
--- /dev/null
+++ b/keyboards/handwired/wakizashi40/rules.mk
@@ -0,0 +1 @@
+# This file intentionally left blank