keyboards/anavi: Add ANAVI Knob 1 (#18623)

ANAVI Knob 1 is a mini mechanical keyboard with a clickable rotary
encoder, USB-C, RP2040 microcontroller and I2C slot for a display.

Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>

Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
master
Leon Anavi 2022-11-15 18:54:45 +02:00 committed by GitHub
parent c21b77fbd2
commit 7e843d0eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 238 additions and 0 deletions

View File

@ -0,0 +1,34 @@
// Copyright 2022 Leon Anavi <leon@anavi.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "config_common.h"
/* key matrix size */
#define MATRIX_ROWS 1
#define MATRIX_COLS 1
/* Keyboard Matrix Assignments */
// clang-format off
#define DIRECT_PINS { \
{ GP26 } \
}
#define RGBLIGHT_DEFAULT_MODE 9
/* Double tap reset button to enter bootloader */
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
#define I2C_DRIVER I2CD2
#define I2C1_SDA_PIN GP6
#define I2C1_SCL_PIN GP7
#ifdef OLED_ENABLE
# define OLED_DISPLAY_128X64
# define OLED_TIMEOUT 60000
# define OLED_BRIGHTNESS 128
#endif

View File

@ -0,0 +1,60 @@
{
"keyboard_name": "Knob 1",
"manufacturer": "ANAVI",
"url": "https://github.com/AnaviTechnology/anavi-knob-1",
"maintainer": "leon-anavi",
"processor": "RP2040",
"bootloader": "rp2040",
"debounce": 5,
"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
}
]
},
"layouts": {
"LAYOUT_k1": {
"layout": [
{ "label":"Mute", "x": 0, "y": 0 }
]
}
},
"usb": {
"device_version": "1.0.0",
"pid": "0x9A25",
"vid": "0xFEED"
}
}

View File

@ -0,0 +1,16 @@
// Copyright 2022 Leon Anavi <leon@anavi.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
//#include <stdio.h>
enum layer_names {
_BASE
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_k1(
KC_MUTE
)
};

View File

@ -0,0 +1,59 @@
// Copyright 2022 Leon Anavi <leon@anavi.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "encoder.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 (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
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 Knob 1"), 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

View File

@ -0,0 +1,30 @@
/* Copyright 2022 Leon Anavi <leon@anavi.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#define ___ KC_NO
// clang-format off
#define LAYOUT_k1( \
K02 \
) \
{ \
{ K02 } \
}
// clang-format on

View File

@ -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

View File

@ -0,0 +1,21 @@
# ANAVI Knob 1
Mini mechanical keyboard with a clickable rotary encoder, USB-C, RP2040 microcontroller and I2C slot.
* Keyboard Maintainer: [Leon Anavi](https://github.com/leon-anavi)
* Hardware Supported: ANAVI Knob 1
* Hardware Availability: [Crowd Supply](https://www.crowdsupply.com/anavi-technology/anavi-macro-pad-10), [GitHub repository](https://github.com/AnaviTechnology/anavi-knob-1)
Make example for this keyboard (after setting up your build environment):
qmk compile -kb anavi/knob1 -km default
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.

View File

@ -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