KiwiKey 1 week ago
committed by GitHub
parent
commit
95be042957
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
14 changed files with 783 additions and 0 deletions
  1. +10
    -0
      keyboards/kiwikey/kawii9v2/config.h
  2. +105
    -0
      keyboards/kiwikey/kawii9v2/info.json
  3. +6
    -0
      keyboards/kiwikey/kawii9v2/keymaps/default/config.h
  4. +40
    -0
      keyboards/kiwikey/kawii9v2/keymaps/default/keymap.c
  5. +1
    -0
      keyboards/kiwikey/kawii9v2/keymaps/default/rules.mk
  6. +6
    -0
      keyboards/kiwikey/kawii9v2/keymaps/via/config.h
  7. +40
    -0
      keyboards/kiwikey/kawii9v2/keymaps/via/keymap.c
  8. +2
    -0
      keyboards/kiwikey/kawii9v2/keymaps/via/rules.mk
  9. +231
    -0
      keyboards/kiwikey/kawii9v2/lib/glcdfont.c
  10. +251
    -0
      keyboards/kiwikey/kawii9v2/lib/oled.c
  11. +46
    -0
      keyboards/kiwikey/kawii9v2/lib/oled_custom_api.c
  12. +9
    -0
      keyboards/kiwikey/kawii9v2/lib/oled_custom_api.h
  13. +32
    -0
      keyboards/kiwikey/kawii9v2/readme.md
  14. +4
    -0
      keyboards/kiwikey/kawii9v2/rules.mk

+ 10
- 0
keyboards/kiwikey/kawii9v2/config.h View File

@ -0,0 +1,10 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define OLED_DISPLAY_128X64
#define OLED_TIMEOUT 30000
#define OLED_FONT_H "lib/glcdfont.c"
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_UP_DOWN

+ 105
- 0
keyboards/kiwikey/kawii9v2/info.json View File

@ -0,0 +1,105 @@
{
"manufacturer": "KiwiKey",
"keyboard_name": "Kawii9 Rev.2",
"maintainer": "kiwikey",
"url": "https://kiwikey.vn/mechkey/kawii9/",
"bootloader_instructions": "Press the RESET button on the back of the PCB",
"bootloader": "atmel-dfu",
"processor": "atmega32u4",
"usb": {
"device_version": "2.0.0",
"pid": "0x3302",
"vid": "0x4B57"
},
"build": {
"lto": true
},
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": false,
"nkro": false,
"oled": true,
"wpm": true,
"rgb_matrix": true,
"encoder": true
},
"diode_direction": "COL2ROW",
"matrix_pins": {
"cols": [ "F4", "F5", "F6", "D4", "B1" ],
"rows": [ "B6", "B5", "B4", "D7", "B0" ]
},
"ws2812": {
"pin": "B7"
},
"rgb_matrix": {
"driver": "ws2812",
"max_brightness": 240,
"val_steps": 12,
"sleep": true,
"animations": {
"breathing": true,
"cycle_all": true,
"cycle_left_right": true,
"cycle_up_down": true,
"dual_beacon": true,
"rainbow_beacon": true,
"raindrops": true,
"typing_heatmap": true,
"solid_reactive_simple": true,
"solid_reactive": true,
"solid_reactive_cross": true,
"solid_reactive_nexus": true,
"splash": true,
"solid_splash": true
},
"layout": [
{ "flags": 2, "x": 96, "y": 19 },
{ "flags": 2, "x": 128, "y": 19 },
{ "flags": 2, "x": 128, "y": 42 },
{ "flags": 2, "x": 96, "y": 42 },
{ "flags": 4, "matrix": [0, 0], "x": 81, "y": 16 },
{ "flags": 4, "matrix": [0, 1], "x": 112, "y": 16 },
{ "flags": 4, "matrix": [0, 2], "x": 143, "y": 16 },
{ "flags": 4, "matrix": [1, 0], "x": 81, "y": 32 },
{ "flags": 4, "matrix": [1, 1], "x": 112, "y": 32 },
{ "flags": 4, "matrix": [1, 2], "x": 143, "y": 32 },
{ "flags": 4, "matrix": [2, 0], "x": 81, "y": 48 },
{ "flags": 4, "matrix": [2, 1], "x": 112, "y": 48 },
{ "flags": 4, "matrix": [2, 2], "x": 143, "y": 48 },
{ "flags": 2, "x": 12, "y": 42 },
{ "flags": 2, "x": 49, "y": 42 },
{ "flags": 2, "x": 49, "y": 19 },
{ "flags": 2, "x": 12, "y": 19 },
{ "flags": 8, "x": 31, "y": 10 }
]
},
"encoder": {
"rotary": [
{ "pin_a": "D3", "pin_b": "D5" },
{ "pin_a": "B2", "pin_b": "B3" }
]
}
"layouts": {
"LAYOUT": {
"layout": [
{ "matrix": [0, 0], "x": 0, "y": 0 },
{ "matrix": [0, 1], "x": 1, "y": 0 },
{ "matrix": [0, 2], "x": 2, "y": 0 },
{ "matrix": [1, 0], "x": 0, "y": 1 },
{ "matrix": [1, 1], "x": 1, "y": 1 },
{ "matrix": [1, 2], "x": 2, "y": 1 },
{ "matrix": [2, 0], "x": 0, "y": 2 },
{ "matrix": [2, 1], "x": 1, "y": 2 },
{ "matrix": [2, 2], "x": 2, "y": 2 },
{ "matrix": [3, 3], "x": 3, "y": 3 },
{ "matrix": [4, 4], "x": 4, "y": 4 }
]
}
}
}

+ 6
- 0
keyboards/kiwikey/kawii9v2/keymaps/default/config.h View File

@ -0,0 +1,6 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define ENCODER_MAP_KEY_DELAY 10

+ 40
- 0
keyboards/kiwikey/kawii9v2/keymaps/default/keymap.c View File

@ -0,0 +1,40 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_WHOM, KC_CALC, KC_MYCM, // Launch application: Browser - Calculator - My Computer
KC_MPLY, KC_MPRV, KC_MNXT, // Media track control: Play/Pause - Prev Track - Next Track
MO(1), LCTL(KC_C),LCTL(KC_V), // FN(1) - Copy - Paste
KC_MUTE, KC_HOME
),
[1] = LAYOUT(
RGB_TOG, RGB_RMOD, RGB_MOD,
_______, RGB_VAD, RGB_VAI,
_______, MO(2), _______,
_______, _______
),
[2] = LAYOUT(
_______, _______, _______,
_______, _______, _______,
_______, _______, MO(3),
_______, _______
),
[3] = LAYOUT(
QK_BOOT, _______, _______,
_______, _______, _______,
_______, _______, _______,
_______, _______
)
};
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW( KC_VOLD, KC_VOLU ), ENCODER_CCW_CW( KC_PGUP, KC_PGDN ) },
[1] = { ENCODER_CCW_CW( RGB_VAD, RGB_VAI ), ENCODER_CCW_CW( RGB_RMOD, RGB_MOD ) },
[2] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[3] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) }
};
#endif

+ 1
- 0
keyboards/kiwikey/kawii9v2/keymaps/default/rules.mk View File

@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes

+ 6
- 0
keyboards/kiwikey/kawii9v2/keymaps/via/config.h View File

@ -0,0 +1,6 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define ENCODER_MAP_KEY_DELAY 10

+ 40
- 0
keyboards/kiwikey/kawii9v2/keymaps/via/keymap.c View File

@ -0,0 +1,40 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_WHOM, KC_CALC, KC_MYCM, // Launch application: Browser - Calculator - My Computer
KC_MPLY, KC_MPRV, KC_MNXT, // Media track control: Play/Pause - Prev Track - Next Track
MO(1), LCTL(KC_C),LCTL(KC_V), // FN(1) - Copy - Paste
KC_MUTE, KC_HOME
),
[1] = LAYOUT(
RGB_TOG, RGB_RMOD, RGB_MOD,
_______, RGB_VAD, RGB_VAI,
_______, MO(2), _______,
_______, _______
),
[2] = LAYOUT(
_______, _______, _______,
_______, _______, _______,
_______, _______, MO(3),
_______, _______
),
[3] = LAYOUT(
QK_BOOT, _______, _______,
_______, _______, _______,
_______, _______, _______,
_______, _______
)
};
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW( KC_VOLD, KC_VOLU ), ENCODER_CCW_CW( KC_PGUP, KC_PGDN ) },
[1] = { ENCODER_CCW_CW( RGB_VAD, RGB_VAI ), ENCODER_CCW_CW( RGB_RMOD, RGB_MOD ) },
[2] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[3] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) }
};
#endif

+ 2
- 0
keyboards/kiwikey/kawii9v2/keymaps/via/rules.mk View File

@ -0,0 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

+ 231
- 0
keyboards/kiwikey/kawii9v2/lib/glcdfont.c View File

@ -0,0 +1,231 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#include "progmem.h"
static const unsigned char PROGMEM font[] = {
0x07, 0x08, 0x7F, 0x08, 0x07, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
0x36, 0x49, 0x56, 0x20, 0x50, 0x00,
0x00, 0x05, 0x03, 0x00, 0x00, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
0x14, 0x08, 0x3E, 0x08, 0x14, 0x00,
0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
0x00, 0x00, 0xA0, 0x60, 0x00, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
0x21, 0x41, 0x45, 0x4B, 0x31, 0x00,
0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
0x3C, 0x4A, 0x49, 0x49, 0x30, 0x00,
0x01, 0x71, 0x09, 0x05, 0x03, 0x00,
0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
0x06, 0x49, 0x49, 0x29, 0x1E, 0x00,
0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0xA8, 0x68, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
0x02, 0x01, 0x59, 0x09, 0x06, 0x00,
0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
0x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x00,
0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
0x46, 0x49, 0x49, 0x49, 0x31, 0x00,
0x01, 0x01, 0x7F, 0x01, 0x01, 0x00,
0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
0x07, 0x08, 0x70, 0x08, 0x07, 0x00,
0x61, 0x51, 0x49, 0x45, 0x43, 0x00,
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,
0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
0x00, 0x41, 0x41, 0x7F, 0x00, 0x00,
0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
0x00, 0x01, 0x02, 0x04, 0x00, 0x00,
0x20, 0x54, 0x54, 0x54, 0x78, 0x00,
0x7F, 0x48, 0x44, 0x44, 0x38, 0x00,
0x38, 0x44, 0x44, 0x44, 0x44, 0x00,
0x38, 0x44, 0x44, 0x48, 0x7F, 0x00,
0x38, 0x54, 0x54, 0x54, 0x18, 0x00,
0x00, 0x08, 0x7E, 0x09, 0x02, 0x00,
0x18, 0xA4, 0xA4, 0xA4, 0x7C, 0x00,
0x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
0x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
0x40, 0x80, 0x84, 0x7D, 0x00, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
0x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
0xFC, 0x24, 0x24, 0x24, 0x18, 0x00,
0x18, 0x24, 0x24, 0x24, 0xFC, 0x00,
0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
0x00, 0x04, 0x3F, 0x44, 0x20, 0x00,
0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
0x1C, 0xA0, 0xA0, 0xA0, 0x7C, 0x00,
0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
0x08, 0x04, 0x08, 0x10, 0x08, 0x00,
0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x40, 0x40, 0xF0, 0xF8, 0xF8,
0xFF, 0x38, 0xFF, 0xF8, 0xF8, 0x3F,
0xF8, 0xF8, 0xFF, 0x38, 0xFF, 0xF8,
0xF8, 0xF0, 0x40, 0x40, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00,
0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00,
0x80, 0xC0, 0xC0, 0x00, 0xC0, 0xC0,
0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0,
0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xE0, 0xF0, 0xF8, 0xF8, 0xF0, 0xF6,
0xF3, 0xF9, 0xF8, 0x78, 0x30, 0x00,
0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
0x5A, 0x3C, 0xFF, 0x3C, 0x5A, 0x00,
0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x49, 0x49, 0x49, 0xFF, 0xFF, 0xFF,
0xFF, 0xE0, 0xDF, 0xBF, 0xBF, 0x00,
0xBF, 0xBF, 0xDF, 0xE0, 0xFF, 0xFF,
0xFF, 0xFF, 0x49, 0x49, 0x49, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1F, 0x3F,
0x60, 0x60, 0xE0, 0xBF, 0x1F, 0x00,
0x7F, 0x7F, 0x07, 0x1E, 0x38, 0x1E,
0x07, 0x7F, 0x7F, 0x00, 0x7F, 0x7F,
0x0E, 0x1F, 0x3B, 0x71, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F,
0x0C, 0x0C, 0x0C, 0x00, 0x7E, 0x7E,
0x00, 0x7F, 0x7E, 0x03, 0x03, 0x00,
0x7F, 0x7E, 0x03, 0x03, 0x7E, 0x7E,
0x03, 0x03, 0x7F, 0x7E, 0x00, 0x0F,
0x3E, 0x70, 0x3C, 0x06, 0x3C, 0x70,
0x3E, 0x0F, 0x00, 0x32, 0x7B, 0x49,
0x49, 0x3F, 0x7E, 0x00, 0x7F, 0x7E,
0x03, 0x03, 0x00, 0x1E, 0x3F, 0x69,
0x69, 0x6F, 0x26, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x3F,
0x3F, 0x7F, 0x7F, 0x3C, 0x18, 0x00,
0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
0x49, 0x22, 0x14, 0x49, 0x22, 0x14,
0x14, 0x22, 0x49, 0x14, 0x22, 0x49,
0x54, 0x2A, 0x54, 0x2A, 0x54, 0x2A,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x07, 0x0F, 0x0F,
0x7F, 0x0F, 0x7F, 0x0F, 0x0F, 0x7E,
0x0F, 0x0F, 0x7F, 0x0F, 0x7F, 0x0F,
0x0F, 0x07, 0x01, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

+ 251
- 0
keyboards/kiwikey/kawii9v2/lib/oled.c View File

@ -0,0 +1,251 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h"
#include "oled_custom_api.h"
#ifdef OLED_ENABLE
#define LOGO_WIDTH 24
#define LOGO_HEIGHT 24
static const char PROGMEM qmk_logo[LOGO_HEIGHT/8][LOGO_WIDTH] = {
{ 0x81,0x82,0x83,0x84 },
{ 0xa1,0xa2,0xa3,0xa4 },
{ 0xc1,0xc2,0xc3,0xc4 }
};
static void render_qmk_logo(uint8_t col, uint8_t row) {
for (uint8_t i = 0; i < LOGO_HEIGHT/8; i++) {
oled_set_cursor(col, row++);
oled_write_P(qmk_logo[i], false);
}
}
static uint32_t key_timer = 0;
static uint8_t rgb_val = 0;
// Sub UI is the bottom half of OLED screen, shows WPM chart, RGB infos,...
// sub_ui_mode = 0 : WPM graph
// 1 : RGB control
// 2 : Media control (to do)
#define SUB_UI_TIMEOUT 2000 // ms
static char sub_ui_mode = 0;
// Configuration for Key Matrix
#define MATRIX_DISPLAY_X 107
#define MATRIX_DISPLAY_Y 11
#define MATRIX_DISPLAY_SIZE 22
#define KEY_SIZE 4
#define KEY_SPACING 3
// Configuration for WPM Graph
#define GRAPH_ZERO_X 25 // This is zero origin
#define GRAPH_ZERO_Y 63 // of the WPM graph
#define GRAPH_WIDTH 100
#define GRAPH_HEIGHT 28
#define GRAPH_REFRESH_INTERVAL 100 // ms
#define GRAPH_LINE_THICKNESS 1
float max_wpm = 100.0;
uint16_t graph_timer = 0;
// RGB Matrix naming, copy from @tzarc
#if defined(RGB_MATRIX_ENABLE)
#include <rgb_matrix.h>
#if defined(RGB_MATRIX_EFFECT)
# undef RGB_MATRIX_EFFECT
#endif // defined(RGB_MATRIX_EFFECT)
#define RGB_MATRIX_EFFECT(x) RGB_MATRIX_EFFECT_##x,
enum {
RGB_MATRIX_EFFECT_NONE,
#include "rgb_matrix_effects.inc"
#undef RGB_MATRIX_EFFECT
#ifdef RGB_MATRIX_CUSTOM_KB
# include "rgb_matrix_kb.inc"
#endif
#ifdef RGB_MATRIX_CUSTOM_USER
# include "rgb_matrix_user.inc"
#endif
};
#define RGB_MATRIX_EFFECT(x) \
case RGB_MATRIX_EFFECT_##x: \
return #x;
const char* rgb_matrix_name(uint8_t effect) {
switch (effect) {
case RGB_MATRIX_EFFECT_NONE:
return "NONE";
#include "rgb_matrix_effects.inc"
#undef RGB_MATRIX_EFFECT
#ifdef RGB_MATRIX_CUSTOM_KB
# include "rgb_matrix_kb.inc"
#endif
#ifdef RGB_MATRIX_CUSTOM_USER
# include "rgb_matrix_user.inc"
#endif
default:
return "UNKNOWN";
}
}
#endif // defined(RGB_MATRIX_ENABLE)
void render_matrix(void) {
for (uint8_t x = 0; x < MATRIX_ROWS-2; x++) {
for (uint8_t y = 0; y < MATRIX_COLS-2; y++) {
bool on = (matrix_get_row(x) & (1 << y)) > 0; // The matrix position [x,y] is being pressed
draw_rect( MATRIX_DISPLAY_X + y*(KEY_SIZE+KEY_SPACING), // X - horizontal position of key
MATRIX_DISPLAY_Y + x*(KEY_SIZE+KEY_SPACING), // Y - vertical position of key
KEY_SIZE,
KEY_SIZE,
on);
}
}
}
void render_wpm_graph(void) {
uint8_t curr_wpm = (get_current_wpm() < max_wpm ? get_current_wpm() : max_wpm);
if (timer_elapsed(graph_timer) > GRAPH_REFRESH_INTERVAL) {
uint8_t graph_pointer = (curr_wpm / max_wpm) * GRAPH_HEIGHT;
draw_line_h(GRAPH_ZERO_X + 1, GRAPH_ZERO_Y - graph_pointer, GRAPH_LINE_THICKNESS, true);
for (char i = 0; i < graph_pointer; i++) {
draw_line_h(GRAPH_ZERO_X + 1, GRAPH_ZERO_Y - i, GRAPH_LINE_THICKNESS, true);
}
for (char i = 0; i < GRAPH_LINE_THICKNESS; i++) {
oled_pan_area(GRAPH_ZERO_X,
GRAPH_ZERO_X + GRAPH_WIDTH,
(GRAPH_ZERO_Y + 1 - GRAPH_HEIGHT) / 8,
(GRAPH_ZERO_Y + 1) / 8 - 1,
false);
}
graph_timer = timer_read();
}
}
void ui_clear(void) {
oled_set_cursor(0, 4);
oled_advance_page(true);
oled_advance_page(true);
oled_advance_page(true);
oled_advance_page(true);
}
void render_ui_frame(void) {
oled_clear();
oled_advance_page(false);
oled_write_ln_P(PSTR("LAYER WPM"), false);
oled_advance_page(false);
oled_write_ln_P(PSTR("RGB"), false);
oled_advance_page(false);
oled_advance_page(false);
oled_advance_page(false);
// Outline for layer number
draw_line_h(35, 7, 7, true);
draw_line_v(34, 8, 7, true);
draw_line_v(35, 8, 8, true);
draw_line_v(42, 8, 7, true);
// Outline for RGB mode number
draw_line_h(23, 23, 19, true);
draw_line_v(22, 24, 7, true);
draw_line_v(23, 24, 8, true);
draw_line_v(42, 24, 7, true);
// Outline for Key Matrix
draw_line_h(MATRIX_DISPLAY_X -2, MATRIX_DISPLAY_Y -3, MATRIX_DISPLAY_SIZE, true);
draw_line_h(MATRIX_DISPLAY_X -2, MATRIX_DISPLAY_Y -2 + MATRIX_DISPLAY_SIZE, MATRIX_DISPLAY_SIZE, true);
draw_line_v(MATRIX_DISPLAY_X -3, MATRIX_DISPLAY_Y -2, MATRIX_DISPLAY_SIZE, true);
draw_line_v(MATRIX_DISPLAY_X -2 + MATRIX_DISPLAY_SIZE, MATRIX_DISPLAY_Y-2, MATRIX_DISPLAY_SIZE, true);
}
void render_ui_rgbcontrol(void) {
oled_set_cursor(0, 5);
oled_write_P(PSTR("----< Lighting >-----"), false);
// RGB mode
oled_set_cursor(0, 6);
oled_write_ln(rgb_matrix_name(rgb_matrix_get_mode()), false);
// RGB brightness bar
oled_set_cursor(0, 7);
oled_write_char((rgb_val == 0) ? 0x07 : 0x9D, false);
for (uint8_t i = 0; i < 20; i++) {
oled_write_char(0x20, i*5 < rgb_val);
}
}
void render_stats(void) {
// Current layer
oled_set_cursor(6, 1);
oled_write_char(get_highest_layer(layer_state) + 0x30, true);
// Current WPM
oled_set_cursor(13, 1);
oled_write(get_u8_str(get_current_wpm(), '0'), false);
// Show current RGB mode (#__)
oled_set_cursor(4,3);
if (rgb_matrix_is_enabled()) {
oled_write_P(PSTR("#"), true);
oled_write_char(rgb_matrix_get_mode()/10 + 0x30, true);
oled_write_char(rgb_matrix_get_mode()%10 + 0x30, true);
}
else {
oled_write_P(PSTR("OFF"), true);
}
// RGB brightness (percentage %)
oled_set_cursor(9, 3);
rgb_val = (rgb_matrix_is_enabled() ? rgb_matrix_get_val()*100/RGB_MATRIX_MAXIMUM_BRIGHTNESS : 0);
if (rgb_matrix_is_enabled()) {
oled_write_char((rgb_val == 0) ? 0x07 : 0x9D, false);
oled_write(get_u8_str(rgb_val, ' '), false);
oled_write_char(0x25, false); // %
}
else {
oled_write_P(PSTR("-----"), false);
}
}
void keyboard_post_init_kb(void) {
render_ui_frame();
keyboard_post_init_user();
}
bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
render_stats();
switch (sub_ui_mode) {
case 0:
render_wpm_graph();
render_qmk_logo(0, 5);
break;
case 1:
render_ui_rgbcontrol();
break;
}
if ((sub_ui_mode != 0) && (timer_elapsed32(key_timer) > SUB_UI_TIMEOUT)) { // If timeout, back to default UI
sub_ui_mode = 0;
ui_clear();
}
if (timer_elapsed32(key_timer) > OLED_TIMEOUT) {
oled_off();
}
return false;
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QK_LIGHTING ... QK_LIGHTING_MAX:
sub_ui_mode = 1;
ui_clear();
break;
/** TODO
case KC_AUDIO_MUTE ... KC_MEDIA_EJECT:
sub_ui_mode = 2;
ui_clear();
break;
***/
default:
break;
}
render_matrix();
key_timer = timer_read32();
return process_record_user(keycode, record);
}
#endif // defined(OLED_ENABLE)

+ 46
- 0
keyboards/kiwikey/kawii9v2/lib/oled_custom_api.c View File

@ -0,0 +1,46 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#include "oled_custom_api.h"
extern uint8_t oled_buffer[OLED_MATRIX_SIZE];
extern OLED_BLOCK_TYPE oled_dirty;
#define OLED_ALL_BLOCKS_MASK (((((OLED_BLOCK_TYPE)1 << (OLED_BLOCK_COUNT - 1)) - 1) << 1) | 1)
// x range: 0..127
// y range: 0..7
void oled_pan_area(char start_x, char end_x, char start_y, char end_y, bool left) {
uint16_t i = 0;
for (uint16_t y = start_y; y <= end_y; y++) {
if (left) {
for (uint16_t x = start_x; x < end_x; x++) {
i = y * OLED_DISPLAY_WIDTH + x;
oled_buffer[i] = oled_buffer[i + 1];
}
} else {
for (uint16_t x = end_x; x > start_x; x--) {
i = y * OLED_DISPLAY_WIDTH + x;
oled_buffer[i] = oled_buffer[i - 1];
}
}
}
oled_dirty = OLED_ALL_BLOCKS_MASK;
}
void draw_line_h(uint8_t x, uint8_t y, uint8_t len, bool on) {
for (uint8_t i = 0; i < len; i++) {
oled_write_pixel(i + x, y, on);
}
}
void draw_line_v(uint8_t x, uint8_t y, uint8_t len, bool on) {
for (uint8_t i = 0; i < len; i++) {
oled_write_pixel(x, i + y, on);
}
}
void draw_rect(uint8_t x, uint8_t y, uint8_t sizex, uint8_t sizey, bool on) {
for (uint8_t i = 0; i < sizey; i++) {
draw_line_h(x, y+i, sizex, on);
}
}

+ 9
- 0
keyboards/kiwikey/kawii9v2/lib/oled_custom_api.h View File

@ -0,0 +1,9 @@
// Copyright 2023 KiwiKey
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h"
void oled_pan_area(char start_x, char end_x, char start_y, char end_y, bool left);
void draw_line_h(uint8_t x, uint8_t y, uint8_t len, bool on);
void draw_line_v(uint8_t x, uint8_t y, uint8_t len, bool on);
void draw_rect(uint8_t x, uint8_t y, uint8_t sizex, uint8_t sizey, bool on);

+ 32
- 0
keyboards/kiwikey/kawii9v2/readme.md View File

@ -0,0 +1,32 @@
# Kawii9 Rev2
![Kawii9 Rev2](https://i.imgur.com/ogYWVq1.jpeg)
Kawii9 rev2 is a keypad with per-key RGB and expandable modules. There are 3 variants:
1. Simple 3x3 keypad,
2. with a 1.3" OLED screen and a rotary encoder,
3. with another rotary encoder and a RGB indicator LED
More infos: https://kiwikey.vn/mechkey/kawii9/
* Keyboard Maintainer: [KiwiKey](https://github.com/kiwikey)
* Hardware Supported: Kawii9 rev2 PCB
* Hardware Availability: from Group-buy, or via KiwiKey Website (https://kiwikey.vn/mechkey/kawii9/)
Make example for this keyboard (after setting up your build environment):
make kiwikey/kawii9v2:default
Flashing example for this keyboard:
make kiwikey/kawii9v2: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 (the top left 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

+ 4
- 0
keyboards/kiwikey/kawii9v2/rules.mk View File

@ -0,0 +1,4 @@
VPATH += keyboards/kiwikey/kawii9v2/lib
SRC += \
oled_custom_api.c \
oled.c

Loading…
Cancel
Save