summaryrefslogtreecommitdiff
path: root/keyboards/zinc/rev1
diff options
context:
space:
mode:
authorMonksoffunk <monksoffunk@users.noreply.github.com>2018-10-27 13:23:49 +0900
committerDrashna Jaelre <drashna@live.com>2018-10-26 21:23:49 -0700
commit23cd9f4dee791464196faaf6692599325cfe6f3c (patch)
tree51a18c3beaa8f1937b1aa1efd5209ca8583b944a /keyboards/zinc/rev1
parent73e92ef0c06de389d39d3ca0a8c98da2196ebec7 (diff)
Keyboard: Add new keyboard Zinc (#4245)
* Add Zinc keyboard * Fix photo * Fix readme.md * Fix RGB LED init of monks/keymap.c * Fix default keymap and readme.jp * Fix change DEFS of RGB ANIMATIONS to LED_ANIMATIONS * Add EOL * Use serial_config_simpleapi.h * Fix comment char * Fix error handling in split_scomm.c : mtei works * Fix keymaps * Remove DISABLE_LEADER definition * Remove pro_micro.h * Add 2 spaces after Hardware name * Fix keymaps - remove audio codes - change LAYOUT to LAYOUT_ortho_4X12 - change "persistent_default_layer_set" to core function * Use the Community Layouts feature - with some clean up
Diffstat (limited to 'keyboards/zinc/rev1')
-rw-r--r--keyboards/zinc/rev1/config.h149
-rw-r--r--keyboards/zinc/rev1/info.json13
-rw-r--r--keyboards/zinc/rev1/matrix.c356
-rw-r--r--keyboards/zinc/rev1/rev1.c6
-rw-r--r--keyboards/zinc/rev1/rev1.h44
-rw-r--r--keyboards/zinc/rev1/rules.mk4
-rw-r--r--keyboards/zinc/rev1/serial_config.h18
-rw-r--r--keyboards/zinc/rev1/serial_config_simpleapi.h8
-rw-r--r--keyboards/zinc/rev1/split_scomm.c95
-rw-r--r--keyboards/zinc/rev1/split_scomm.h24
-rw-r--r--keyboards/zinc/rev1/split_util.c70
-rw-r--r--keyboards/zinc/rev1/split_util.h19
12 files changed, 806 insertions, 0 deletions
diff --git a/keyboards/zinc/rev1/config.h b/keyboards/zinc/rev1/config.h
new file mode 100644
index 0000000000..c628400f2e
--- /dev/null
+++ b/keyboards/zinc/rev1/config.h
@@ -0,0 +1,149 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+Copyright 2015 Jack Humbert
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+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
+
+//#ifndef REV1_CONFIG_H
+//#define REV1_CONFIG_H
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x9991
+#define DEVICE_VER 0x0001
+#define MANUFACTURER monksoffunk
+#define PRODUCT zinc rev.1
+#define DESCRIPTION A split keyboard
+
+
+#define PREVENT_STUCK_MODIFIERS
+#define TAPPING_FORCE_HOLD
+#define TAPPING_TERM 100
+
+/* Use I2C or Serial */
+//#define USE_I2C
+#define USE_SERIAL
+//#define USE_MATRIX_I2C
+
+/* Select hand configuration */
+#define MASTER_LEFT
+//#define MASTER_RIGHT
+//#define EE_HANDS
+
+
+/* key matrix size */
+// Rows are doubled-up
+ #define MATRIX_ROWS 8
+ #define MATRIX_ROW_PINS { F6, F7, B1, B3 }
+
+// wiring of each half
+#define MATRIX_COLS 6
+#define MATRIX_COL_PINS { F4, D4, C6, D7, E6, B4 }
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* number of backlight levels */
+// #define BACKLIGHT_LEVELS 3
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCING_DELAY 5
+
+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
+//#define LOCKING_SUPPORT_ENABLE
+/* Locking resynchronize hack */
+//#define LOCKING_RESYNC_ENABLE
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+/* ws2812 RGB LED */
+#define RGB_DI_PIN D3
+#define RGBLIGHT_TIMER
+//#define RGBLED_NUM 12 // Number of LEDs. see ./keymaps/default/config.h
+#define ws2812_PORTREG PORTD
+#define ws2812_DDRREG DDRD
+
+// RGB LED support
+//#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no
+// see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes
+#ifdef RGBLED_BACK
+ #define RGBLED_NUM 24
+#else
+ #define RGBLED_NUM 6
+#endif
+
+#ifndef IOS_DEVICE_ENABLE
+ #if RGBLED_NUM <= 6
+ #define RGBLIGHT_LIMIT_VAL 255
+ #else
+ #if RGBLED_NUM <= 16
+ #define RGBLIGHT_LIMIT_VAL 130
+ #else
+ #define RGBLIGHT_LIMIT_VAL 120
+ #endif
+ #endif
+ #define RGBLIGHT_VAL_STEP 17
+#else
+ #if RGBLED_NUM <= 6
+ #define RGBLIGHT_LIMIT_VAL 90
+ #else
+ #if RGBLED_NUM <= 16
+ #define RGBLIGHT_LIMIT_VAL 45
+ #else
+ #define RGBLIGHT_LIMIT_VAL 35
+ #endif
+ #endif
+ #define RGBLIGHT_VAL_STEP 4
+#endif
+#define RGBLIGHT_HUE_STEP 10
+#define RGBLIGHT_SAT_STEP 17
+
+#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE)
+// USB_MAX_POWER_CONSUMPTION value
+// 120 RGBoff
+// 330 RGB 6
+// 300 RGB 32
+ #define USB_MAX_POWER_CONSUMPTION 400
+#else
+ // fix iPhone and iPad power adapter issue
+ // iOS device need lessthan 100
+ #define USB_MAX_POWER_CONSUMPTION 100
+#endif
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+// #define NO_DEBUG
+
+/* disable print */
+// #define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
+
+
+//#endif
diff --git a/keyboards/zinc/rev1/info.json b/keyboards/zinc/rev1/info.json
new file mode 100644
index 0000000000..0ca8acded9
--- /dev/null
+++ b/keyboards/zinc/rev1/info.json
@@ -0,0 +1,13 @@
+{
+ "keyboard_name": "Zinc rev.1",
+ "url": "https://github.com/monksoffunk/zinc",
+ "maintainer": "monksoffunk",
+ "width": 15,
+ "height": 4,
+ "layouts": {
+ "LAYOUT": {
+ "key_count": 48,
+ "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":13, "y":1}, {"x":14, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":12, "y":2}, {"x":13, "y":2}, {"x":14, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}, {"x":12, "y":3}, {"x":13, "y":3}, {"x":14, "y":3}]
+ }
+ }
+}
diff --git a/keyboards/zinc/rev1/matrix.c b/keyboards/zinc/rev1/matrix.c
new file mode 100644
index 0000000000..220954f051
--- /dev/null
+++ b/keyboards/zinc/rev1/matrix.c
@@ -0,0 +1,356 @@
+/*
+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 <string.h>
+#include <avr/io.h>
+#include <avr/wdt.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+#include "split_util.h"
+#include "pro_micro.h"
+
+#ifdef USE_MATRIX_I2C
+# include "i2c.h"
+#else // USE_SERIAL
+# include "split_scomm.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;
+uint8_t is_master = 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);
+static uint8_t matrix_master_scan(void);
+
+
+__attribute__ ((weak))
+void matrix_init_kb(void) {
+ matrix_init_user();
+}
+
+__attribute__ ((weak))
+void matrix_scan_kb(void) {
+ matrix_scan_user();
+}
+
+__attribute__ ((weak))
+void matrix_init_user(void) {
+}
+
+__attribute__ ((weak))
+void matrix_scan_user(void) {
+}
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ debug_enable = true;
+ debug_matrix = true;
+ debug_mouse = true;
+ // initialize row and col
+ unselect_rows();
+ init_cols();
+
+ TX_RX_LED_INIT;
+ TXLED0;
+ RXLED0;
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+
+ is_master = has_usb();
+
+ 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_MATRIX_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(int master_changed) {
+ int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
+#ifdef SERIAL_USE_MULTI_TRANSACTION
+ int ret=serial_update_buffers(master_changed);
+#else
+ int ret=serial_update_buffers();
+#endif
+ if (ret ) {
+ if(ret==2) RXLED1;
+ return 1;
+ }
+ RXLED0;
+ memcpy(&matrix[slaveOffset],
+ (void *)serial_slave_buffer, sizeof(serial_slave_buffer));
+ return 0;
+}
+#endif
+
+uint8_t matrix_scan(void)
+{
+ if (is_master) {
+ matrix_master_scan();
+ }else{
+ matrix_slave_scan();
+ int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
+ memcpy(&matrix[offset],
+ (void *)serial_master_buffer, sizeof(serial_master_buffer));
+ matrix_scan_quantum();
+ }
+ return 1;
+}
+
+
+uint8_t matrix_master_scan(void) {
+
+ int ret = _matrix_scan();
+ int mchanged = 1;
+ int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
+
+#ifdef USE_MATRIX_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
+ #ifdef SERIAL_USE_MULTI_TRANSACTION
+ mchanged = memcmp((void *)serial_master_buffer,
+ &matrix[offset], sizeof(serial_master_buffer));
+ #endif
+ memcpy((void *)serial_master_buffer,
+ &matrix[offset], sizeof(serial_master_buffer));
+#endif
+
+#ifdef USE_MATRIX_I2C
+ if( i2c_transaction() ) {
+#else // USE_SERIAL
+ if( serial_transaction(mchanged) ) {
+#endif
+ // turn on the indicator led when halves are disconnected
+ TXLED1;
+
+ error_count++;
+
+ if (error_count > ERROR_DISCONNECT_COUNT) {
+ // reset other half if disconnected
+ int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
+ for (int i = 0; i < ROWS_PER_HAND; ++i) {
+ matrix[slaveOffset+i] = 0;
+ }
+ }
+ } else {
+ // turn off the indicator led on no error
+ TXLED0;
+ error_count = 0;
+ }
+ matrix_scan_quantum();
+ return ret;
+}
+
+void matrix_slave_scan(void) {
+ _matrix_scan();
+
+ int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
+
+#ifdef USE_MATRIX_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
+ #ifdef SERIAL_USE_MULTI_TRANSACTION
+ int change = 0;
+ #endif
+ for (int i = 0; i < ROWS_PER_HAND; ++i) {
+ #ifdef SERIAL_USE_MULTI_TRANSACTION
+ if( serial_slave_buffer[i] != matrix[offset+i] )
+ change = 1;
+ #endif
+ serial_slave_buffer[i] = matrix[offset+i];
+ }
+ #ifdef SERIAL_USE_MULTI_TRANSACTION
+ slave_buffer_change_count += change;
+ #endif
+#endif
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ phex(row); print(": ");
+ pbin_reverse16(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop16(matrix[i]);
+ }
+ return count;
+}
+
+static void init_cols(void)
+{
+ for(int x = 0; x < MATRIX_COLS; x++) {
+ _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
+ _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
+ }
+}
+
+static matrix_row_t read_cols(void)
+{
+ matrix_row_t result = 0;
+ for(int x = 0; x < MATRIX_COLS; x++) {
+ result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
+ }
+ return result;
+}
+
+static void unselect_rows(void)
+{
+ for(int x = 0; x < ROWS_PER_HAND; x++) {
+ _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
+ _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
+ }
+}
+
+static void select_row(uint8_t row)
+{
+ _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
+ _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
+}
diff --git a/keyboards/zinc/rev1/rev1.c b/keyboards/zinc/rev1/rev1.c
new file mode 100644
index 0000000000..2ce08a07c4
--- /dev/null
+++ b/keyboards/zinc/rev1/rev1.c
@@ -0,0 +1,6 @@
+#include "zinc.h"
+
+void matrix_init_kb(void) {
+ matrix_init_user();
+};
+
diff --git a/keyboards/zinc/rev1/rev1.h b/keyboards/zinc/rev1/rev1.h
new file mode 100644
index 0000000000..933e635c2d
--- /dev/null
+++ b/keyboards/zinc/rev1/rev1.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#include "../zinc.h"
+
+//void promicro_bootloader_jmp(bool program);
+#include "quantum.h"
+
+#ifdef RGBLIGHT_ENABLE
+//rgb led driver
+#include "ws2812.h"
+#endif
+
+#ifdef USE_I2C
+#include <stddef.h>
+#ifdef __AVR__
+ #include <avr/io.h>
+ #include <avr/interrupt.h>
+#endif
+#endif
+
+//void promicro_bootloader_jmp(bool program);
+
+
+
+// Standard Keymap
+// (TRRS jack on both halves are to the left side)
+#define LAYOUT( \
+ L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
+ L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
+ L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
+ L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
+ ) \
+ { \
+ { L00, L01, L02, L03, L04, L05}, \
+ { L10, L11, L12, L13, L14, L15}, \
+ { L20, L21, L22, L23, L24, L25}, \
+ { L30, L31, L32, L33, L34, L35}, \
+ { R00, R01, R02, R03, R04, R05 }, \
+ { R10, R11, R12, R13, R14, R15 }, \
+ { R20, R21, R22, R23, R24, R25 }, \
+ { R30, R31, R32, R33, R34, R35 }, \
+ }
+
+#define LAYOUT_ortho_4x12 LAYOUT
diff --git a/keyboards/zinc/rev1/rules.mk b/keyboards/zinc/rev1/rules.mk
new file mode 100644
index 0000000000..e78b9258d7
--- /dev/null
+++ b/keyboards/zinc/rev1/rules.mk
@@ -0,0 +1,4 @@
+SRC += rev1/matrix.c
+SRC += rev1/split_util.c
+SRC += rev1/split_scomm.c
+SRC += ws2812.c
diff --git a/keyboards/zinc/rev1/serial_config.h b/keyboards/zinc/rev1/serial_config.h
new file mode 100644
index 0000000000..9fb5dfc671
--- /dev/null
+++ b/keyboards/zinc/rev1/serial_config.h
@@ -0,0 +1,18 @@
+#ifndef SOFT_SERIAL_CONFIG_H
+#define SOFT_SERIAL_CONFIG_H
+
+#ifndef SOFT_SERIAL_PIN
+/* Soft Serial defines */
+#define SOFT_SERIAL_PIN D2
+// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
+// // 1: about 137kbps (default)
+// // 2: about 75kbps
+// // 3: about 39kbps
+// // 4: about 26kbps
+// // 5: about 20kbps
+#endif
+
+//// USE flexible API (using multi-type transaction function)
+#define SERIAL_USE_MULTI_TRANSACTION
+
+#endif /* SOFT_SERIAL_CONFIG_H */
diff --git a/keyboards/zinc/rev1/serial_config_simpleapi.h b/keyboards/zinc/rev1/serial_config_simpleapi.h
new file mode 100644
index 0000000000..e2d22a41e7
--- /dev/null
+++ b/keyboards/zinc/rev1/serial_config_simpleapi.h
@@ -0,0 +1,8 @@
+#ifndef SERIAL_CONFIG_SIMPLEAPI_H
+#define SERIAL_CONFIG_SIMPLEAPI_H
+
+#undef SERIAL_USE_MULTI_TRANSACTION
+#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
+
+#endif // SERIAL_CONFIG_SIMPLEAPI_H
diff --git a/keyboards/zinc/rev1/split_scomm.c b/keyboards/zinc/rev1/split_scomm.c
new file mode 100644
index 0000000000..50d233ce9a
--- /dev/null
+++ b/keyboards/zinc/rev1/split_scomm.c
@@ -0,0 +1,95 @@
+#ifdef USE_SERIAL
+#ifdef SERIAL_USE_MULTI_TRANSACTION
+/* --- USE flexible API (using multi-type transaction function) --- */
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <split_scomm.h>
+#include "serial.h"
+#ifdef SERIAL_DEBUG_MODE
+#include <avr/io.h>
+#endif
+#ifdef CONSOLE_ENABLE
+ #include <print.h>
+#endif
+
+uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
+uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
+uint8_t volatile status_com = 0;
+uint8_t volatile status1 = 0;
+uint8_t slave_buffer_change_count = 0;
+uint8_t s_change_old = 0xff;
+uint8_t s_change_new = 0xff;
+
+SSTD_t transactions[] = {
+#define GET_SLAVE_STATUS 0
+ /* master buffer not changed, only recive slave_buffer_change_count */
+ { (uint8_t *)&status_com,
+ 0, NULL,
+ sizeof(slave_buffer_change_count), &slave_buffer_change_count,
+ },
+#define PUT_MASTER_GET_SLAVE_STATUS 1
+ /* master buffer changed need send, and recive slave_buffer_change_count */
+ { (uint8_t *)&status_com,
+ sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
+ sizeof(slave_buffer_change_count), &slave_buffer_change_count,
+ },
+#define GET_SLAVE_BUFFER 2
+ /* recive serial_slave_buffer */
+ { (uint8_t *)&status1,
+ 0, NULL,
+ sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
+ }
+};
+
+void serial_master_init(void)
+{
+ soft_serial_initiator_init(transactions, TID_LIMIT(transactions));
+}
+
+void serial_slave_init(void)
+{
+ soft_serial_target_init(transactions, TID_LIMIT(transactions));
+}
+
+// 0 => no error
+// 1 => slave did not respond
+// 2 => checksum error
+int serial_update_buffers(int master_update)
+{
+ int status, smatstatus;
+ static int need_retry = 0;
+
+ if( s_change_old != s_change_new ) {
+ smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER);
+ if( smatstatus == TRANSACTION_END ) {
+ s_change_old = s_change_new;
+#ifdef CONSOLE_ENABLE
+ uprintf("slave matrix = %b %b %b %b %b\n",
+ serial_slave_buffer[0], serial_slave_buffer[1],
+ serial_slave_buffer[2], serial_slave_buffer[3],
+ serial_slave_buffer[4] );
+#endif
+ }
+ } else {
+ // serial_slave_buffer dosen't change
+ smatstatus = TRANSACTION_END; // dummy status
+ }
+
+ if( !master_update && !need_retry) {
+ status = soft_serial_transaction(GET_SLAVE_STATUS);
+ } else {
+ status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
+ }
+ if( status == TRANSACTION_END ) {
+ s_change_new = slave_buffer_change_count;
+ need_retry = 0;
+ } else {
+ need_retry = 1;
+ }
+ return smatstatus;
+}
+
+#endif // SERIAL_USE_MULTI_TRANSACTION
+#endif /* USE_SERIAL */
diff --git a/keyboards/zinc/rev1/split_scomm.h b/keyboards/zinc/rev1/split_scomm.h
new file mode 100644
index 0000000000..873d8939d8
--- /dev/null
+++ b/keyboards/zinc/rev1/split_scomm.h
@@ -0,0 +1,24 @@
+#ifndef SPLIT_COMM_H
+#define SPLIT_COMM_H
+
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
+#include "serial.h"
+
+#else
+/* --- USE flexible API (using multi-type transaction function) --- */
+// Buffers for master - slave communication
+#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
+
+extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
+extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
+extern uint8_t slave_buffer_change_count;
+
+void serial_master_init(void);
+void serial_slave_init(void);
+int serial_update_buffers(int master_changed);
+
+#endif
+
+#endif /* SPLIT_COMM_H */
diff --git a/keyboards/zinc/rev1/split_util.c b/keyboards/zinc/rev1/split_util.c
new file mode 100644
index 0000000000..e1ff8b4379
--- /dev/null
+++ b/keyboards/zinc/rev1/split_util.c
@@ -0,0 +1,70 @@
+#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"
+
+#ifdef USE_MATRIX_I2C
+# include "i2c.h"
+#else
+# include "split_scomm.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_MATRIX_I2C
+ i2c_master_init();
+#else
+ serial_master_init();
+#endif
+}
+
+static void keyboard_slave_setup(void) {
+
+#ifdef USE_MATRIX_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();
+}
+
+// this code runs before the usb and keyboard is initialized
+void matrix_setup(void) {
+ split_keyboard_setup();
+}
diff --git a/keyboards/zinc/rev1/split_util.h b/keyboards/zinc/rev1/split_util.h
new file mode 100644
index 0000000000..687ca19bd3
--- /dev/null
+++ b/keyboards/zinc/rev1/split_util.h
@@ -0,0 +1,19 @@
+#ifndef SPLIT_KEYBOARD_UTIL_H
+#define SPLIT_KEYBOARD_UTIL_H
+
+#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 matrix_master_OLED_init (void);
+
+#endif