From 72ca319beefcd479954d5fb08325c0187148b357 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 14 Jan 2021 11:17:47 +1100 Subject: Uni660 refactor (#11526) --- keyboards/sirius/uni660/.noci | 0 keyboards/sirius/uni660/matrix.c | 160 --------------------- keyboards/sirius/uni660/readme.md | 17 --- keyboards/sirius/uni660/rev1/config.h | 47 +++--- .../sirius/uni660/rev1/keymaps/default/keymap.c | 14 +- keyboards/sirius/uni660/rev1/keymaps/via/keymap.c | 56 ++++---- keyboards/sirius/uni660/rev1/matrix.c | 160 +++++++++++++++++++++ keyboards/sirius/uni660/rev1/readme.md | 15 ++ keyboards/sirius/uni660/rev1/rev1.c | 35 +++++ keyboards/sirius/uni660/rev1/rev1.h | 69 +++++++-- keyboards/sirius/uni660/rev1/rules.mk | 27 ++++ keyboards/sirius/uni660/rev2/.noci | 0 keyboards/sirius/uni660/rev2/ansi/.noci | 0 keyboards/sirius/uni660/rev2/ansi/ansi.h | 29 ++-- keyboards/sirius/uni660/rev2/ansi/config.h | 47 +++--- .../uni660/rev2/ansi/keymaps/default/keymap.c | 14 +- .../sirius/uni660/rev2/ansi/keymaps/via/keymap.c | 56 ++++---- keyboards/sirius/uni660/rev2/ansi/readme.md | 15 ++ keyboards/sirius/uni660/rev2/iso/.noci | 0 keyboards/sirius/uni660/rev2/iso/config.h | 47 +++--- keyboards/sirius/uni660/rev2/iso/iso.h | 29 ++-- .../uni660/rev2/iso/keymaps/default/keymap.c | 14 +- .../sirius/uni660/rev2/iso/keymaps/via/keymap.c | 56 ++++---- keyboards/sirius/uni660/rev2/iso/readme.md | 15 ++ keyboards/sirius/uni660/rev2/matrix.c | 160 +++++++++++++++++++++ keyboards/sirius/uni660/rev2/readme.md | 16 +++ keyboards/sirius/uni660/rev2/rev2.c | 35 +++++ keyboards/sirius/uni660/rev2/rev2.h | 49 +++++++ keyboards/sirius/uni660/rev2/rules.mk | 29 ++++ keyboards/sirius/uni660/rules.mk | 33 ----- keyboards/sirius/uni660/uni660.c | 35 ----- keyboards/sirius/uni660/uni660.h | 51 ------- 32 files changed, 814 insertions(+), 516 deletions(-) delete mode 100644 keyboards/sirius/uni660/.noci delete mode 100644 keyboards/sirius/uni660/matrix.c delete mode 100644 keyboards/sirius/uni660/readme.md create mode 100644 keyboards/sirius/uni660/rev1/matrix.c create mode 100644 keyboards/sirius/uni660/rev1/readme.md create mode 100644 keyboards/sirius/uni660/rev1/rev1.c create mode 100644 keyboards/sirius/uni660/rev2/.noci create mode 100644 keyboards/sirius/uni660/rev2/ansi/.noci create mode 100644 keyboards/sirius/uni660/rev2/ansi/readme.md create mode 100644 keyboards/sirius/uni660/rev2/iso/.noci create mode 100644 keyboards/sirius/uni660/rev2/iso/readme.md create mode 100644 keyboards/sirius/uni660/rev2/matrix.c create mode 100644 keyboards/sirius/uni660/rev2/readme.md create mode 100644 keyboards/sirius/uni660/rev2/rev2.c create mode 100644 keyboards/sirius/uni660/rev2/rev2.h create mode 100644 keyboards/sirius/uni660/rev2/rules.mk delete mode 100644 keyboards/sirius/uni660/rules.mk delete mode 100644 keyboards/sirius/uni660/uni660.c delete mode 100644 keyboards/sirius/uni660/uni660.h (limited to 'keyboards') diff --git a/keyboards/sirius/uni660/.noci b/keyboards/sirius/uni660/.noci deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/keyboards/sirius/uni660/matrix.c b/keyboards/sirius/uni660/matrix.c deleted file mode 100644 index 3e231b33bc..0000000000 --- a/keyboards/sirius/uni660/matrix.c +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright 2012 Jun Wako -Copyright 2014 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 . -*/ -#include -#include -#if defined(__AVR__) -#include -#endif -#include "wait.h" -#include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" -#include "timer.h" -#include "debounce.h" - -#if (MATRIX_COLS <= 8) -# define print_matrix_header() print("\nr/c 01234567\n") -# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop(matrix[i]) -# define ROW_SHIFTER ((uint8_t)1) -#elif (MATRIX_COLS <= 16) -# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") -# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop16(matrix[i]) -# define ROW_SHIFTER ((uint16_t)1) -#elif (MATRIX_COLS <= 32) -# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") -# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop32(matrix[i]) -# define ROW_SHIFTER ((uint32_t)1) -#endif - -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; - - -__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) { - debounce_init(MATRIX_ROWS); - matrix_init_quantum(); -} - -uint8_t matrix_scan(void) -{ - bool matrix_has_changed = false; - - SERIAL_UART_INIT(); - - uint32_t timeout = 0; - - //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; - - //trust the external keystates entirely, erase the last data - uint8_t uart_data[17] = {0}; - - //there are 16 bytes corresponding to 16 columns, and an end byte - for (uint8_t i = 0; i < 17; i++) { - //wait for the serial data, timeout if it's been too long - //this only happened in testing with a loose wire, but does no - //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ - timeout++; - if (timeout > 10000){ - break; - } - } - uart_data[i] = SERIAL_UART_DATA; - } - - //check for the end packet, the key state bytes use the LSBs, so 0xE0 - //will only show up here if the correct bytes were recieved - if (uart_data[10] == 0xE0) - { - //shifting and transferring the keystates to the QMK matrix variable - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - matrix[i] = (uint16_t) uart_data[i*2] | (uint16_t) uart_data[i*2+1] << 8; - } - } - - debounce(matrix, matrix, MATRIX_ROWS, matrix_has_changed); - - matrix_scan_quantum(); - - return matrix_has_changed; -} - -inline -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix[row] & ((matrix_row_t)1<. #include "config_common.h" /* USB Device descriptor parameter */ - -#define VENDOR_ID 0x5352 // "SR" -#define PRODUCT_ID 0x0201 // Second Product First Version -#define DEVICE_VER 0x1912 // 2019.12 -#define MANUFACTURER SiRius -#define PRODUCT SiRius Uni660 -#define DESCRIPTION SiRius Uni660 +#define VENDOR_ID 0x5352 // "SR" +#define PRODUCT_ID 0x0201 // Second Product First Version +#define DEVICE_VER 0x1912 // 2019.12 +#define MANUFACTURER SiRius +#define PRODUCT Uni660 /* key matrix size */ #define MATRIX_ROWS 5 #define MATRIX_COLS 16 -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -//#define BACKLIGHT_LEVELS 3 - #define ONESHOT_TIMEOUT 500 +/* 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 + /* * Feature disable options * These options are also useful to firmware size reduction. @@ -55,8 +52,10 @@ along with this program. If not, see . //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION //UART settings for communication with the RF microcontroller #define SERIAL_UART_BAUD 1000000 @@ -65,14 +64,14 @@ along with this program. If not, see . #define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) #define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) #define SERIAL_UART_INIT() do { \ - /* baud rate */ \ - UBRR1L = SERIAL_UART_UBRR; \ - /* baud rate */ \ - UBRR1H = SERIAL_UART_UBRR >> 8; \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ - } while(0) + /* baud rate */ \ + UBRR1L = SERIAL_UART_UBRR; \ + /* baud rate */ \ + UBRR1H = SERIAL_UART_UBRR >> 8; \ + /* enable TX and RX */ \ + UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ + /* 8-bit data */ \ + UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ +} while (0) #define DYNAMIC_KEYMAP_LAYER_COUNT 4 diff --git a/keyboards/sirius/uni660/rev1/keymaps/default/keymap.c b/keyboards/sirius/uni660/rev1/keymaps/default/keymap.c index 336aa84108..459bb7c238 100644 --- a/keyboards/sirius/uni660/rev1/keymaps/default/keymap.c +++ b/keyboards/sirius/uni660/rev1/keymaps/default/keymap.c @@ -1,11 +1,11 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = LAYOUT( /* Base */ -KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, -KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, -KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, -KC_F3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, -KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT -), + [0] = LAYOUT( /* Base */ + KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, + KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, + KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_F3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ) }; diff --git a/keyboards/sirius/uni660/rev1/keymaps/via/keymap.c b/keyboards/sirius/uni660/rev1/keymaps/via/keymap.c index 61bac7e4d5..d0a1bf6e77 100644 --- a/keyboards/sirius/uni660/rev1/keymaps/via/keymap.c +++ b/keyboards/sirius/uni660/rev1/keymaps/via/keymap.c @@ -1,35 +1,35 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = LAYOUT( /* Base */ -KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, -KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, -KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, -KC_F3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, -KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT -), + [0] = LAYOUT( /* Base */ + KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, + KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, + KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_F3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), -[1] = LAYOUT( /* Layer 1 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [1] = LAYOUT( /* Layer 1 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), -[2] = LAYOUT( /* Layer 2 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [2] = LAYOUT( /* Layer 2 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), -[3] = LAYOUT( /* Layer 3 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [3] = LAYOUT( /* Layer 3 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) }; diff --git a/keyboards/sirius/uni660/rev1/matrix.c b/keyboards/sirius/uni660/rev1/matrix.c new file mode 100644 index 0000000000..3e231b33bc --- /dev/null +++ b/keyboards/sirius/uni660/rev1/matrix.c @@ -0,0 +1,160 @@ +/* +Copyright 2012 Jun Wako +Copyright 2014 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 . +*/ +#include +#include +#if defined(__AVR__) +#include +#endif +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "timer.h" +#include "debounce.h" + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#elif (MATRIX_COLS <= 16) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop16(matrix[i]) +# define ROW_SHIFTER ((uint16_t)1) +#elif (MATRIX_COLS <= 32) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop32(matrix[i]) +# define ROW_SHIFTER ((uint32_t)1) +#endif + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; + + +__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) { + debounce_init(MATRIX_ROWS); + matrix_init_quantum(); +} + +uint8_t matrix_scan(void) +{ + bool matrix_has_changed = false; + + SERIAL_UART_INIT(); + + uint32_t timeout = 0; + + //the s character requests the RF slave to send the matrix + SERIAL_UART_DATA = 's'; + + //trust the external keystates entirely, erase the last data + uint8_t uart_data[17] = {0}; + + //there are 16 bytes corresponding to 16 columns, and an end byte + for (uint8_t i = 0; i < 17; i++) { + //wait for the serial data, timeout if it's been too long + //this only happened in testing with a loose wire, but does no + //harm to leave it in here + while(!SERIAL_UART_RXD_PRESENT){ + timeout++; + if (timeout > 10000){ + break; + } + } + uart_data[i] = SERIAL_UART_DATA; + } + + //check for the end packet, the key state bytes use the LSBs, so 0xE0 + //will only show up here if the correct bytes were recieved + if (uart_data[10] == 0xE0) + { + //shifting and transferring the keystates to the QMK matrix variable + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = (uint16_t) uart_data[i*2] | (uint16_t) uart_data[i*2+1] << 8; + } + } + + debounce(matrix, matrix, MATRIX_ROWS, matrix_has_changed); + + matrix_scan_quantum(); + + return matrix_has_changed; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<. #include "config_common.h" /* USB Device descriptor parameter */ - -#define VENDOR_ID 0x5352 // "SR" -#define PRODUCT_ID 0x0202 // Second Product Second Version -#define DEVICE_VER 0x2004 // 2020.12 -#define MANUFACTURER SiRius -#define PRODUCT SiRius Uni660 V2 -#define DESCRIPTION SiRius Uni660 V2 +#define VENDOR_ID 0x5352 // "SR" +#define PRODUCT_ID 0x0202 // Second Product Second Version +#define DEVICE_VER 0x2004 // 2020.12 +#define MANUFACTURER SiRius +#define PRODUCT Uni660 V2 /* key matrix size */ #define MATRIX_ROWS 5 #define MATRIX_COLS 16 -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -//#define BACKLIGHT_LEVELS 3 - #define ONESHOT_TIMEOUT 500 +/* 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 + /* * Feature disable options * These options are also useful to firmware size reduction. @@ -55,8 +52,10 @@ along with this program. If not, see . //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION //UART settings for communication with the RF microcontroller #define SERIAL_UART_BAUD 1000000 @@ -65,14 +64,14 @@ along with this program. If not, see . #define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) #define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) #define SERIAL_UART_INIT() do { \ - /* baud rate */ \ - UBRR1L = SERIAL_UART_UBRR; \ - /* baud rate */ \ - UBRR1H = SERIAL_UART_UBRR >> 8; \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ - } while(0) + /* baud rate */ \ + UBRR1L = SERIAL_UART_UBRR; \ + /* baud rate */ \ + UBRR1H = SERIAL_UART_UBRR >> 8; \ + /* enable TX and RX */ \ + UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ + /* 8-bit data */ \ + UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ +} while (0) #define DYNAMIC_KEYMAP_LAYER_COUNT 4 diff --git a/keyboards/sirius/uni660/rev2/ansi/keymaps/default/keymap.c b/keyboards/sirius/uni660/rev2/ansi/keymaps/default/keymap.c index ff45e7f2b7..6a07da496e 100644 --- a/keyboards/sirius/uni660/rev2/ansi/keymaps/default/keymap.c +++ b/keyboards/sirius/uni660/rev2/ansi/keymaps/default/keymap.c @@ -1,11 +1,11 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = LAYOUT_ansi( /* Base */ -KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, -KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, -KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, -KC_F3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, -KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT -), + [0] = LAYOUT_ansi( /* Base */ + KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, + KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, + KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_F3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ) }; diff --git a/keyboards/sirius/uni660/rev2/ansi/keymaps/via/keymap.c b/keyboards/sirius/uni660/rev2/ansi/keymaps/via/keymap.c index 26ec43d478..66421f2857 100644 --- a/keyboards/sirius/uni660/rev2/ansi/keymaps/via/keymap.c +++ b/keyboards/sirius/uni660/rev2/ansi/keymaps/via/keymap.c @@ -1,35 +1,35 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = LAYOUT_ansi( /* Base */ -KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, -KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, -KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, -KC_F3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, -KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT -), + [0] = LAYOUT_ansi( /* Base */ + KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, + KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, + KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_F3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), -[1] = LAYOUT_ansi( /* Layer 1 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [1] = LAYOUT_ansi( /* Layer 1 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), -[2] = LAYOUT_ansi( /* Layer 2 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [2] = LAYOUT_ansi( /* Layer 2 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), -[3] = LAYOUT_ansi( /* Layer 3 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [3] = LAYOUT_ansi( /* Layer 3 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) }; diff --git a/keyboards/sirius/uni660/rev2/ansi/readme.md b/keyboards/sirius/uni660/rev2/ansi/readme.md new file mode 100644 index 0000000000..76bb943910 --- /dev/null +++ b/keyboards/sirius/uni660/rev2/ansi/readme.md @@ -0,0 +1,15 @@ +# Uni660 Rev2 ANSI + +The Uni660 is an ergonomic wireless keyboard designed by Sirius. + +Join the KeyCommerce [Discord](https://discord.gg/GJ8bdM) + +Make example: + +``` +make sirius/uni660/rev2/ansi:default +``` + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +To get the U2U into DFU flashing mode, insert the U2U into the computer and connect the ![RST pins](https://i.imgur.com/IlKKXWB.png) diff --git a/keyboards/sirius/uni660/rev2/iso/.noci b/keyboards/sirius/uni660/rev2/iso/.noci new file mode 100644 index 0000000000..e69de29bb2 diff --git a/keyboards/sirius/uni660/rev2/iso/config.h b/keyboards/sirius/uni660/rev2/iso/config.h index e31f8fb8eb..0cbbe0c5ba 100644 --- a/keyboards/sirius/uni660/rev2/iso/config.h +++ b/keyboards/sirius/uni660/rev2/iso/config.h @@ -20,26 +20,23 @@ along with this program. If not, see . #include "config_common.h" /* USB Device descriptor parameter */ - -#define VENDOR_ID 0x5352 // "SR" -#define PRODUCT_ID 0x0203 // Second Product Third Version -#define DEVICE_VER 0x2004 // 2020.12 -#define MANUFACTURER SiRius -#define PRODUCT SiRius Uni660 V2 -#define DESCRIPTION SiRius Uni660 V2 +#define VENDOR_ID 0x5352 // "SR" +#define PRODUCT_ID 0x0203 // Second Product Third Version +#define DEVICE_VER 0x2004 // 2020.12 +#define MANUFACTURER SiRius +#define PRODUCT Uni660 V2 /* key matrix size */ #define MATRIX_ROWS 5 #define MATRIX_COLS 16 -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -//#define BACKLIGHT_LEVELS 3 - #define ONESHOT_TIMEOUT 500 +/* 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 + /* * Feature disable options * These options are also useful to firmware size reduction. @@ -55,8 +52,10 @@ along with this program. If not, see . //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION //UART settings for communication with the RF microcontroller #define SERIAL_UART_BAUD 1000000 @@ -65,14 +64,14 @@ along with this program. If not, see . #define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) #define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) #define SERIAL_UART_INIT() do { \ - /* baud rate */ \ - UBRR1L = SERIAL_UART_UBRR; \ - /* baud rate */ \ - UBRR1H = SERIAL_UART_UBRR >> 8; \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ - } while(0) + /* baud rate */ \ + UBRR1L = SERIAL_UART_UBRR; \ + /* baud rate */ \ + UBRR1H = SERIAL_UART_UBRR >> 8; \ + /* enable TX and RX */ \ + UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ + /* 8-bit data */ \ + UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ +} while (0) #define DYNAMIC_KEYMAP_LAYER_COUNT 4 diff --git a/keyboards/sirius/uni660/rev2/iso/iso.h b/keyboards/sirius/uni660/rev2/iso/iso.h index b38bdfc932..df5516e782 100644 --- a/keyboards/sirius/uni660/rev2/iso/iso.h +++ b/keyboards/sirius/uni660/rev2/iso/iso.h @@ -1,6 +1,6 @@ #pragma once -#include "uni660.h" +#include "rev2.h" #include "quantum.h" @@ -8,17 +8,18 @@ // The first section contains all of the arguments // The second converts the arguments into a two-dimensional array +#define XXX KC_NO + #define LAYOUT_iso( \ - k00, k01, k02, k03, k04, k05, k06, k46, k08, k09, k0a, k0b, k0c, k0d, k0e, k0f, k3f,\ - k10, k11, k12, k13, k14, k15, k16, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f, k2f,\ - k20, k21, k22, k23, k24, k25, k26, k28, k29, k2a, k2b, k2c, k2d, k2e,\ - k30, k31, k37, k32, k33, k34, k35, k36, k38, k39, k3a, k3b, k3c, k3d, k3e, \ - k40, k41, k42, k43, k44, k45, k48, k49, k4a, k4c, k4d, k4e, k4f \ -) \ - { \ - { k00, k01, k02, k03, k04, k05, k06, KC_NO, k08, k09, k0a, k0b, k0c, k0d, k0e, k0f }, \ - { k10, k11, k12, k13, k14, k15, k16, KC_NO, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f }, \ - { k20, k21, k22, k23, k24, k25, k26, KC_NO, k28, k29, k2a, k2b, k2c, k2d, k2e, k2f }, \ - { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, k3f }, \ - { k40, k41, k42, k43, k44, k45, k46, KC_NO, k48, k49, k4a, KC_NO, k4c, k4d, k4e, k4f } \ - } + k00, k01, k02, k03, k04, k05, k06, k46, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F, k3F,\ + k10, k11, k12, k13, k14, k15, k16, k18, k19, k1A, k1B, k1C, k1D, k1E, k1F, k2F,\ + k20, k21, k22, k23, k24, k25, k26, k28, k29, k2A, k2B, k2C, k2D, k2E, \ + k30, k31, k37, k32, k33, k34, k35, k36, k38, k39, k3A, k3B, k3C, k3D, k3E, \ + k40, k41, k42, k43, k44, k45, k48, k49, k4A, k4C, k4D, k4E, k4F \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, XXX, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F }, \ + { k10, k11, k12, k13, k14, k15, k16, XXX, k18, k19, k1A, k1B, k1C, k1D, k1E, k1F }, \ + { k20, k21, k22, k23, k24, k25, k26, XXX, k28, k29, k2A, k2B, k2C, k2D, k2E, k2F }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, k3F }, \ + { k40, k41, k42, k43, k44, k45, k46, XXX, k48, k49, k4A, XXX, k4C, k4D, k4E, k4F } \ +} diff --git a/keyboards/sirius/uni660/rev2/iso/keymaps/default/keymap.c b/keyboards/sirius/uni660/rev2/iso/keymaps/default/keymap.c index de8630eaa6..25e4714161 100644 --- a/keyboards/sirius/uni660/rev2/iso/keymaps/default/keymap.c +++ b/keyboards/sirius/uni660/rev2/iso/keymaps/default/keymap.c @@ -1,11 +1,11 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = LAYOUT_iso( /* Base */ -KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, -KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, -KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, -KC_F3, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, -KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT -), + [0] = LAYOUT_iso( /* Base */ + KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, + KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, + KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_F3, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ) }; diff --git a/keyboards/sirius/uni660/rev2/iso/keymaps/via/keymap.c b/keyboards/sirius/uni660/rev2/iso/keymaps/via/keymap.c index ac1d7c6d59..3965435448 100644 --- a/keyboards/sirius/uni660/rev2/iso/keymaps/via/keymap.c +++ b/keyboards/sirius/uni660/rev2/iso/keymaps/via/keymap.c @@ -1,35 +1,35 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = LAYOUT_iso( /* Base */ -KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, -KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, -KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, -KC_F3, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, -KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT -), + [0] = LAYOUT_iso( /* Base */ + KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, + KC_F1, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, + KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_F3, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_F4, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_DEL, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), -[1] = LAYOUT_iso( /* Layer 1 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [1] = LAYOUT_iso( /* Layer 1 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), -[2] = LAYOUT_iso( /* Layer 2 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [2] = LAYOUT_iso( /* Layer 2 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), -[3] = LAYOUT_iso( /* Layer 3 */ -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), + [3] = LAYOUT_iso( /* Layer 3 */ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) }; diff --git a/keyboards/sirius/uni660/rev2/iso/readme.md b/keyboards/sirius/uni660/rev2/iso/readme.md new file mode 100644 index 0000000000..ea80141e9c --- /dev/null +++ b/keyboards/sirius/uni660/rev2/iso/readme.md @@ -0,0 +1,15 @@ +# Uni660 Rev2 ISO + +The Uni660 is an ergonomic wireless keyboard designed by Sirius. + +Join the KeyCommerce [Discord](https://discord.gg/GJ8bdM) + +Make example: + +``` +make sirius/uni660/rev2/iso:default +``` + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +To get the U2U into DFU flashing mode, insert the U2U into the computer and connect the ![RST pins](https://i.imgur.com/IlKKXWB.png) diff --git a/keyboards/sirius/uni660/rev2/matrix.c b/keyboards/sirius/uni660/rev2/matrix.c new file mode 100644 index 0000000000..3e231b33bc --- /dev/null +++ b/keyboards/sirius/uni660/rev2/matrix.c @@ -0,0 +1,160 @@ +/* +Copyright 2012 Jun Wako +Copyright 2014 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 . +*/ +#include +#include +#if defined(__AVR__) +#include +#endif +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "timer.h" +#include "debounce.h" + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#elif (MATRIX_COLS <= 16) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop16(matrix[i]) +# define ROW_SHIFTER ((uint16_t)1) +#elif (MATRIX_COLS <= 32) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop32(matrix[i]) +# define ROW_SHIFTER ((uint32_t)1) +#endif + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; + + +__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) { + debounce_init(MATRIX_ROWS); + matrix_init_quantum(); +} + +uint8_t matrix_scan(void) +{ + bool matrix_has_changed = false; + + SERIAL_UART_INIT(); + + uint32_t timeout = 0; + + //the s character requests the RF slave to send the matrix + SERIAL_UART_DATA = 's'; + + //trust the external keystates entirely, erase the last data + uint8_t uart_data[17] = {0}; + + //there are 16 bytes corresponding to 16 columns, and an end byte + for (uint8_t i = 0; i < 17; i++) { + //wait for the serial data, timeout if it's been too long + //this only happened in testing with a loose wire, but does no + //harm to leave it in here + while(!SERIAL_UART_RXD_PRESENT){ + timeout++; + if (timeout > 10000){ + break; + } + } + uart_data[i] = SERIAL_UART_DATA; + } + + //check for the end packet, the key state bytes use the LSBs, so 0xE0 + //will only show up here if the correct bytes were recieved + if (uart_data[10] == 0xE0) + { + //shifting and transferring the keystates to the QMK matrix variable + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = (uint16_t) uart_data[i*2] | (uint16_t) uart_data[i*2+1] << 8; + } + } + + debounce(matrix, matrix, MATRIX_ROWS, matrix_has_changed); + + matrix_scan_quantum(); + + return matrix_has_changed; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<