summaryrefslogtreecommitdiff
path: root/keyboards/anavi/macropad8/keymaps/default
diff options
context:
space:
mode:
authorLeon Anavi <leon@anavi.org>2020-06-05 10:48:58 +0300
committerGitHub <noreply@github.com>2020-06-05 00:48:58 -0700
commitf4ff225c004702b030f01ea0da98f9e966b7de80 (patch)
treeb6151a1bc2c23f5232475084a9a71a981e5f156a /keyboards/anavi/macropad8/keymaps/default
parenta68b0ed9a25dcbfd616faabab10a123c3c0710fd (diff)
[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 <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Joel Challis <git@zvecr.com> Signed-off-by: Leon Anavi <leon@anavi.org>
Diffstat (limited to 'keyboards/anavi/macropad8/keymaps/default')
-rw-r--r--keyboards/anavi/macropad8/keymaps/default/keymap.c61
1 files changed, 61 insertions, 0 deletions
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