From 22c576b40b528fbea432321f9ec279b3fd5871af Mon Sep 17 00:00:00 2001 From: Dan Ford Date: Wed, 20 Sep 2023 19:11:24 -0700 Subject: [PATCH] [Keyboard] add Quokka keyboard (#20979) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/quokka/config.h | 34 ++++++ keyboards/quokka/halconf.h | 23 ++++ keyboards/quokka/info.json | 121 ++++++++++++++++++++++ keyboards/quokka/keymaps/default/keymap.c | 37 +++++++ keyboards/quokka/mcuconf.h | 26 +++++ keyboards/quokka/quokka.c | 61 +++++++++++ keyboards/quokka/readme.md | 26 +++++ keyboards/quokka/rules.mk | 2 + 8 files changed, 330 insertions(+) create mode 100644 keyboards/quokka/config.h create mode 100644 keyboards/quokka/halconf.h create mode 100644 keyboards/quokka/info.json create mode 100644 keyboards/quokka/keymaps/default/keymap.c create mode 100644 keyboards/quokka/mcuconf.h create mode 100644 keyboards/quokka/quokka.c create mode 100644 keyboards/quokka/readme.md create mode 100644 keyboards/quokka/rules.mk diff --git a/keyboards/quokka/config.h b/keyboards/quokka/config.h new file mode 100644 index 000000000000..6cacf0d54594 --- /dev/null +++ b/keyboards/quokka/config.h @@ -0,0 +1,34 @@ +/* +Copyright 2023 @dlford +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 . +*/ + +#pragma once + +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 150U + +#define WS2812_PIO_USE_PIO1 +#define RGB_MATRIX_LED_COUNT 36 + +#define I2C_DRIVER I2CD1 +#define I2C1_SDA_PIN GP2 +#define I2C1_SCL_PIN GP3 +#define OLED_DISPLAY_128X64 + +#define AUDIO_PIN GP9 +#define AUDIO_PWM_DRIVER PWMD4 +#define AUDIO_PWM_CHANNEL RP2040_PWM_CHANNEL_B + +#define SERIAL_USART_FULL_DUPLEX +#define SERIAL_PIO_USE_PIO0 +#define SERIAL_USART_RX_PIN GP1 diff --git a/keyboards/quokka/halconf.h b/keyboards/quokka/halconf.h new file mode 100644 index 000000000000..1ec46d2b1564 --- /dev/null +++ b/keyboards/quokka/halconf.h @@ -0,0 +1,23 @@ +/* +Copyright 2023 @dlford + +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 . +*/ + +#pragma once + +#define HAL_USE_PWM TRUE +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/quokka/info.json b/keyboards/quokka/info.json new file mode 100644 index 000000000000..86037222bbee --- /dev/null +++ b/keyboards/quokka/info.json @@ -0,0 +1,121 @@ +{ + "manufacturer": "dlford", + "keyboard_name": "Quokka", + "maintainer": "dlford", + "bootloader": "rp2040", + "build": { + "lto": true + }, + "diode_direction": "ROW2COL", + "features": { + "audio": true, + "extrakey": true, + "lto": true, + "oled": true, + "rgb_matrix": true + }, + "matrix_pins": { + "cols": ["GP8", "GP7", "GP6", "GP5", "GP4"], + "rows": ["GP10", "GP19", "GP20", "GP18"] + }, + "processor": "RP2040", + "rgb_matrix": { + "center_point": [133, 54], + "driver": "ws2812", + "layout": [ + { "flags": 4, "matrix": [3, 4], "x": 122, "y": 85 }, + { "flags": 4, "matrix": [3, 3], "x": 102, "y": 85 }, + { "flags": 4, "matrix": [3, 2], "x": 81, "y": 85 }, + { "flags": 4, "matrix": [2, 4], "x": 102, "y": 64 }, + { "flags": 4, "matrix": [1, 4], "x": 102, "y": 43 }, + { "flags": 4, "matrix": [0, 4], "x": 102, "y": 21 }, + { "flags": 4, "matrix": [0, 3], "x": 81, "y": 21 }, + { "flags": 4, "matrix": [1, 3], "x": 81, "y": 43 }, + { "flags": 4, "matrix": [2, 3], "x": 81, "y": 64 }, + { "flags": 4, "matrix": [2, 2], "x": 61, "y": 64 }, + { "flags": 4, "matrix": [1, 2], "x": 61, "y": 43 }, + { "flags": 4, "matrix": [0, 2], "x": 61, "y": 21 }, + { "flags": 4, "matrix": [0, 1], "x": 41, "y": 21 }, + { "flags": 4, "matrix": [1, 1], "x": 41, "y": 43 }, + { "flags": 4, "matrix": [2, 1], "x": 41, "y": 64 }, + { "flags": 4, "matrix": [2, 0], "x": 20, "y": 64 }, + { "flags": 4, "matrix": [1, 0], "x": 20, "y": 43 }, + { "flags": 4, "matrix": [0, 0], "x": 20, "y": 21 }, + { "flags": 4, "matrix": [7, 0], "x": 143, "y": 85 }, + { "flags": 4, "matrix": [7, 1], "x": 163, "y": 85 }, + { "flags": 4, "matrix": [7, 2], "x": 183, "y": 85 }, + { "flags": 4, "matrix": [6, 0], "x": 163, "y": 64 }, + { "flags": 4, "matrix": [5, 0], "x": 163, "y": 43 }, + { "flags": 4, "matrix": [4, 0], "x": 163, "y": 21 }, + { "flags": 4, "matrix": [4, 1], "x": 183, "y": 21 }, + { "flags": 4, "matrix": [5, 1], "x": 183, "y": 43 }, + { "flags": 4, "matrix": [6, 1], "x": 183, "y": 64 }, + { "flags": 4, "matrix": [6, 2], "x": 204, "y": 64 }, + { "flags": 4, "matrix": [5, 2], "x": 204, "y": 43 }, + { "flags": 4, "matrix": [4, 2], "x": 204, "y": 21 }, + { "flags": 4, "matrix": [4, 3], "x": 224, "y": 21 }, + { "flags": 4, "matrix": [5, 3], "x": 224, "y": 43 }, + { "flags": 4, "matrix": [6, 3], "x": 224, "y": 64 }, + { "flags": 4, "matrix": [6, 4], "x": 244, "y": 64 }, + { "flags": 4, "matrix": [5, 4], "x": 244, "y": 43 }, + { "flags": 4, "matrix": [4, 4], "x": 244, "y": 21 } + ], + "split_count": [18, 18] + }, + "split": { + "enabled": true, + "soft_serial_pin": "GP0" + }, + "url": "https://github.com/dlford/quokka", + "usb": { + "device_version": "1.0.0", + "pid": "0x3537", + "vid": "0x444D" + }, + "ws2812": { + "driver": "vendor", + "pin": "GP29" + }, + "layouts": { + "LAYOUT_split_3x5_3": { + "layout": [ + { "label": "L00", "matrix": [0, 0], "w": 1, "x": 0, "y": 0 }, + { "label": "L01", "matrix": [0, 1], "w": 1, "x": 1, "y": 0 }, + { "label": "L02", "matrix": [0, 2], "w": 1, "x": 2, "y": 0 }, + { "label": "L03", "matrix": [0, 3], "w": 1, "x": 3, "y": 0 }, + { "label": "L04", "matrix": [0, 4], "w": 1, "x": 4, "y": 0 }, + { "label": "R00", "matrix": [4, 4], "w": 1, "x": 5, "y": 0 }, + { "label": "R01", "matrix": [4, 3], "w": 1, "x": 6, "y": 0 }, + { "label": "R02", "matrix": [4, 2], "w": 1, "x": 7, "y": 0 }, + { "label": "R03", "matrix": [4, 1], "w": 1, "x": 8, "y": 0 }, + { "label": "R04", "matrix": [4, 0], "w": 1, "x": 9, "y": 0 }, + { "label": "L10", "matrix": [1, 0], "w": 1, "x": 10, "y": 0 }, + { "label": "L11", "matrix": [1, 1], "w": 1, "x": 11, "y": 0 }, + { "label": "L12", "matrix": [1, 2], "w": 1, "x": 12, "y": 0 }, + { "label": "L13", "matrix": [1, 3], "w": 1, "x": 13, "y": 0 }, + { "label": "L14", "matrix": [1, 4], "w": 1, "x": 14, "y": 0 }, + { "label": "R10", "matrix": [5, 4], "w": 1, "x": 15, "y": 0 }, + { "label": "R11", "matrix": [5, 3], "w": 1, "x": 16, "y": 0 }, + { "label": "R12", "matrix": [5, 2], "w": 1, "x": 17, "y": 0 }, + { "label": "R13", "matrix": [5, 1], "w": 1, "x": 18, "y": 0 }, + { "label": "R14", "matrix": [5, 0], "w": 1, "x": 19, "y": 0 }, + { "label": "L20", "matrix": [2, 0], "w": 1, "x": 20, "y": 0 }, + { "label": "L21", "matrix": [2, 1], "w": 1, "x": 21, "y": 0 }, + { "label": "L22", "matrix": [2, 2], "w": 1, "x": 22, "y": 0 }, + { "label": "L23", "matrix": [2, 3], "w": 1, "x": 23, "y": 0 }, + { "label": "L24", "matrix": [2, 4], "w": 1, "x": 24, "y": 0 }, + { "label": "R20", "matrix": [6, 4], "w": 1, "x": 25, "y": 0 }, + { "label": "R21", "matrix": [6, 3], "w": 1, "x": 26, "y": 0 }, + { "label": "R22", "matrix": [6, 2], "w": 1, "x": 27, "y": 0 }, + { "label": "R23", "matrix": [6, 1], "w": 1, "x": 28, "y": 0 }, + { "label": "R24", "matrix": [6, 0], "w": 1, "x": 29, "y": 0 }, + { "label": "L32", "matrix": [3, 2], "w": 1, "x": 30, "y": 0 }, + { "label": "L33", "matrix": [3, 3], "w": 1, "x": 31, "y": 0 }, + { "label": "L34", "matrix": [3, 4], "w": 1, "x": 32, "y": 0 }, + { "label": "R30", "matrix": [7, 4], "w": 1, "x": 33, "y": 0 }, + { "label": "R31", "matrix": [7, 3], "w": 1, "x": 34, "y": 0 }, + { "label": "R32", "matrix": [7, 2], "w": 1, "x": 35, "y": 0 } + ] + } + } +} diff --git a/keyboards/quokka/keymaps/default/keymap.c b/keyboards/quokka/keymaps/default/keymap.c new file mode 100644 index 000000000000..77375cd8a151 --- /dev/null +++ b/keyboards/quokka/keymaps/default/keymap.c @@ -0,0 +1,37 @@ +/* +Copyright 2023 @dlford + +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 QMK_KEYBOARD_H + + +// clang-format off + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_split_3x5_3( +// |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------| + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, +// |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------| + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, +// |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------| + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, +// |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------| + KC_ESC, KC_SPC, KC_BSPC, KC_DEL, KC_TAB, KC_ENT +// |--------+--------+--------| |--------+--------+--------| + ), +}; + +// clang-format on diff --git a/keyboards/quokka/mcuconf.h b/keyboards/quokka/mcuconf.h new file mode 100644 index 000000000000..32dbaa6c48c6 --- /dev/null +++ b/keyboards/quokka/mcuconf.h @@ -0,0 +1,26 @@ +/* +Copyright 2023 @dlford + +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 . +*/ + +#pragma once + +#include_next + +#undef RP_PWM_USE_PWM4 +#define RP_PWM_USE_PWM4 TRUE + +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 TRUE diff --git a/keyboards/quokka/quokka.c b/keyboards/quokka/quokka.c new file mode 100644 index 000000000000..2225866b8c58 --- /dev/null +++ b/keyboards/quokka/quokka.c @@ -0,0 +1,61 @@ +/* +Copyright 2023 @dlford + +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 "quantum.h" + +#ifdef OLED_ENABLE +oled_rotation_t oled_init_kb(oled_rotation_t rotation) { + return OLED_ROTATION_180; +} + +// Prints out logo +static void oled_render_logo(void) { + static const char PROGMEM raw_logo[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 224, 224, 96, 96, 96, 96, 96, 96, 128, 192, 224, 224, 240, 240, 240, 224, 224, 192, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 240, 60, 30, 7, 1, 192, 224, 224, 240, 240, 240, 0, 255, 255, 255, 255, 249, 241, 241, 7, 7, 55, 247, 192, 0, 0, 0, 0, 224, 224, 224, 224, 224, 192, 192, 192, 0, 192, 224, 224, 224, 0, 0, 0, 0, 224, 224, 96, 96, 96, 96, 0, 192, 224, 96, 96, 96, 224, 192, 192, 192, 224, 96, 96, 96, 224, 192, 0, 224, 224, 96, 96, 96, 224, 192, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 15, 60, 240, 224, 134, 31, 63, 127, 255, 249, 248, 248, 127, 127, 63, 31, 0, 0, 128, 224, 248, 60, 15, 3, 1, 0, 0, 0, 127, 127, 127, 127, 113, 127, 127, 63, 31, 31, 63, 127, 127, 112, 112, 112, 112, 127, 127, 6, 6, 6, 6, 0, 127, 127, 96, 96, 96, 127, 127, 63, 127, 127, 12, 12, 60, 127, 103, 0, 127, 127, 96, 96, 96, 127, 63, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 14, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 14, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + oled_write_raw_P(raw_logo, sizeof(raw_logo)); +} + +// Render logo on both displays +bool oled_task_kb(void) { + if (!oled_task_user()) { + return false; + } + oled_render_logo(); + return true; +} +#endif +// clang-format off + +#ifdef SWAP_HANDS_ENABLE +__attribute__ ((weak)) +const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + // Left + {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}}, + {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}}, + {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}}, + {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}}, + // Right + {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}}, + {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}}, + {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}}, + {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}} +}; +#endif + +// clang-format on diff --git a/keyboards/quokka/readme.md b/keyboards/quokka/readme.md new file mode 100644 index 000000000000..6acf5bc46249 --- /dev/null +++ b/keyboards/quokka/readme.md @@ -0,0 +1,26 @@ +# Quokka + +![Quokka](https://i.imgur.com/zqbb56ch.jpeg) + +A split ortholinear keyboard designed for the small handed. + +* Keyboard Maintainer: [dlford](https://github.com/dlford/), [dlford.io](https://www.dlford.io) +* Hardware Supported: Quokka PCB, Adafruit KB2040 +* Hardware Availability: [PCB, Case Data, and Build Guide](https://github.com/dlford/quokka) + +Make example for this keyboard (after setting up your build environment): + + make quokka:default + +Flashing example for this keyboard: + + make quokka: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 2 ways: + +* **Physical reset button**: Quickly double press and release the reset button on the the PCB +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/quokka/rules.mk b/keyboards/quokka/rules.mk new file mode 100644 index 000000000000..c53818be7354 --- /dev/null +++ b/keyboards/quokka/rules.mk @@ -0,0 +1,2 @@ +AUDIO_DRIVER = pwm_hardware +SERIAL_DRIVER = vendor