Skip to content

Commit cb6bb23

Browse files
leon-anavithepappas
authored andcommitted
keyboards/anavi: Add ANAVI Knobs 3 (qmk#18624)
1 parent 56ecd41 commit cb6bb23

File tree

6 files changed

+202
-0
lines changed

6 files changed

+202
-0
lines changed

keyboards/anavi/knobs3/info.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"keyboard_name": "Knobs 3",
3+
"manufacturer": "ANAVI",
4+
"url": "https://github.com/AnaviTechnology/anavi-knobs-3",
5+
"maintainer": "leon-anavi",
6+
"processor": "RP2040",
7+
"bootloader": "rp2040",
8+
"matrix_pins": {
9+
"direct": [
10+
["GP26", "GP29", "GP0"]
11+
]
12+
},
13+
"features": {
14+
"bootmagic": false,
15+
"command": false,
16+
"console": false,
17+
"extrakey": true,
18+
"mousekey": false,
19+
"nkro": true,
20+
"rgblight": true
21+
},
22+
"rgblight": {
23+
"pin": "GP12",
24+
"led_count": 1,
25+
"hue_steps": 10,
26+
"saturation_steps": 17,
27+
"brightness_steps": 17,
28+
"max_brightness": 255,
29+
"animations": {
30+
"alternating": true,
31+
"breathing": true,
32+
"christmas": true,
33+
"knight": true,
34+
"rainbow_mood": true,
35+
"rainbow_swirl": true,
36+
"rgb_test": true,
37+
"snake": true,
38+
"static_gradient": true,
39+
"twinkle": true
40+
}
41+
},
42+
"encoder": {
43+
"enabled": true,
44+
"rotary": [
45+
{
46+
"pin_a": "GP27",
47+
"pin_b": "GP28",
48+
"resolution": 2
49+
},
50+
{
51+
"pin_a": "GP4",
52+
"pin_b": "GP3",
53+
"resolution": 2
54+
},
55+
{
56+
"pin_a": "GP1",
57+
"pin_b": "GP2",
58+
"resolution": 2
59+
}
60+
]
61+
},
62+
"layouts": {
63+
"LAYOUT": {
64+
"layout": [
65+
{ "label":"Mute", "x": 0, "y": 0, "matrix": [0, 0] },
66+
{ "label":"RGB", "x": 0, "y": 1, "matrix": [0, 1] },
67+
{ "label":"Animation", "x": 0, "y": 2, "matrix": [0, 2] }
68+
]
69+
}
70+
},
71+
"usb": {
72+
"device_version": "1.0.0",
73+
"pid": "0x9A25",
74+
"vid": "0xFEED"
75+
}
76+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright 2022 Leon Anavi <[email protected]>
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#include QMK_KEYBOARD_H
5+
6+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7+
[0] = LAYOUT(
8+
KC_MUTE, RGB_TOG, RGB_MOD
9+
)
10+
};

keyboards/anavi/knobs3/knobs3.c

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright 2022 Leon Anavi <[email protected]>
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#include "quantum.h"
5+
#include <stdio.h>
6+
7+
void keyboard_post_init_kb(void) {
8+
// Enable RGB LED
9+
setPinOutput(GP11);
10+
writePinHigh(GP11);
11+
rgblight_enable();
12+
13+
// Offload to the user func
14+
keyboard_post_init_user();
15+
}
16+
17+
#ifdef ENCODER_ENABLE
18+
bool encoder_update_kb(uint8_t index, bool clockwise) {
19+
if (!encoder_update_user(index, clockwise)) { return false; }
20+
if (0 == index) {
21+
if (clockwise) {
22+
tap_code(KC_VOLU);
23+
} else {
24+
tap_code(KC_VOLD);
25+
}
26+
} else if (1 == index) {
27+
if (clockwise) {
28+
tap_code(KC_UP);
29+
} else {
30+
tap_code(KC_DOWN);
31+
}
32+
} else if (2 == index) {
33+
if (clockwise) {
34+
tap_code(KC_LEFT);
35+
} else {
36+
tap_code(KC_RIGHT);
37+
}
38+
}
39+
return true;
40+
}
41+
#endif
42+
43+
#ifdef OLED_ENABLE
44+
45+
bool oled_task_kb(void) {
46+
47+
if (!oled_task_user()) {
48+
return false;
49+
}
50+
51+
// Host Keyboard Layer Status
52+
oled_write_ln_P(PSTR("ANAVI Knobs 3"), false);
53+
oled_write_ln_P(PSTR("Keymap: Default"), false);
54+
55+
// Host Keyboard LED Status
56+
led_t led_state = host_keyboard_led_state();
57+
oled_write_P(PSTR("Num Lock: "), false);
58+
oled_write_ln_P(led_state.num_lock ? PSTR("On") : PSTR("Off"), false);
59+
oled_write_P(PSTR("Caps Lock: "), false);
60+
oled_write_ln_P(led_state.caps_lock ? PSTR("On") : PSTR("Off"), false);
61+
oled_write_P(PSTR("Scroll Lock: "), false);
62+
oled_write_ln_P(led_state.scroll_lock ? PSTR("On") : PSTR("Off"), false);
63+
#ifdef RGBLIGHT_ENABLE
64+
static char rgbStatusLine1[26] = {0};
65+
snprintf(rgbStatusLine1, sizeof(rgbStatusLine1), "RGB Mode: %d", rgblight_get_mode());
66+
oled_write_ln(rgbStatusLine1, false);
67+
static char rgbStatusLine2[26] = {0};
68+
snprintf(rgbStatusLine2, sizeof(rgbStatusLine2), "h:%d s:%d v:%d", rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val());
69+
oled_write_ln(rgbStatusLine2, false);
70+
#endif
71+
return false;
72+
}
73+
#endif

keyboards/anavi/knobs3/mcuconf.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2022 Leon Anavi (@leon-anavi)
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#pragma once
5+
6+
#include_next <mcuconf.h>
7+
8+
#undef RP_I2C_USE_I2C0
9+
#define RP_I2C_USE_I2C0 FALSE
10+
11+
#undef RP_I2C_USE_I2C1
12+
#define RP_I2C_USE_I2C1 TRUE

keyboards/anavi/knobs3/readme.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# ANAVI Knobs 3
2+
3+
Mini mechanical keyboard with 3 clickable rotary encoders, USB-C, RP2040 microcontroller and I2C slot for mini OLED display.
4+
5+
* Keyboard Maintainer: [Leon Anavi](https://github.com/leon-anavi)
6+
* Hardware Supported: ANAVI Knobs 3
7+
* Hardware Availability: [Crowd Supply](https://www.crowdsupply.com/anavi-technology/anavi-macro-pad-10), [GitHub repository](https://github.com/AnaviTechnology/anavi-knobs-3)
8+
9+
Make example for this keyboard (after setting up your build environment):
10+
11+
make anavi/knobs3:default
12+
13+
Flashing example for this keyboard:
14+
15+
make anavi/knobs3:default:flash
16+
17+
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).
18+
19+
## Bootloader
20+
21+
Enter the bootloader in 3 ways:
22+
23+
* **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.
24+
* **Physical reset button**: Double tap the reset button on the XIAO RP2040.
25+
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available.

keyboards/anavi/knobs3/rules.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
WS2812_DRIVER = vendor
2+
3+
OLED_ENABLE = yes
4+
OLED_DRIVER = SSD1306 # Enable Support for SSD1306 or SH1106 OLED Displays; Communicating over I2C
5+
6+
OPT_DEFS += -DHAL_USE_I2C=TRUE

0 commit comments

Comments
 (0)