diff options
Diffstat (limited to 'keyboards/doio')
34 files changed, 1010 insertions, 218 deletions
diff --git a/keyboards/doio/kb16/kb16.c b/keyboards/doio/kb16/kb16.c index 037f561e97..991848c6d3 100644 --- a/keyboards/doio/kb16/kb16.c +++ b/keyboards/doio/kb16/kb16.c @@ -18,26 +18,7 @@ #include "kb16.h" // OLED animation -#include "lib/logo.h" - -#ifdef RGB_MATRIX_ENABLE -led_config_t g_led_config = { { - { 0, 1, 2, 3, NO_LED, NO_LED, NO_LED }, - { 4, 5, 6, 7, NO_LED, NO_LED, NO_LED }, - { 8, 9, 10, 11, NO_LED, NO_LED, NO_LED }, - { 12, 13, 14, 15, NO_LED, NO_LED, NO_LED } -}, { - {0 , 0}, {75 , 0}, {149, 0}, {224, 0}, - {0 , 21}, {75 , 21}, {149, 21}, {224, 21}, - {0 , 43}, {75 , 43}, {149, 43}, {224, 43}, - {0 , 64}, {75 , 64}, {149, 64}, {224, 64}, -}, { - 1, 1, 1, 1, - 1, 4, 4, 1, - 1, 4, 4, 1, - 1, 1, 1, 1, -} }; -#endif +#include "./lib/logo.h" #ifdef OLED_ENABLE uint16_t startup_timer; diff --git a/keyboards/doio/kb16/kb16.h b/keyboards/doio/kb16/kb16.h index c4dc7cfed1..4d3a1e3a03 100644 --- a/keyboards/doio/kb16/kb16.h +++ b/keyboards/doio/kb16/kb16.h @@ -19,29 +19,8 @@ #include "quantum.h" -#define XXX KC_NO - -/* 06 ◯ 05 16 ◯ 15 - * ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ - * │00 │01 │02 │03 │ │04 │ │14 │ - * ├───┼───┼───┼───┤ └───┘ └───┘ - * │10 │11 │12 │13 │ - * ├───┼───┼───┼───┤ 26 ◯ 25 - * │20 │21 │22 │23 │ ┌───┐ - * ├───┼───┼───┼───┤ │24 │ - * │30 │31 │32 │33 │ └───┘ - * └───┴───┴───┴───┘ - */ - -#define LAYOUT( \ - K00, K01, K02, K03, K06, K04, K05, \ - K10, K11, K12, K13, K16, K14, K15, \ - K20, K21, K22, K23, K26, K24, K25, \ - K30, K31, K32, K33 \ -) { \ - { K00, K01, K02, K03, K04, K05, K06 }, \ - { K10, K11, K12, K13, K14, K15, K16 }, \ - { K20, K21, K22, K23, K24, K25, K26 }, \ - { K30, K31, K32, K33, XXX, XXX, XXX } \ -} - +#if defined(KEYBOARD_doio_kb16_rev1) + #include "rev1.h" +#elif defined(KEYBOARD_doio_kb16_rev2) + #include "rev2.h" +#endif
\ No newline at end of file diff --git a/keyboards/doio/kb16/keymaps/bongocat/rules.mk b/keyboards/doio/kb16/keymaps/bongocat/rules.mk deleted file mode 100644 index 087a45a944..0000000000 --- a/keyboards/doio/kb16/keymaps/bongocat/rules.mk +++ /dev/null @@ -1,9 +0,0 @@ -SRC += oled/bongocat.c - -VIA_ENABLE = yes - -# Additional thing to reduce compiled size -GRAVE_ESC_ENABLE = no - -# OLED enabled -WPM_ENABLE = yes diff --git a/keyboards/doio/kb16/keymaps/via/rules.mk b/keyboards/doio/kb16/keymaps/via/rules.mk deleted file mode 100644 index 1e5b99807c..0000000000 --- a/keyboards/doio/kb16/keymaps/via/rules.mk +++ /dev/null @@ -1 +0,0 @@ -VIA_ENABLE = yes diff --git a/keyboards/doio/kb16/keymaps/bongocat/oled/bongocat.c b/keyboards/doio/kb16/lib/bongocat/bongocat.c index 12ca8694c1..12ca8694c1 100644 --- a/keyboards/doio/kb16/keymaps/bongocat/oled/bongocat.c +++ b/keyboards/doio/kb16/lib/bongocat/bongocat.c diff --git a/keyboards/doio/kb16/keymaps/bongocat/oled/bongocat.h b/keyboards/doio/kb16/lib/bongocat/bongocat.h index 65ceabc682..65ceabc682 100644 --- a/keyboards/doio/kb16/keymaps/bongocat/oled/bongocat.h +++ b/keyboards/doio/kb16/lib/bongocat/bongocat.h diff --git a/keyboards/doio/kb16/readme.md b/keyboards/doio/kb16/readme.md index 8667da41d5..dd3007ff4f 100644 --- a/keyboards/doio/kb16/readme.md +++ b/keyboards/doio/kb16/readme.md @@ -1,26 +1,13 @@ # KB16-01 -![KB16-01](https://i.imgur.com/lpq47ELh.png) +#### This keyboard have 2 revision, so before you need to write your own firmware code. Please read it carefully, or you could accident bricked your keeb after that. -A macropad that have 16-key keyboard made by DOIO, which controlled by an Atmega32u4 chipset. The keyboard features per-key RGB, 3 encoder and an OLED screen for displaying useful information. +- **Revision 1**: Using ATMEGA32U4. -* Keyboard Maintainer: [HorrorTroll](https://github.com/HorrorTroll) -* Hardware Supported: Atmega32u4 +When you try to go bootloader mode, QMK Toolbox will showing this message `Atmel DFU device connected (libusb0): Atmel Corp. ATmega32U4 (03EB:2FF4:0000)`. So please compile Revision 1 and flash after that. -Make example for this keyboard (after setting up your build environment): +Oh, and one more thing. As for the Bongo Cat on OLED screen, due to small flash size that ATMEGA32U4 support. It need to be disable Mouse key support. - make doio/kb16/rev1:default +- **Revision 2**: Using APM32F103CBT6 (clone STM32F103CBT6). -Flashing example for this keyboard: - - make doio/kb16/rev1:default:flash - -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). - -## Bootloader - -Enter the bootloader in 3 ways: - -* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (1! key) and plug in the keyboard -* **Physical reset button**: Short press the button under Spacebar keycap to enter the Bootloader and flash the firmware -* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available +When you try to go bootloader mode, QMK Toolbox will showing this message `STM32Duino device connected: LeafLabs Maple 003 (1EAF:0003:0201)`. So please compile Revision 2 and flash after that. diff --git a/keyboards/doio/kb16/config.h b/keyboards/doio/kb16/rev1/config.h index 1c37ece514..1714c41b01 100644 --- a/keyboards/doio/kb16/config.h +++ b/keyboards/doio/kb16/rev1/config.h @@ -21,11 +21,11 @@ /* key matrix size */ #define MATRIX_ROWS 4 -#define MATRIX_COLS 7 +#define MATRIX_COLS 5 /* key matrix pins */ #define MATRIX_ROW_PINS { D5, D4, D3, D2 } -#define MATRIX_COL_PINS { F5, F4, F1, F0, B7, B4, B5 } +#define MATRIX_COL_PINS { F5, F4, F1, F0, B7 } #define BOOTMAGIC_LITE_ROW 0 #define BOOTMAGIC_LITE_COLUMN 0 @@ -40,7 +40,7 @@ #define FORCE_NKRO /* Use the custom font */ -#define OLED_FONT_H "lib/glcdfont.c" +#define OLED_FONT_H "./lib/glcdfont.c" /* Encoder pins */ #define ENCODERS_PAD_A { F7, C7, D7 } diff --git a/keyboards/doio/kb16/info.json b/keyboards/doio/kb16/rev1/info.json index 7cd02bce7b..9bb19482e3 100644 --- a/keyboards/doio/kb16/info.json +++ b/keyboards/doio/kb16/rev1/info.json @@ -16,27 +16,21 @@ {"label":"3#", "x":2, "y":0}, {"label":"4$", "x":3, "y":0}, - {"label":"Encoder 1 CCW", "x":4.25, "y":0, "w":0.5}, {"label":"Encoder 1", "x":4.75, "y":0}, - {"label":"Encoder 1 CW", "x":5.75, "y":0, "w":0.5}, {"label":"5%", "x":0, "y":1}, {"label":"6^", "x":1, "y":1}, {"label":"7&", "x":2, "y":1}, {"label":"8*", "x":3, "y":1}, - {"label":"Encoder 2 CCW", "x":6.25, "y":0, "w":0.5}, - {"label":"Encoder 2", "x":6.75, "y":0}, - {"label":"Encoder 2 CW", "x":7.75, "y":0, "w":0.5}, + {"label":"Encoder 2", "x":6, "y":0}, {"label":"9(", "x":0, "y":2}, {"label":"0)", "x":1, "y":2}, {"label":"\u2191", "x":2, "y":2}, {"label":"Enter", "x":3, "y":2}, - {"label":"Encoder 3 CCW", "x":5.25, "y":2.5, "w":0.5}, - {"label":"Encoder 3", "x":5.75, "y":2.5}, - {"label":"Encoder 3 CW", "x":6.75, "y":2.5, "w":0.5}, + {"label":"Encoder 3", "x":5.375, "y":2.5}, {"label":"Fn", "x":0, "y":3}, {"label":"\u2190", "x":1, "y":3}, diff --git a/keyboards/doio/kb16/keymaps/bongocat/config.h b/keyboards/doio/kb16/rev1/keymaps/bongocat/config.h index bb22eebb1b..bb22eebb1b 100644 --- a/keyboards/doio/kb16/keymaps/bongocat/config.h +++ b/keyboards/doio/kb16/rev1/keymaps/bongocat/config.h diff --git a/keyboards/doio/kb16/keymaps/bongocat/keymap.c b/keyboards/doio/kb16/rev1/keymaps/bongocat/keymap.c index b60688a385..bda4731a99 100644 --- a/keyboards/doio/kb16/keymaps/bongocat/keymap.c +++ b/keyboards/doio/kb16/rev1/keymaps/bongocat/keymap.c @@ -17,7 +17,7 @@ #include QMK_KEYBOARD_H // OLED animation -#include "oled/bongocat.h" +#include "./lib/bongocat/bongocat.h" // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. @@ -55,11 +55,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_BASE] = LAYOUT( - KC_1, KC_2, KC_3, KC_4, KC_MPRV, KC_MPLY, KC_MNXT, - KC_5, KC_6, KC_7, KC_8, KC_PGDN, TO(_FN), KC_PGUP, - KC_9, KC_0, KC_UP, KC_ENT, KC_VOLD, KC_MUTE, KC_VOLU, + KC_1, KC_2, KC_3, KC_4, KC_MPLY, + KC_5, KC_6, KC_7, KC_8, TO(_FN), + KC_9, KC_0, KC_UP, KC_ENT, KC_MUTE, MO(_FN2), KC_LEFT, KC_DOWN, KC_RIGHT ), @@ -74,11 +74,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, TO(_FN1), _______, - _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN1), + _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -93,11 +93,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN1] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, TO(_FN2), _______, - _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN2), + _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -112,11 +112,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │Vai│Hud│Vad│ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN2] = LAYOUT( - RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, _______, _______, - RGB_SAI, RGB_SAD, _______, _______, _______, TO(_BASE), _______, - RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, _______, _______, + RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, + RGB_SAI, RGB_SAD, _______, _______, TO(_BASE), + RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, _______, RGB_VAI, RGB_HUD, RGB_VAD ), }; @@ -138,43 +138,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { } #endif -#ifdef ENCODER_ENABLE - -#define ENCODERS 3 -static uint8_t encoder_state[ENCODERS] = {0}; -static keypos_t encoder_cw[ENCODERS] = {{ 5, 0 }, { 5, 1 }, { 5, 2 }}; -static keypos_t encoder_ccw[ENCODERS] = {{ 6, 0 }, { 6, 1 }, { 6, 2 }}; - -void encoder_action_unregister(void) { - for (int index = 0; index < ENCODERS; ++index) { - if (encoder_state[index]) { - keyevent_t encoder_event = (keyevent_t) { - .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], - .pressed = false, - .time = (timer_read() | 1) - }; - encoder_state[index] = 0; - action_exec(encoder_event); - } - } -} - -void encoder_action_register(uint8_t index, bool clockwise) { - keyevent_t encoder_event = (keyevent_t) { - .key = clockwise ? encoder_cw[index] : encoder_ccw[index], - .pressed = true, - .time = (timer_read() | 1) - }; - encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); - action_exec(encoder_event); -} - -void matrix_scan_user(void) { - encoder_action_unregister(); -} - -bool encoder_update_user(uint8_t index, bool clockwise) { - encoder_action_register(index, clockwise); - return false; -} +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_FN] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, +}; #endif diff --git a/keyboards/doio/kb16/rev1/keymaps/bongocat/rules.mk b/keyboards/doio/kb16/rev1/keymaps/bongocat/rules.mk new file mode 100644 index 0000000000..78d071eab3 --- /dev/null +++ b/keyboards/doio/kb16/rev1/keymaps/bongocat/rules.mk @@ -0,0 +1,17 @@ +SRC += ./lib/bongocat/bongocat.c + +# Build Options +# change yes to no to disable +# +MOUSEKEY_ENABLE = no # Mouse keys + +VIA_ENABLE = yes + +# Additional thing to reduce compiled size +GRAVE_ESC_ENABLE = no + +# OLED enabled +WPM_ENABLE = yes + +# Encoder enabled +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/doio/kb16/rev1/keymaps/default/keymap.c b/keyboards/doio/kb16/rev1/keymaps/default/keymap.c new file mode 100644 index 0000000000..6ab8294efe --- /dev/null +++ b/keyboards/doio/kb16/rev1/keymaps/default/keymap.c @@ -0,0 +1,140 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 + +// OLED animation +#include "./lib/layer_status/layer_status.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE, + _FN, + _FN1, + _FN2 +}; + +// enum layer_keycodes { }; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ 1 │ 2 │ 3 │ 4 │ │Ply│ │TO1│ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ 5 │ 6 │ 7 │ 8 │ + ├───┼───┼───┼───┤ + │ 9 │ 0 │ ↑ │Ent│ ┌───┐ + ├───┼───┼───┼───┤ │Mut│ + │Fn2│ ← │ ↓ │ → │ └───┘ + └───┴───┴───┴───┘ + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ ! │ @ │ # │ $ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ % │ ^ │ & │ * │ + ├───┼───┼───┼───┤ + │ ( │ ) │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_BASE] = LAYOUT( + KC_1, KC_2, KC_3, KC_4, KC_MPLY, + KC_5, KC_6, KC_7, KC_8, TO(_FN), + KC_9, KC_0, KC_UP, KC_ENT, KC_MUTE, + MO(_FN2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ │ │ │ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ │ │ │ │ + ├───┼───┼───┼───┤ + │ │ │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN] = LAYOUT( + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN1), + _______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ │ │ │ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ │ │ │ │ + ├───┼───┼───┼───┤ + │ │ │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN1] = LAYOUT( + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN2), + _______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │Spi│Spd│ │ │ │ │ │TO0│ + ├───┼───┼───┼───┤ └───┘ └───┘ + │Sai│Sad│ │ │ + ├───┼───┼───┼───┤ + │Tog│Mod│Hui│ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │Vai│Hud│Vad│ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN2] = LAYOUT( + RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, + RGB_SAI, RGB_SAD, _______, _______, TO(_BASE), + RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, + _______, RGB_VAI, RGB_HUD, RGB_VAD + ), +}; + +#ifdef OLED_ENABLE + bool oled_task_user(void) { + render_layer_status(); + + return true; + } +#endif + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_FN] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, +}; +#endif diff --git a/keyboards/doio/kb16/keymaps/default/rules.mk b/keyboards/doio/kb16/rev1/keymaps/default/rules.mk index 00003ba11b..00003ba11b 100644 --- a/keyboards/doio/kb16/keymaps/default/rules.mk +++ b/keyboards/doio/kb16/rev1/keymaps/default/rules.mk diff --git a/keyboards/doio/kb16/keymaps/default/keymap.c b/keyboards/doio/kb16/rev1/keymaps/via/keymap.c index df72bbe15a..61c582fa1c 100644 --- a/keyboards/doio/kb16/keymaps/default/keymap.c +++ b/keyboards/doio/kb16/rev1/keymaps/via/keymap.c @@ -56,11 +56,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_BASE] = LAYOUT( - KC_1, KC_2, KC_3, KC_4, _______, KC_MPLY, _______, - KC_5, KC_6, KC_7, KC_8, _______, TO(_FN), _______, - KC_9, KC_0, KC_UP, KC_ENT, _______, KC_MUTE, _______, + KC_1, KC_2, KC_3, KC_4, KC_MPLY, + KC_5, KC_6, KC_7, KC_8, TO(_FN), + KC_9, KC_0, KC_UP, KC_ENT, KC_MUTE, MO(_FN2), KC_LEFT, KC_DOWN, KC_RIGHT ), @@ -75,11 +75,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, TO(_FN1), _______, - _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN1), + _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -94,11 +94,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN1] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, TO(_FN2), _______, - _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN2), + _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -113,11 +113,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │Vai│Hud│Vad│ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN2] = LAYOUT( - RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, _______, _______, - RGB_SAI, RGB_SAD, _______, _______, _______, TO(_BASE), _______, - RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, _______, _______, + RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, + RGB_SAI, RGB_SAD, _______, _______, TO(_BASE), + RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, _______, RGB_VAI, RGB_HUD, RGB_VAD ), }; @@ -133,8 +133,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #ifdef ENCODER_MAP_ENABLE const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { [_BASE] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, - [_FN] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, - [_FN1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, - [_FN2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, }; #endif diff --git a/keyboards/doio/kb16/rev1/keymaps/via/rules.mk b/keyboards/doio/kb16/rev1/keymaps/via/rules.mk new file mode 100644 index 0000000000..d76c12896f --- /dev/null +++ b/keyboards/doio/kb16/rev1/keymaps/via/rules.mk @@ -0,0 +1,4 @@ +VIA_ENABLE = yes + +# Encoder enabled +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/doio/kb16/rev1/readme.md b/keyboards/doio/kb16/rev1/readme.md new file mode 100644 index 0000000000..94573f3875 --- /dev/null +++ b/keyboards/doio/kb16/rev1/readme.md @@ -0,0 +1,30 @@ +# KB16-01 (Revision 1) + +![KB16-01](https://i.imgur.com/lpq47ELh.png) + +A macropad that have 16-key keyboard made by DOIO, which controlled by an Atmega32u4 chipset. The keyboard features per-key RGB, 3 encoder and an OLED screen for displaying useful information. + +* Keyboard Maintainer: [HorrorTroll](https://github.com/HorrorTroll) +* Hardware Supported: Atmega32u4 + +Make example for this keyboard (after setting up your build environment): + + `make doio/kb16/rev1:default` + or with the qmk cli: + `qmk compile -kb doio/kb16/rev1 -km default` + +Flashing example for this keyboard: + + `make doio/kb16/rev1:default:flash` + or with the qmk cli: + `qmk flash -kb doio/kb16/rev1 -km 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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (1! key) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/doio/kb16/rev1/rev1.c b/keyboards/doio/kb16/rev1/rev1.c new file mode 100644 index 0000000000..9c7fc823a6 --- /dev/null +++ b/keyboards/doio/kb16/rev1/rev1.c @@ -0,0 +1,37 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 "rev1.h" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + { 0, 1, 2, 3, NO_LED }, + { 4, 5, 6, 7, NO_LED }, + { 8, 9, 10, 11, NO_LED }, + { 12, 13, 14, 15, NO_LED } +}, { + {0 , 0}, {75 , 0}, {149, 0}, {224, 0}, + {0 , 21}, {75 , 21}, {149, 21}, {224, 21}, + {0 , 43}, {75 , 43}, {149, 43}, {224, 43}, + {0 , 64}, {75 , 64}, {149, 64}, {224, 64}, +}, { + 1, 1, 1, 1, + 1, 4, 4, 1, + 1, 4, 4, 1, + 1, 1, 1, 1, +} }; +#endif diff --git a/keyboards/doio/kb16/rev1/rev1.h b/keyboards/doio/kb16/rev1/rev1.h new file mode 100644 index 0000000000..f1e86fb674 --- /dev/null +++ b/keyboards/doio/kb16/rev1/rev1.h @@ -0,0 +1,46 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 "quantum.h" + +#define XXX KC_NO + +/* ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + * │00 │01 │02 │03 │ │04 │ │14 │ + * ├───┼───┼───┼───┤ └───┘ └───┘ + * │10 │11 │12 │13 │ + * ├───┼───┼───┼───┤ + * │20 │21 │22 │23 │ ┌───┐ + * ├───┼───┼───┼───┤ │24 │ + * │30 │31 │32 │33 │ └───┘ + * └───┴───┴───┴───┘ + */ + +#define LAYOUT( \ + K00, K01, K02, K03, K04, \ + K10, K11, K12, K13, K14, \ + K20, K21, K22, K23, K24, \ + K30, K31, K32, K33 \ +) { \ + { K00, K01, K02, K03, K04 }, \ + { K10, K11, K12, K13, K14 }, \ + { K20, K21, K22, K23, K24 }, \ + { K30, K31, K32, K33, XXX } \ +} + diff --git a/keyboards/doio/kb16/rules.mk b/keyboards/doio/kb16/rev1/rules.mk index b2982c9743..07ca8da9ea 100644 --- a/keyboards/doio/kb16/rules.mk +++ b/keyboards/doio/kb16/rev1/rules.mk @@ -1,5 +1,5 @@ -SRC += lib/layer_status/layer_status.c -SRC += lib/logo.c +SRC += ./lib/layer_status/layer_status.c +SRC += ./lib/logo.c # MCU name MCU = atmega32u4 diff --git a/keyboards/doio/kb16/rev2/config.h b/keyboards/doio/kb16/rev2/config.h new file mode 100644 index 0000000000..d5152f3ec7 --- /dev/null +++ b/keyboards/doio/kb16/rev2/config.h @@ -0,0 +1,95 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include "config_common.h" + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 5 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B3, B4, B9, B8 } +#define MATRIX_COL_PINS { B14, B13, B12, B0, A7 } + +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Forcing to use NKRO instead 6KRO */ +#define FORCE_NKRO + +#ifdef OLED_ENABLE + /* Mapping I2C2 for OLED */ + #define I2C1_SCL_PIN B10 + #define I2C1_SDA_PIN B11 + #define I2C_DRIVER I2CD2 + + /* Use the custom font */ + #define OLED_FONT_H "./lib/glcdfont.c" +#endif + +/* Encoder pins */ +#define ENCODERS_PAD_A { B5, A1, A3 } +#define ENCODERS_PAD_B { B6, A2, A4 } + +#ifdef RGB_MATRIX_ENABLE + /* RGB Matrix config */ + #define RGB_DI_PIN A10 + #define DRIVER_LED_TOTAL 16 + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 + #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS + #define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_UP_DOWN + #define RGB_MATRIX_KEYPRESSES + + /* RGB Matrix effect */ + #define ENABLE_RGB_MATRIX_ALPHAS_MODS + #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN + #define ENABLE_RGB_MATRIX_BREATHING + #define ENABLE_RGB_MATRIX_BAND_SAT + #define ENABLE_RGB_MATRIX_BAND_VAL + #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT + #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL + #define ENABLE_RGB_MATRIX_CYCLE_ALL + #define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN + #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN + #define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL + #define ENABLE_RGB_MATRIX_DUAL_BEACON + #define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS + #define ENABLE_RGB_MATRIX_RAINDROPS + #define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS + #define ENABLE_RGB_MATRIX_HUE_BREATHING + #define ENABLE_RGB_MATRIX_HUE_PENDULUM + #define ENABLE_RGB_MATRIX_HUE_WAVE + #define ENABLE_RGB_MATRIX_PIXEL_RAIN + #define ENABLE_RGB_MATRIX_PIXEL_FLOW + #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL + + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS + #define ENABLE_RGB_MATRIX_MULTISPLASH + #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +#endif diff --git a/keyboards/doio/kb16/rev2/halconf.h b/keyboards/doio/kb16/rev2/halconf.h new file mode 100644 index 0000000000..dc84fc6b26 --- /dev/null +++ b/keyboards/doio/kb16/rev2/halconf.h @@ -0,0 +1,27 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/doio/kb16/rev2/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next <halconf.h> diff --git a/keyboards/doio/kb16/rev2/info.json b/keyboards/doio/kb16/rev2/info.json new file mode 100644 index 0000000000..9bb19482e3 --- /dev/null +++ b/keyboards/doio/kb16/rev2/info.json @@ -0,0 +1,42 @@ +{ + "keyboard_name": "KB16-01", + "manufacturer": "DOIO", + "url": "", + "maintainer": "HorrorTroll", + "usb": { + "vid": "0xD010", + "pid": "0x1601", + "device_version": "0.0.1" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"1!", "x":0, "y":0}, + {"label":"2@", "x":1, "y":0}, + {"label":"3#", "x":2, "y":0}, + {"label":"4$", "x":3, "y":0}, + + {"label":"Encoder 1", "x":4.75, "y":0}, + + {"label":"5%", "x":0, "y":1}, + {"label":"6^", "x":1, "y":1}, + {"label":"7&", "x":2, "y":1}, + {"label":"8*", "x":3, "y":1}, + + {"label":"Encoder 2", "x":6, "y":0}, + + {"label":"9(", "x":0, "y":2}, + {"label":"0)", "x":1, "y":2}, + {"label":"\u2191", "x":2, "y":2}, + {"label":"Enter", "x":3, "y":2}, + + {"label":"Encoder 3", "x":5.375, "y":2.5}, + + {"label":"Fn", "x":0, "y":3}, + {"label":"\u2190", "x":1, "y":3}, + {"label":"\u2193", "x":2, "y":3}, + {"label":"\u2192", "x":3, "y":3} + ] + } + } +} diff --git a/keyboards/doio/kb16/rev2/keymaps/bongocat/keymap.c b/keyboards/doio/kb16/rev2/keymaps/bongocat/keymap.c new file mode 100644 index 0000000000..bda4731a99 --- /dev/null +++ b/keyboards/doio/kb16/rev2/keymaps/bongocat/keymap.c @@ -0,0 +1,148 @@ +/* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 + +// OLED animation +#include "./lib/bongocat/bongocat.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE, + _FN, + _FN1, + _FN2 +}; + +// enum layer_keycodes { }; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ 1 │ 2 │ 3 │ 4 │ │Ply│ │TO1│ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ 5 │ 6 │ 7 │ 8 │ + ├───┼───┼───┼───┤ + │ 9 │ 0 │ ↑ │Ent│ ┌───┐ + ├───┼───┼───┼───┤ │Mut│ + │Fn2│ ← │ ↓ │ → │ └───┘ + └───┴───┴───┴───┘ + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ ! │ @ │ # │ $ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ % │ ^ │ & │ * │ + ├───┼───┼───┼───┤ + │ ( │ ) │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_BASE] = LAYOUT( + KC_1, KC_2, KC_3, KC_4, KC_MPLY, + KC_5, KC_6, KC_7, KC_8, TO(_FN), + KC_9, KC_0, KC_UP, KC_ENT, KC_MUTE, + MO(_FN2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ │ │ │ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ │ │ │ │ + ├───┼───┼───┼───┤ + │ │ │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN] = LAYOUT( + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN1), + _______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ │ │ │ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ │ │ │ │ + ├───┼───┼───┼───┤ + │ │ │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN1] = LAYOUT( + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN2), + _______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │Spi│Spd│ │ │ │ │ │TO0│ + ├───┼───┼───┼───┤ └───┘ └───┘ + │Sai│Sad│ │ │ + ├───┼───┼───┼───┤ + │Tog│Mod│Hui│ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │Vai│Hud│Vad│ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN2] = LAYOUT( + RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, + RGB_SAI, RGB_SAD, _______, _______, TO(_BASE), + RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, + _______, RGB_VAI, RGB_HUD, RGB_VAD + ), +}; + +#ifdef OLED_ENABLE + bool oled_task_user(void) { + led_t led_usb_state = host_keyboard_led_state(); + + render_bongocat(); + oled_set_cursor(14, 0); // sets cursor to (column, row) using charactar spacing (4 rows on 128x32 screen, anything more will overflow back to the top) + oled_write_P(PSTR("WPM:"), false); + oled_write(get_u8_str(get_current_wpm(), '0'), false); // writes wpm on top right corner of string + oled_set_cursor(17, 2); + oled_write_P(led_usb_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false); + oled_set_cursor(17, 3); + oled_write_P(led_usb_state.scroll_lock ? PSTR("SCRL") : PSTR(" "), false); + + return true; + } +#endif + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_FN] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, +}; +#endif diff --git a/keyboards/doio/kb16/rev2/keymaps/bongocat/rules.mk b/keyboards/doio/kb16/rev2/keymaps/bongocat/rules.mk new file mode 100644 index 0000000000..822e06e179 --- /dev/null +++ b/keyboards/doio/kb16/rev2/keymaps/bongocat/rules.mk @@ -0,0 +1,9 @@ +SRC += ./lib/bongocat/bongocat.c + +VIA_ENABLE = yes + +# OLED enabled +WPM_ENABLE = yes + +# Encoder enabled +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/doio/kb16/rev2/keymaps/default/keymap.c b/keyboards/doio/kb16/rev2/keymaps/default/keymap.c new file mode 100644 index 0000000000..6ab8294efe --- /dev/null +++ b/keyboards/doio/kb16/rev2/keymaps/default/keymap.c @@ -0,0 +1,140 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 + +// OLED animation +#include "./lib/layer_status/layer_status.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE, + _FN, + _FN1, + _FN2 +}; + +// enum layer_keycodes { }; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ 1 │ 2 │ 3 │ 4 │ │Ply│ │TO1│ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ 5 │ 6 │ 7 │ 8 │ + ├───┼───┼───┼───┤ + │ 9 │ 0 │ ↑ │Ent│ ┌───┐ + ├───┼───┼───┼───┤ │Mut│ + │Fn2│ ← │ ↓ │ → │ └───┘ + └───┴───┴───┴───┘ + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ ! │ @ │ # │ $ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ % │ ^ │ & │ * │ + ├───┼───┼───┼───┤ + │ ( │ ) │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_BASE] = LAYOUT( + KC_1, KC_2, KC_3, KC_4, KC_MPLY, + KC_5, KC_6, KC_7, KC_8, TO(_FN), + KC_9, KC_0, KC_UP, KC_ENT, KC_MUTE, + MO(_FN2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ │ │ │ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ │ │ │ │ + ├───┼───┼───┼───┤ + │ │ │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN] = LAYOUT( + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN1), + _______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │ │ │ │ │ │ │ │ │ + ├───┼───┼───┼───┤ └───┘ └───┘ + │ │ │ │ │ + ├───┼───┼───┼───┤ + │ │ │ │ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │ │ │ │ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN1] = LAYOUT( + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN2), + _______, _______, _______, _______, _______, + _______, _______, _______, _______ + ), + +/* + ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + │Spi│Spd│ │ │ │ │ │TO0│ + ├───┼───┼───┼───┤ └───┘ └───┘ + │Sai│Sad│ │ │ + ├───┼───┼───┼───┤ + │Tog│Mod│Hui│ │ ┌───┐ + ├───┼───┼───┼───┤ │ │ + │ │Vai│Hud│Vad│ └───┘ + └───┴───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 */ + [_FN2] = LAYOUT( + RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, + RGB_SAI, RGB_SAD, _______, _______, TO(_BASE), + RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, + _______, RGB_VAI, RGB_HUD, RGB_VAD + ), +}; + +#ifdef OLED_ENABLE + bool oled_task_user(void) { + render_layer_status(); + + return true; + } +#endif + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_FN] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, +}; +#endif diff --git a/keyboards/doio/kb16/rev2/keymaps/default/rules.mk b/keyboards/doio/kb16/rev2/keymaps/default/rules.mk new file mode 100644 index 0000000000..00003ba11b --- /dev/null +++ b/keyboards/doio/kb16/rev2/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +# Encoder enabled +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/doio/kb16/keymaps/via/keymap.c b/keyboards/doio/kb16/rev2/keymaps/via/keymap.c index 4f01846eae..61c582fa1c 100644 --- a/keyboards/doio/kb16/keymaps/via/keymap.c +++ b/keyboards/doio/kb16/rev2/keymaps/via/keymap.c @@ -56,11 +56,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_BASE] = LAYOUT( - KC_1, KC_2, KC_3, KC_4, KC_MPRV, KC_MPLY, KC_MNXT, - KC_5, KC_6, KC_7, KC_8, KC_PGDN, TO(_FN), KC_PGUP, - KC_9, KC_0, KC_UP, KC_ENT, KC_VOLD, KC_MUTE, KC_VOLU, + KC_1, KC_2, KC_3, KC_4, KC_MPLY, + KC_5, KC_6, KC_7, KC_8, TO(_FN), + KC_9, KC_0, KC_UP, KC_ENT, KC_MUTE, MO(_FN2), KC_LEFT, KC_DOWN, KC_RIGHT ), @@ -75,11 +75,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, TO(_FN1), _______, - _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN1), + _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -94,11 +94,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │ │ │ │ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN1] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, TO(_FN2), _______, - _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, TO(_FN2), + _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -113,11 +113,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { │ │Vai│Hud│Vad│ └───┘ └───┴───┴───┴───┘ */ - /* Row: 0 1 2 3 4 5 6 */ + /* Row: 0 1 2 3 4 */ [_FN2] = LAYOUT( - RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, _______, _______, - RGB_SAI, RGB_SAD, _______, _______, _______, TO(_BASE), _______, - RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, _______, _______, + RGB_SPI, RGB_SPD, _______, QK_BOOT, _______, + RGB_SAI, RGB_SAD, _______, _______, TO(_BASE), + RGB_TOG, RGB_MOD, RGB_HUI, _______, _______, _______, RGB_VAI, RGB_HUD, RGB_VAD ), }; @@ -130,43 +130,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { } #endif -#ifdef ENCODER_ENABLE - -#define ENCODERS 3 -static uint8_t encoder_state[ENCODERS] = {0}; -static keypos_t encoder_cw[ENCODERS] = {{ 5, 0 }, { 5, 1 }, { 5, 2 }}; -static keypos_t encoder_ccw[ENCODERS] = {{ 6, 0 }, { 6, 1 }, { 6, 2 }}; - -void encoder_action_unregister(void) { - for (int index = 0; index < ENCODERS; ++index) { - if (encoder_state[index]) { - keyevent_t encoder_event = (keyevent_t) { - .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], - .pressed = false, - .time = (timer_read() | 1) - }; - encoder_state[index] = 0; - action_exec(encoder_event); - } - } -} - -void encoder_action_register(uint8_t index, bool clockwise) { - keyevent_t encoder_event = (keyevent_t) { - .key = clockwise ? encoder_cw[index] : encoder_ccw[index], - .pressed = true, - .time = (timer_read() | 1) - }; - encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); - action_exec(encoder_event); -} - -void matrix_scan_user(void) { - encoder_action_unregister(); -} - -bool encoder_update_user(uint8_t index, bool clockwise) { - encoder_action_register(index, clockwise); - return false; -} +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_FN] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, + [_FN2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, +}; #endif diff --git a/keyboards/doio/kb16/rev2/keymaps/via/rules.mk b/keyboards/doio/kb16/rev2/keymaps/via/rules.mk new file mode 100644 index 0000000000..d76c12896f --- /dev/null +++ b/keyboards/doio/kb16/rev2/keymaps/via/rules.mk @@ -0,0 +1,4 @@ +VIA_ENABLE = yes + +# Encoder enabled +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/doio/kb16/rev2/mcuconf.h b/keyboards/doio/kb16/rev2/mcuconf.h new file mode 100644 index 0000000000..a86ca86d0c --- /dev/null +++ b/keyboards/doio/kb16/rev2/mcuconf.h @@ -0,0 +1,28 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/doio/kb16/rev2/mcuconf.h -r platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h` + */ + +#pragma once + +#include_next <mcuconf.h> + +#undef STM32_I2C_USE_I2C2 +#define STM32_I2C_USE_I2C2 TRUE diff --git a/keyboards/doio/kb16/rev2/readme.md b/keyboards/doio/kb16/rev2/readme.md new file mode 100644 index 0000000000..4692268cc0 --- /dev/null +++ b/keyboards/doio/kb16/rev2/readme.md @@ -0,0 +1,30 @@ +# KB16-01 (Revision 2) + +![KB16-01](https://i.imgur.com/lpq47ELh.png) + +A macropad that have 16-key keyboard made by DOIO, which controlled by an APM32F103CBT6 chipset. The keyboard features per-key RGB, 3 encoder and an OLED screen for displaying useful information. + +* Keyboard Maintainer: [HorrorTroll](https://github.com/HorrorTroll) +* Hardware Supported: APM32F103CBT6 + +Make example for this keyboard (after setting up your build environment): + + `make doio/kb16/rev2:default` + or with the qmk cli: + `qmk compile -kb doio/kb16/rev2 -km default` + +Flashing example for this keyboard: + + `make doio/kb16/rev2:default:flash` + or with the qmk cli: + `qmk flash -kb doio/kb16/rev2 -km 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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (1! key) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/doio/kb16/rev2/rev2.c b/keyboards/doio/kb16/rev2/rev2.c new file mode 100644 index 0000000000..78637842c5 --- /dev/null +++ b/keyboards/doio/kb16/rev2/rev2.c @@ -0,0 +1,37 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 "rev2.h" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + { 0, 1, 2, 3, NO_LED }, + { 4, 5, 6, 7, NO_LED }, + { 8, 9, 10, 11, NO_LED }, + { 12, 13, 14, 15, NO_LED } +}, { + {0 , 0}, {75 , 0}, {149, 0}, {224, 0}, + {0 , 21}, {75 , 21}, {149, 21}, {224, 21}, + {0 , 43}, {75 , 43}, {149, 43}, {224, 43}, + {0 , 64}, {75 , 64}, {149, 64}, {224, 64}, +}, { + 1, 1, 1, 1, + 1, 4, 4, 1, + 1, 4, 4, 1, + 1, 1, 1, 1, +} }; +#endif diff --git a/keyboards/doio/kb16/rev2/rev2.h b/keyboards/doio/kb16/rev2/rev2.h new file mode 100644 index 0000000000..f1e86fb674 --- /dev/null +++ b/keyboards/doio/kb16/rev2/rev2.h @@ -0,0 +1,46 @@ +/* Copyright 2022 DOIO + * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> + * + * 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 "quantum.h" + +#define XXX KC_NO + +/* ┌───┬───┬───┬───┐ ┌───┐ ┌───┐ + * │00 │01 │02 │03 │ │04 │ │14 │ + * ├───┼───┼───┼───┤ └───┘ └───┘ + * │10 │11 │12 │13 │ + * ├───┼───┼───┼───┤ + * │20 │21 │22 │23 │ ┌───┐ + * ├───┼───┼───┼───┤ │24 │ + * │30 │31 │32 │33 │ └───┘ + * └───┴───┴───┴───┘ + */ + +#define LAYOUT( \ + K00, K01, K02, K03, K04, \ + K10, K11, K12, K13, K14, \ + K20, K21, K22, K23, K24, \ + K30, K31, K32, K33 \ +) { \ + { K00, K01, K02, K03, K04 }, \ + { K10, K11, K12, K13, K14 }, \ + { K20, K21, K22, K23, K24 }, \ + { K30, K31, K32, K33, XXX } \ +} + diff --git a/keyboards/doio/kb16/rev2/rules.mk b/keyboards/doio/kb16/rev2/rules.mk new file mode 100644 index 0000000000..7fa9b91da0 --- /dev/null +++ b/keyboards/doio/kb16/rev2/rules.mk @@ -0,0 +1,43 @@ +SRC += ./lib/layer_status/layer_status.c +SRC += ./lib/logo.c + +# MCU name +MCU = STM32F103 + +# Bootloader selection +# Cannot use `BOOTLOADER = stm32duino` due to the need to override +# `MCU_LDSCRIPT`, therefore all parameters need to be specified here manually. +OPT_DEFS += -DBOOTLOADER_STM32DUINO +MCU_LDSCRIPT = STM32F103xB_stm32duino_bootloader +BOARD = STM32_F103_STM32DUINO +BOOTLOADER_TYPE = stm32duino +DFU_ARGS = -d 1EAF:0003 -a 2 -R +DFU_SUFFIX_ARGS = -v 1EAF -p 0003 + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +# OLED enabled +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 + +# RGB Matrix enabled +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 + +# Encoder enabled +ENCODER_ENABLE = yes + +# Wear-levelling driver +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = embedded_flash |