From f4ff225c004702b030f01ea0da98f9e966b7de80 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Fri, 5 Jun 2020 10:48:58 +0300 Subject: [PATCH] [Keyboard] keyboards/anavi: Add ANAVI Macro Pad 8 (#9164) ANAVI Macro Pad 8 is an open source mini mechanical keyboard with 8 keys, backlit, addressable RGB WS2812B LED strip on the back and mini OLED display. Powered by ATmega 32U4 microcontroller and with microUSB connector. Co-authored-by: Drashna Jaelre Co-authored-by: Ryan Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Joel Challis Signed-off-by: Leon Anavi --- keyboards/anavi/macropad8/config.h | 72 ++++++ keyboards/anavi/macropad8/glcdfont.c | 232 ++++++++++++++++++ keyboards/anavi/macropad8/info.json | 12 + .../anavi/macropad8/keymaps/default/keymap.c | 61 +++++ .../anavi/macropad8/keymaps/kodi/keymap.c | 68 +++++ keyboards/anavi/macropad8/macropad8.c | 1 + keyboards/anavi/macropad8/macropad8.h | 11 + keyboards/anavi/macropad8/readme.md | 18 ++ keyboards/anavi/macropad8/rules.mk | 32 +++ 9 files changed, 507 insertions(+) create mode 100644 keyboards/anavi/macropad8/config.h create mode 100644 keyboards/anavi/macropad8/glcdfont.c create mode 100644 keyboards/anavi/macropad8/info.json create mode 100644 keyboards/anavi/macropad8/keymaps/default/keymap.c create mode 100644 keyboards/anavi/macropad8/keymaps/kodi/keymap.c create mode 100644 keyboards/anavi/macropad8/macropad8.c create mode 100644 keyboards/anavi/macropad8/macropad8.h create mode 100644 keyboards/anavi/macropad8/readme.md create mode 100644 keyboards/anavi/macropad8/rules.mk diff --git a/keyboards/anavi/macropad8/config.h b/keyboards/anavi/macropad8/config.h new file mode 100644 index 0000000000..e517d909d8 --- /dev/null +++ b/keyboards/anavi/macropad8/config.h @@ -0,0 +1,72 @@ +/* +Copyright 2020 Leon Anavi + +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 "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x0001 +#define DEVICE_VER 0x0001 +#define MANUFACTURER ANAVI +#define PRODUCT Macro Pad 8 +#define DESCRIPTION 8-key mechanical keyboard/keypad/macropad with backlit, mini OLED display and RGB LED strip + +/* key matrix size */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 4 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * NO_DIODE = switches are directly connected to AVR pins + * +*/ +#define DIRECT_PINS { \ + { D4, F6, B5, E6 }, \ + { F5, F7, B4, C6 } \ +} + +#define BACKLIGHT_PIN D7 +#define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 3 +#define RGBLIGHT_SLEEP + +#define UNUSED_PINS + +/* ws2812B RGB LED */ +#ifdef RGBLIGHT_ENABLE +# define RGB_DI_PIN F4 +# define RGBLIGHT_ANIMATIONS +# define RGBLED_NUM 4 +# define RGBLIGHT_HUE_STEP 10 +# define RGBLIGHT_SAT_STEP 17 +# define RGBLIGHT_VAL_STEP 17 +# define RGBLIGHT_LIMIT_VAL 255 +#endif + +#ifdef OLED_DRIVER_ENABLE +# define OLED_DISPLAY_128X64 +# define OLED_TIMEOUT 60000 +# define OLED_FONT_H "keyboards/anavi/macropad8/glcdfont.c" +#endif diff --git a/keyboards/anavi/macropad8/glcdfont.c b/keyboards/anavi/macropad8/glcdfont.c new file mode 100644 index 0000000000..10ce3b3457 --- /dev/null +++ b/keyboards/anavi/macropad8/glcdfont.c @@ -0,0 +1,232 @@ +#include "progmem.h" + +// Corne 8x6 font with QMK Firmware Logo +// Online editor: https://helixfonteditor.netlify.com/ + +// clang-format off +const unsigned char font[] PROGMEM = { +0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x08, 0x07, 0x03, 0x00, 0x00, +0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, +0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, +0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, +0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, +0x00, 0x80, 0x70, 0x30, 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, 0x49, 0x4D, 0x33, 0x00, +0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, +0x27, 0x45, 0x45, 0x45, 0x39, 0x00, +0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, +0x41, 0x21, 0x11, 0x09, 0x07, 0x00, +0x36, 0x49, 0x49, 0x49, 0x36, 0x00, +0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, +0x00, 0x00, 0x14, 0x00, 0x00, 0x00, +0x00, 0x40, 0x34, 0x00, 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, 0x1C, 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, +0x26, 0x49, 0x49, 0x49, 0x32, 0x00, +0x03, 0x01, 0x7F, 0x01, 0x03, 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, +0x03, 0x04, 0x78, 0x04, 0x03, 0x00, +0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, +0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, +0x02, 0x04, 0x08, 0x10, 0x20, 0x00, +0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, +0x04, 0x02, 0x01, 0x02, 0x04, 0x00, +0x40, 0x40, 0x40, 0x40, 0x40, 0x00, +0x00, 0x03, 0x07, 0x08, 0x00, 0x00, +0x20, 0x54, 0x54, 0x78, 0x40, 0x00, +0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, +0x38, 0x44, 0x44, 0x44, 0x28, 0x00, +0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, +0x38, 0x54, 0x54, 0x54, 0x18, 0x00, +0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, +0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, +0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, +0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, +0x20, 0x40, 0x40, 0x3D, 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, +0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, +0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, +0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, +0x48, 0x54, 0x54, 0x54, 0x24, 0x00, +0x04, 0x04, 0x3F, 0x44, 0x24, 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, +0x4C, 0x90, 0x90, 0x90, 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, +0x02, 0x01, 0x02, 0x04, 0x02, 0x00, +0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, +0xF0, 0xF8, 0xF8, 0x18, 0x00, 0xC0, +0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, +0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, +0x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, +0x00, 0x00, 0x00, 0xE0, 0xE0, 0xC0, +0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, +0x00, 0xE0, 0xE0, 0xC0, 0xC0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, +0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, +0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, +0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, +0xEE, 0xF7, 0xF3, 0x70, 0x20, 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, +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, 0xF8, 0xFC, 0xFE, +0xFF, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0xFF, 0x1F, 0x07, 0x01, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xFF, 0xFF, 0xFF, 0x81, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x81, +0xC3, 0xC3, 0xC3, 0x00, 0x00, 0xFF, +0xFF, 0xFF, 0x81, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x81, 0xFF, 0xFF, +0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00, +0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, +0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, +0x9D, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, +0x1C, 0x9D, 0xDF, 0xDF, 0xDF, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, +0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 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, +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, 0x03, 0x0F, 0x1F, +0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F, +0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x3F, +0x3F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, +0x7F, 0x7C, 0x78, 0x78, 0x38, 0x1C, +0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x03, 0x07, 0x07, +0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +0x03, 0x01, 0x00, 0x00, 0x00, 0x00, +0x01, 0x03, 0x07, 0x07, 0x07, 0x07, +0x07, 0x07, 0x07, 0x07, 0x03, 0x01, +0x00, 0x00, 0x00, 0x07, 0x07, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x07, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x07, 0x07, +0x07, 0x00, 0x00, 0x00, 0x01, 0x03, +0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +0x07, 0x07, 0x03, 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, +}; diff --git a/keyboards/anavi/macropad8/info.json b/keyboards/anavi/macropad8/info.json new file mode 100644 index 0000000000..bcdbb9532e --- /dev/null +++ b/keyboards/anavi/macropad8/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "ANAVI Macro Pad 8", + "url": "", + "maintainer": "leon-anavi", + "width": 4, + "height": 2, + "layouts": { + "LAYOUT_ortho_2x4": { + "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}] + } + } +} diff --git a/keyboards/anavi/macropad8/keymaps/default/keymap.c b/keyboards/anavi/macropad8/keymaps/default/keymap.c new file mode 100644 index 0000000000..8cdf90280d --- /dev/null +++ b/keyboards/anavi/macropad8/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +#include QMK_KEYBOARD_H + +#define _MAIN 0 +#define _FN 1 + +#define KC_X0 LT(_FN, KC_ESC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_MAIN] = LAYOUT_ortho_2x4( + G(KC_D), KC_UP, C(KC_C), C(KC_V), + KC_LEFT, KC_DOWN, KC_RGHT, MO(_FN) + ), + + [_FN] = LAYOUT_ortho_2x4( + RGB_TOG, RGB_MOD, RGB_M_R, RGB_M_SN, + BL_TOGG, BL_STEP, BL_BRTG, _______ + ) +}; + +#ifdef OLED_DRIVER_ENABLE +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_180; // flips the display 180 degrees if offhand +} + +void oled_task_user(void) { + // Host Keyboard Layer Status + oled_write_ln_P(PSTR("ANAVI Macro Pad 8"), false); + oled_write_P(PSTR("Active layer:"), false); + + switch (get_highest_layer(layer_state)) { + case _MAIN: + oled_write_ln_P(PSTR("Main"), false); + break; + case _FN: + oled_write_ln_P(PSTR("FN"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("N/A"), 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); + oled_write_P(PSTR("Backlit: "), false); + oled_write_ln_P(is_backlight_enabled() ? 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 +} +#endif diff --git a/keyboards/anavi/macropad8/keymaps/kodi/keymap.c b/keyboards/anavi/macropad8/keymaps/kodi/keymap.c new file mode 100644 index 0000000000..17b00807e4 --- /dev/null +++ b/keyboards/anavi/macropad8/keymaps/kodi/keymap.c @@ -0,0 +1,68 @@ +#include QMK_KEYBOARD_H + +#define _MAIN 0 +#define _FN 1 + +#define KC_X0 LT(_FN, KC_ESC) + +#ifdef RGBLIGHT_ENABLE +// How long (in ms) to wait between animation steps for the rainbow mode +const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {60, 30, 15}; +// How long (in milliseconds) to wait between animation steps for each of the "Swirling rainbow" animations +const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {20, 10, 4}; +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_MAIN] = LAYOUT_ortho_2x4( + KC_ESC, KC_UP, KC_ENTER, KC_X, + KC_LEFT, KC_DOWN, KC_RIGHT, MO(_FN) + ), + + [_FN] = LAYOUT_ortho_2x4( + RGB_TOG, RGB_MOD, RGB_M_R, RGB_M_SN, + BL_TOGG, BL_STEP, BL_BRTG, _______ + ) +}; + +#ifdef OLED_DRIVER_ENABLE +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_180; // flips the display 180 degrees if offhand +} + +void oled_task_user(void) { + // Host Keyboard Layer Status + oled_write_ln_P(PSTR("ANAVI Macro Pad 8"), false); + oled_write_P(PSTR("Active layer:"), false); + + switch (get_highest_layer(layer_state)) { + case _MAIN: + oled_write_ln_P(PSTR("Main"), false); + break; + case _FN: + oled_write_ln_P(PSTR("FN"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("N/A"), 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); + oled_write_P(PSTR("Backlit: "), false); + oled_write_ln_P(is_backlight_enabled() ? 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 +} +#endif diff --git a/keyboards/anavi/macropad8/macropad8.c b/keyboards/anavi/macropad8/macropad8.c new file mode 100644 index 0000000000..2859cd042d --- /dev/null +++ b/keyboards/anavi/macropad8/macropad8.c @@ -0,0 +1 @@ +#include "macropad8.h" diff --git a/keyboards/anavi/macropad8/macropad8.h b/keyboards/anavi/macropad8/macropad8.h new file mode 100644 index 0000000000..3ebee830d3 --- /dev/null +++ b/keyboards/anavi/macropad8/macropad8.h @@ -0,0 +1,11 @@ +#pragma once + +#include "quantum.h" + +#define LAYOUT_ortho_2x4( \ + k01, k02, k03, k04, \ + k05, k06, k07, k08 \ + ) { \ + { k01, k02, k03, k04 }, \ + { k05, k06, k07, k08 } \ +} diff --git a/keyboards/anavi/macropad8/readme.md b/keyboards/anavi/macropad8/readme.md new file mode 100644 index 0000000000..20af445854 --- /dev/null +++ b/keyboards/anavi/macropad8/readme.md @@ -0,0 +1,18 @@ +# ANAVI Macro Pad 8 + + +ANAVI Macro Pad 8 is an open source mini mechanical keyboard with 8 keys, backlit, addressable RGB WS2812B LED strip on the back and mini OLED display. Powered by ATmega32U4 microcontroller and with microUSB connector. + +* Keyboard Maintainer: [Leon Anavi](https://github.com/leon-anavi) +* Hardware Supported: ANAVI Macro Pad 8 +* Hardware Availability: [PCB Files](https://github.com/AnaviTechnology/anavi-macro-pad-8) + +Make example for this keyboard (after setting up your build environment): + + qmk compile -kb anavi/macropad8 -km default + +Flash to ANAVI Macro Pad 8: + + qmk flash -kb anavi/macropad8 -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). diff --git a/keyboards/anavi/macropad8/rules.mk b/keyboards/anavi/macropad8/rules.mk new file mode 100644 index 0000000000..498c27a209 --- /dev/null +++ b/keyboards/anavi/macropad8/rules.mk @@ -0,0 +1,32 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = yes # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. +OLED_DRIVER_ENABLE = yes # Enable Support for SSD1306 or SH1106 OLED Displays; Communicating over I2C + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend