summaryrefslogtreecommitdiffstats
path: root/keyboards/crkbd/rev1
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-05-24 23:23:20 -0700
committerGitHub <noreply@github.com>2021-05-24 23:23:20 -0700
commit57158cc3bcd169bc76785099fe2ded359d94eaa2 (patch)
tree8b29410902050e40f99f225e5282c0ee31bfd4e5 /keyboards/crkbd/rev1
parent8e22da67c1ddafa45b2e4d0ec4449dc79b509b89 (diff)
[Keyboard] Corne - Remove legacy revision support (#12226)
Diffstat (limited to 'keyboards/crkbd/rev1')
-rw-r--r--keyboards/crkbd/rev1/common/common.c19
-rw-r--r--keyboards/crkbd/rev1/common/common.h24
-rw-r--r--keyboards/crkbd/rev1/common/config.h29
-rw-r--r--keyboards/crkbd/rev1/common/keymaps/via/config.h46
-rw-r--r--keyboards/crkbd/rev1/common/keymaps/via/keymap.c174
-rw-r--r--keyboards/crkbd/rev1/common/keymaps/via/rules.mk5
-rw-r--r--keyboards/crkbd/rev1/common/rules.mk2
-rw-r--r--keyboards/crkbd/rev1/config.h7
-rw-r--r--keyboards/crkbd/rev1/legacy/config.h22
-rw-r--r--keyboards/crkbd/rev1/legacy/i2c.c162
-rw-r--r--keyboards/crkbd/rev1/legacy/i2c.h46
-rw-r--r--keyboards/crkbd/rev1/legacy/legacy.c19
-rw-r--r--keyboards/crkbd/rev1/legacy/legacy.h23
-rw-r--r--keyboards/crkbd/rev1/legacy/matrix.c397
-rw-r--r--keyboards/crkbd/rev1/legacy/post_config.h27
-rw-r--r--keyboards/crkbd/rev1/legacy/rules.mk11
-rw-r--r--keyboards/crkbd/rev1/legacy/serial.c589
-rw-r--r--keyboards/crkbd/rev1/legacy/serial.h84
-rw-r--r--keyboards/crkbd/rev1/legacy/serial_config.h22
-rw-r--r--keyboards/crkbd/rev1/legacy/serial_config_simpleapi.h23
-rw-r--r--keyboards/crkbd/rev1/legacy/split_scomm.c111
-rw-r--r--keyboards/crkbd/rev1/legacy/split_scomm.h42
-rw-r--r--keyboards/crkbd/rev1/legacy/split_util.c127
-rw-r--r--keyboards/crkbd/rev1/legacy/split_util.h37
-rw-r--r--keyboards/crkbd/rev1/legacy/ssd1306.c357
-rw-r--r--keyboards/crkbd/rev1/legacy/ssd1306.h90
-rw-r--r--keyboards/crkbd/rev1/rev1.c45
-rw-r--r--keyboards/crkbd/rev1/rev1.h9
-rw-r--r--keyboards/crkbd/rev1/rules.mk4
29 files changed, 17 insertions, 2536 deletions
diff --git a/keyboards/crkbd/rev1/common/common.c b/keyboards/crkbd/rev1/common/common.c
deleted file mode 100644
index ddc0b5fe91..0000000000
--- a/keyboards/crkbd/rev1/common/common.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-Copyright 2019 @foostan
-Copyright 2020 Drashna Jaelre <@drashna>
-
-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 "common.h"
diff --git a/keyboards/crkbd/rev1/common/common.h b/keyboards/crkbd/rev1/common/common.h
deleted file mode 100644
index 71779e2e0f..0000000000
--- a/keyboards/crkbd/rev1/common/common.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-Copyright 2019 @foostan
-Copyright 2020 Drashna Jaelre <@drashna>
-
-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 "rev1.h"
-
-#define has_usb() is_keyboard_master()
-#define is_master is_keyboard_master()
diff --git a/keyboards/crkbd/rev1/common/config.h b/keyboards/crkbd/rev1/common/config.h
deleted file mode 100644
index b468fe3956..0000000000
--- a/keyboards/crkbd/rev1/common/config.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-Copyright 2019 @foostan
-Copyright 2020 Drashna Jaelre <@drashna>
-
-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
-
-#define USE_SERIAL
-#define SOFT_SERIAL_PIN D2
-
-#ifdef RGB_MATRIX_ENABLE
-# define RGB_MATRIX_SPLIT { 27, 27 }
-# define SPLIT_TRANSPORT_MIRROR
-#endif
-
-#define DIODE_DIRECTION COL2ROW
diff --git a/keyboards/crkbd/rev1/common/keymaps/via/config.h b/keyboards/crkbd/rev1/common/keymaps/via/config.h
deleted file mode 100644
index aa2d45e56d..0000000000
--- a/keyboards/crkbd/rev1/common/keymaps/via/config.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-Copyright 2019 @foostan
-Copyright 2020 Drashna Jaelre <@drashna>
-
-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
-
-//#define USE_MATRIX_I2C
-#ifdef KEYBOARD_crkbd_rev1_legacy
-# undef USE_I2C
-# define USE_SERIAL
-#endif
-
-/* Select hand configuration */
-
-#define MASTER_LEFT
-// #define MASTER_RIGHT
-// #define EE_HANDS
-
-#define USE_SERIAL_PD2
-
-
-#undef RGBLED_NUM
-#define RGBLIGHT_ANIMATIONS
-#define RGBLED_NUM 27
-#define RGBLIGHT_LIMIT_VAL 120
-#define RGBLIGHT_HUE_STEP 10
-#define RGBLIGHT_SAT_STEP 17
-#define RGBLIGHT_VAL_STEP 17
-
-#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c"
diff --git a/keyboards/crkbd/rev1/common/keymaps/via/keymap.c b/keyboards/crkbd/rev1/common/keymaps/via/keymap.c
deleted file mode 100644
index ecd1f17a5c..0000000000
--- a/keyboards/crkbd/rev1/common/keymaps/via/keymap.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-Copyright 2019 @foostan
-Copyright 2020 Drashna Jaelre <@drashna>
-
-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_split_3x6_3(
- //,-----------------------------------------------------. ,-----------------------------------------------------.
- KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
- //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
- KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
- //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
- KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ESC,
- //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
- KC_LGUI, FN_MO13, KC_SPC, KC_ENT, FN_MO23, KC_RALT
- //`--------------------------' `--------------------------'
-
- ),
-
- [1] = LAYOUT_split_3x6_3(
- //,-----------------------------------------------------. ,-----------------------------------------------------.
- KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
- //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
- KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, XXXXXXX, XXXXXXX,
- //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
- KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
- //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
- KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT
- //`--------------------------' `--------------------------'
- ),
-
- [2] = LAYOUT_split_3x6_3(
- //,-----------------------------------------------------. ,-----------------------------------------------------.
- KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
- //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
- KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_GRV,
- //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
- KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_TILD,
- //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
- KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT
- //`--------------------------' `--------------------------'
- ),
-
- [3] = LAYOUT_split_3x6_3(
- //,-----------------------------------------------------. ,-----------------------------------------------------.
- RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
- //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
- RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
- //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
- RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
- //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
- KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT
- //`--------------------------' `--------------------------'
- )
-};
-
-#ifdef OLED_DRIVER_ENABLE
-oled_rotation_t oled_init_user(oled_rotation_t rotation) {
- if (!is_master) {
- return OLED_ROTATION_180; // flips the display 180 degrees if offhand
- }
- return rotation;
-}
-
-#define L_BASE 0
-#define L_LOWER 2
-#define L_RAISE 4
-#define L_ADJUST 8
-
-void oled_render_layer_state(void) {
- oled_write_P(PSTR("Layer: "), false);
- switch (layer_state) {
- case L_BASE:
- oled_write_ln_P(PSTR("Default"), false);
- break;
- case L_LOWER:
- oled_write_ln_P(PSTR("Lower"), false);
- break;
- case L_RAISE:
- oled_write_ln_P(PSTR("Raise"), false);
- break;
- case L_ADJUST:
- case L_ADJUST|L_LOWER:
- case L_ADJUST|L_RAISE:
- case L_ADJUST|L_LOWER|L_RAISE:
- oled_write_ln_P(PSTR("Adjust"), false);
- break;
- }
-}
-
-
-char keylog_str[24] = {};
-
-const char code_to_name[60] = {
- ' ', ' ', ' ', ' ', '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',
- '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
- 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\',
- '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
-
-void set_keylog(uint16_t keycode, keyrecord_t *record) {
- char name = ' ';
- if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
- (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; }
- if (keycode < 60) {
- name = code_to_name[keycode];
- }
-
- // update keylog
- snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
- record->event.key.row, record->event.key.col,
- keycode, name);
-}
-
-void oled_render_keylog(void) {
- oled_write(keylog_str, false);
-}
-
-void render_bootmagic_status(bool status) {
- /* Show Ctrl-Gui Swap options */
- static const char PROGMEM logo[][2][3] = {
- {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
- {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
- };
- if (status) {
- oled_write_ln_P(logo[0][0], false);
- oled_write_ln_P(logo[0][1], false);
- } else {
- oled_write_ln_P(logo[1][0], false);
- oled_write_ln_P(logo[1][1], false);
- }
-}
-
-void oled_render_logo(void) {
- static const char PROGMEM crkbd_logo[] = {
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
- 0};
- oled_write_P(crkbd_logo, false);
-}
-
-void oled_task_user(void) {
- if (is_master) {
- oled_render_layer_state();
- oled_render_keylog();
- } else {
- oled_render_logo();
- }
-}
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- if (record->event.pressed) {
- set_keylog(keycode, record);
- }
- return true;
-}
-#endif // OLED_DRIVER_ENABLE
diff --git a/keyboards/crkbd/rev1/common/keymaps/via/rules.mk b/keyboards/crkbd/rev1/common/keymaps/via/rules.mk
deleted file mode 100644
index 93b2afed44..0000000000
--- a/keyboards/crkbd/rev1/common/keymaps/via/rules.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-MOUSEKEY_ENABLE = no # Mouse keys
-RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
-VIA_ENABLE = yes # Enable VIA
-OLED_DRIVER_ENABLE = yes
-LTO_ENABLE = yes
diff --git a/keyboards/crkbd/rev1/common/rules.mk b/keyboards/crkbd/rev1/common/rules.mk
index d38a618090..836587e45e 100644
--- a/keyboards/crkbd/rev1/common/rules.mk
+++ b/keyboards/crkbd/rev1/common/rules.mk
@@ -1 +1 @@
-SPLIT_KEYBOARD = yes
+DEFAULT_FOLDER = crkbd/rev1
diff --git a/keyboards/crkbd/rev1/config.h b/keyboards/crkbd/rev1/config.h
index 60bd379724..95ffb6d5bf 100644
--- a/keyboards/crkbd/rev1/config.h
+++ b/keyboards/crkbd/rev1/config.h
@@ -18,6 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
+#define USE_SERIAL
+#define SOFT_SERIAL_PIN D2
+
/* ws2812 RGB LED */
#define RGB_DI_PIN D3
@@ -29,4 +32,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RGB_MATRIX_ENABLE
# define RGBLED_NUM 54 // Number of LEDs
# define DRIVER_LED_TOTAL RGBLED_NUM
+# define RGB_MATRIX_SPLIT { 27, 27 }
+# define SPLIT_TRANSPORT_MIRROR
#endif
+
+#define DIODE_DIRECTION COL2ROW
diff --git a/keyboards/crkbd/rev1/legacy/config.h b/keyboards/crkbd/rev1/legacy/config.h
deleted file mode 100644
index e95f49125a..0000000000
--- a/keyboards/crkbd/rev1/legacy/config.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-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
-
-#include "serial_config.h"
-
diff --git a/keyboards/crkbd/rev1/legacy/i2c.c b/keyboards/crkbd/rev1/legacy/i2c.c
deleted file mode 100644
index 7b45c3f866..0000000000
--- a/keyboards/crkbd/rev1/legacy/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"
-
-#if defined(USE_I2C) || defined(USE_MATRIX_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 or 400kHz (see ./i2c.h SCL_CLOCK)
-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/crkbd/rev1/legacy/i2c.h b/keyboards/crkbd/rev1/legacy/i2c.h
deleted file mode 100644
index 710662c7ab..0000000000
--- a/keyboards/crkbd/rev1/legacy/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 400kHz
-#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/crkbd/rev1/legacy/legacy.c b/keyboards/crkbd/rev1/legacy/legacy.c
deleted file mode 100644
index 595ff1eaf7..0000000000
--- a/keyboards/crkbd/rev1/legacy/legacy.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-Copyright 2019 @foostan
-Copyright 2020 Drashna Jaelre <@drashna>
-
-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 "legacy.h"
diff --git a/keyboards/crkbd/rev1/legacy/legacy.h b/keyboards/crkbd/rev1/legacy/legacy.h
deleted file mode 100644
index 08dfcefbc1..0000000000
--- a/keyboards/crkbd/rev1/legacy/legacy.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-Copyright 2019 @foostan
-Copyright 2020 Drashna Jaelre <@drashna>
-
-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 "rev1.h"
-
-extern uint8_t is_master; \ No newline at end of file
diff --git a/keyboards/crkbd/rev1/legacy/matrix.c b/keyboards/crkbd/rev1/legacy/matrix.c
deleted file mode 100644
index 371b1913e1..0000000000
--- a/keyboards/crkbd/rev1/legacy/matrix.c
+++ /dev/null
@@ -1,397 +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 <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 "quantum.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 tx_rx_leds_init(void)
-{
-#ifndef NO_DEBUG_LEDS
- setPinOutput(B0);
- setPinOutput(D5);
- writePinHigh(B0);
- writePinHigh(D5);
-#endif
-}
-
-void tx_led_on(void)
-{
-#ifndef NO_DEBUG_LEDS
- writePinLow(D5);
-#endif
-}
-
-void tx_led_off(void)
-{
-#ifndef NO_DEBUG_LEDS
- writePinHigh(D5);
-#endif
-}
-
-void rx_led_on(void)
-{
-#ifndef NO_DEBUG_LEDS
- writePinLow(B0);
-#endif
-}
-
-void rx_led_off(void)
-{
-#ifndef NO_DEBUG_LEDS
- writePinHigh(B0);
-#endif
-}
-
-
-void matrix_init(void)
-{
- split_keyboard_setup();
-
- // initialize row and col
- unselect_rows();
- init_cols();
-
- tx_rx_leds_init();
-
- // initialize matrix state: all keys off
- for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- matrix_debouncing[i] = 0;
- }
-