Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new keyboard DOIO KB16 (Rev 2) #18699

Merged
merged 5 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions keyboards/doio/kb16/kb16.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
31 changes: 5 additions & 26 deletions keyboards/doio/kb16/kb16.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 0 additions & 9 deletions keyboards/doio/kb16/keymaps/bongocat/rules.mk

This file was deleted.

1 change: 0 additions & 1 deletion keyboards/doio/kb16/keymaps/via/rules.mk

This file was deleted.

25 changes: 6 additions & 19 deletions keyboards/doio/kb16/readme.md
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
),

Expand All @@ -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),
_______, _______, _______, _______, _______,
_______, _______, _______, _______
),

Expand All @@ -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),
_______, _______, _______, _______, _______,
_______, _______, _______, _______
),

Expand All @@ -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
),
};
Expand All @@ -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
17 changes: 17 additions & 0 deletions keyboards/doio/kb16/rev1/keymaps/bongocat/rules.mk
Original file line number Diff line number Diff line change
@@ -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
Loading