summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
authorLeon Anavi <leon@anavi.org>2023-03-06 03:28:01 +0200
committerGitHub <noreply@github.com>2023-03-05 18:28:01 -0700
commit61f3f5676a1f4ba31ad9ed7bdcba164178230275 (patch)
tree986bcdd24302638c84dad696b9c272a081d19dda /keyboards
parent500c4b748491727aa66f72331702072a8417d528 (diff)
keyboards/anavi: Add ANAVI Knobs 3 (#18624)
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/anavi/knobs3/info.json76
-rw-r--r--keyboards/anavi/knobs3/keymaps/default/keymap.c10
-rw-r--r--keyboards/anavi/knobs3/knobs3.c73
-rw-r--r--keyboards/anavi/knobs3/mcuconf.h12
-rw-r--r--keyboards/anavi/knobs3/readme.md25
-rw-r--r--keyboards/anavi/knobs3/rules.mk6
6 files changed, 202 insertions, 0 deletions
diff --git a/keyboards/anavi/knobs3/info.json b/keyboards/anavi/knobs3/info.json
new file mode 100644
index 0000000000..8bea49066d
--- /dev/null
+++ b/keyboards/anavi/knobs3/info.json
@@ -0,0 +1,76 @@
+{
+ "keyboard_name": "Knobs 3",
+ "manufacturer": "ANAVI",
+ "url": "https://github.com/AnaviTechnology/anavi-knobs-3",
+ "maintainer": "leon-anavi",
+ "processor": "RP2040",
+ "bootloader": "rp2040",
+ "matrix_pins": {
+ "direct": [
+ ["GP26", "GP29", "GP0"]
+ ]
+ },
+ "features": {
+ "bootmagic": false,
+ "command": false,
+ "console": false,
+ "extrakey": true,
+ "mousekey": false,
+ "nkro": true,
+ "rgblight": true
+ },
+ "rgblight": {
+ "pin": "GP12",
+ "led_count": 1,
+ "hue_steps": 10,
+ "saturation_steps": 17,
+ "brightness_steps": 17,
+ "max_brightness": 255,
+ "animations": {
+ "alternating": true,
+ "breathing": true,
+ "christmas": true,
+ "knight": true,
+ "rainbow_mood": true,
+ "rainbow_swirl": true,
+ "rgb_test": true,
+ "snake": true,
+ "static_gradient": true,
+ "twinkle": true
+ }
+ },
+ "encoder": {
+ "enabled": true,
+ "rotary": [
+ {
+ "pin_a": "GP27",
+ "pin_b": "GP28",
+ "resolution": 2
+ },
+ {
+ "pin_a": "GP4",
+ "pin_b": "GP3",
+ "resolution": 2
+ },
+ {
+ "pin_a": "GP1",
+ "pin_b": "GP2",
+ "resolution": 2
+ }
+ ]
+ },
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ { "label":"Mute", "x": 0, "y": 0, "matrix": [0, 0] },
+ { "label":"RGB", "x": 0, "y": 1, "matrix": [0, 1] },
+ { "label":"Animation", "x": 0, "y": 2, "matrix": [0, 2] }
+ ]
+ }
+ },
+ "usb": {
+ "device_version": "1.0.0",
+ "pid": "0x9A25",
+ "vid": "0xFEED"
+ }
+}
diff --git a/keyboards/anavi/knobs3/keymaps/default/keymap.c b/keyboards/anavi/knobs3/keymaps/default/keymap.c
new file mode 100644
index 0000000000..e5eaa2f1e1
--- /dev/null
+++ b/keyboards/anavi/knobs3/keymaps/default/keymap.c
@@ -0,0 +1,10 @@
+// Copyright 2022 Leon Anavi <leon@anavi.org>
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT(
+ KC_MUTE, RGB_TOG, RGB_MOD
+ )
+};
diff --git a/keyboards/anavi/knobs3/knobs3.c b/keyboards/anavi/knobs3/knobs3.c
new file mode 100644
index 0000000000..efae010163
--- /dev/null
+++ b/keyboards/anavi/knobs3/knobs3.c
@@ -0,0 +1,73 @@
+// Copyright 2022 Leon Anavi <leon@anavi.org>
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "quantum.h"
+#include <stdio.h>
+
+void keyboard_post_init_kb(void) {
+ // Enable RGB LED
+ setPinOutput(GP11);
+ writePinHigh(GP11);
+ rgblight_enable();
+
+ // Offload to the user func
+ keyboard_post_init_user();
+}
+
+#ifdef ENCODER_ENABLE
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+ if (!encoder_update_user(index, clockwise)) { return false; }
+ if (0 == index) {
+ if (clockwise) {
+ tap_code(KC_VOLU);
+ } else {
+ tap_code(KC_VOLD);
+ }
+ } else if (1 == index) {
+ if (clockwise) {
+ tap_code(KC_UP);
+ } else {
+ tap_code(KC_DOWN);
+ }
+ } else if (2 == index) {
+ if (clockwise) {
+ tap_code(KC_LEFT);
+ } else {
+ tap_code(KC_RIGHT);
+ }
+ }
+ return true;
+}
+#endif
+
+#ifdef OLED_ENABLE
+
+bool oled_task_kb(void) {
+
+ if (!oled_task_user()) {
+ return false;
+ }
+
+ // Host Keyboard Layer Status
+ oled_write_ln_P(PSTR("ANAVI Knobs 3"), false);
+ oled_write_ln_P(PSTR("Keymap: Default"), false);
+
+ // Host Keyboard LED Status
+ led_t led_state = host_keyboard_led_state();
+ oled_write_P(PSTR("Num Lock: "), false);
+ oled_write_ln_P(led_state.num_lock ? PSTR("On") : PSTR("Off"), false);
+ oled_write_P(PSTR("Caps Lock: "), false);
+ oled_write_ln_P(led_state.caps_lock ? PSTR("On") : PSTR("Off"), false);
+ oled_write_P(PSTR("Scroll Lock: "), false);
+ oled_write_ln_P(led_state.scroll_lock ? PSTR("On") : PSTR("Off"), false);
+#ifdef RGBLIGHT_ENABLE
+ static char rgbStatusLine1[26] = {0};
+ snprintf(rgbStatusLine1, sizeof(rgbStatusLine1), "RGB Mode: %d", rgblight_get_mode());
+ oled_write_ln(rgbStatusLine1, false);
+ static char rgbStatusLine2[26] = {0};
+ snprintf(rgbStatusLine2, sizeof(rgbStatusLine2), "h:%d s:%d v:%d", rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val());
+ oled_write_ln(rgbStatusLine2, false);
+#endif
+ return false;
+}
+#endif
diff --git a/keyboards/anavi/knobs3/mcuconf.h b/keyboards/anavi/knobs3/mcuconf.h
new file mode 100644
index 0000000000..eb1c98372f
--- /dev/null
+++ b/keyboards/anavi/knobs3/mcuconf.h
@@ -0,0 +1,12 @@
+// Copyright 2022 Leon Anavi (@leon-anavi)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include_next <mcuconf.h>
+
+#undef RP_I2C_USE_I2C0
+#define RP_I2C_USE_I2C0 FALSE
+
+#undef RP_I2C_USE_I2C1
+#define RP_I2C_USE_I2C1 TRUE
diff --git a/keyboards/anavi/knobs3/readme.md b/keyboards/anavi/knobs3/readme.md
new file mode 100644
index 0000000000..09d80b72f4
--- /dev/null
+++ b/keyboards/anavi/knobs3/readme.md
@@ -0,0 +1,25 @@
+# ANAVI Knobs 3
+
+Mini mechanical keyboard with 3 clickable rotary encoders, USB-C, RP2040 microcontroller and I2C slot for mini OLED display.
+
+* Keyboard Maintainer: [Leon Anavi](https://github.com/leon-anavi)
+* Hardware Supported: ANAVI Knobs 3
+* Hardware Availability: [Crowd Supply](https://www.crowdsupply.com/anavi-technology/anavi-macro-pad-10), [GitHub repository](https://github.com/AnaviTechnology/anavi-knobs-3)
+
+Make example for this keyboard (after setting up your build environment):
+
+ make anavi/knobs3:default
+
+Flashing example for this keyboard:
+
+ make anavi/knobs3: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 top left key on the left half, or top right key on the right half, and then plug in the USB cable on that keyboard half.
+* **Physical reset button**: Double tap the reset button on the XIAO RP2040.
+* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available.
diff --git a/keyboards/anavi/knobs3/rules.mk b/keyboards/anavi/knobs3/rules.mk
new file mode 100644
index 0000000000..ed8acbe4ac
--- /dev/null
+++ b/keyboards/anavi/knobs3/rules.mk
@@ -0,0 +1,6 @@
+WS2812_DRIVER = vendor
+
+OLED_ENABLE = yes
+OLED_DRIVER = SSD1306 # Enable Support for SSD1306 or SH1106 OLED Displays; Communicating over I2C
+
+OPT_DEFS += -DHAL_USE_I2C=TRUE