From f03aec28fb6932bc8ab0b08a0007116a33419b9a Mon Sep 17 00:00:00 2001 From: Will Winder Date: Sat, 2 Jul 2022 08:07:35 -0400 Subject: [Keyboard] Add Avalanche v4 (#17288) Co-authored-by: Drashna Jaelre --- keyboards/avalanche/v4/keymaps/winder/config.h | 12 +++ keyboards/avalanche/v4/keymaps/winder/images.h | 69 +++++++++++++ keyboards/avalanche/v4/keymaps/winder/keymap.c | 135 +++++++++++++++++++++++++ keyboards/avalanche/v4/keymaps/winder/rules.mk | 1 + 4 files changed, 217 insertions(+) create mode 100644 keyboards/avalanche/v4/keymaps/winder/config.h create mode 100644 keyboards/avalanche/v4/keymaps/winder/images.h create mode 100644 keyboards/avalanche/v4/keymaps/winder/keymap.c create mode 100644 keyboards/avalanche/v4/keymaps/winder/rules.mk (limited to 'keyboards/avalanche/v4/keymaps/winder') diff --git a/keyboards/avalanche/v4/keymaps/winder/config.h b/keyboards/avalanche/v4/keymaps/winder/config.h new file mode 100644 index 0000000000..ca4b822f1b --- /dev/null +++ b/keyboards/avalanche/v4/keymaps/winder/config.h @@ -0,0 +1,12 @@ +// Copyright 2022 Will Winder (@winder) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#undef RGBLIGHT_EFFECT_BREATHING +#undef RGBLIGHT_EFFECT_KNIGHT +#undef RGBLIGHT_EFFECT_SNAKE +#undef RGBLIGHT_EFFECT_CHRISTMAS +#undef RGBLIGHT_EFFECT_RGB_TEST +#undef RGBLIGHT_EFFECT_STATIC_GRADIENT +#undef RGBLIGHT_EFFECT_ALTERNATING diff --git a/keyboards/avalanche/v4/keymaps/winder/images.h b/keyboards/avalanche/v4/keymaps/winder/images.h new file mode 100644 index 0000000000..2202e31574 --- /dev/null +++ b/keyboards/avalanche/v4/keymaps/winder/images.h @@ -0,0 +1,69 @@ +// Copyright 2022 Will Winder (@winder) +// SPDX-License-Identifier: GPL-2.0-or-later + +static const char display [] PROGMEM = { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0x7f, 0x3f, 0x9f, 0xcf, 0x8f, 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0xcf, 0xef, +0xe7, 0xcf, 0x8f, 0x1e, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xf8, 0xf1, 0xe3, 0xf7, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x3f, 0xbf, 0x9f, 0x1f, 0x3f, +0x7b, 0xf0, 0xfe, 0xff, 0xff, 0xfe, 0x7c, 0x78, 0x71, 0x03, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0x3f, 0xff, 0xf3, 0xe3, 0xd7, 0xef, 0xdf, 0x9c, 0x39, 0x73, +0xe7, 0xef, 0xcf, 0xcf, 0xce, 0xe0, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xdf, 0x9f, 0xbf, 0x3f, 0x1f, 0xc8, 0xe1, 0xc7, 0x9f, 0x3f, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0x7f, 0x7f, 0x7f, 0xe7, 0xc7, 0x9f, 0x3f, 0x7d, 0xf0, 0xe3, 0xc7, 0x8f, 0x9f, 0x3e, +0x3c, 0xb8, 0x81, 0xc3, 0xff, 0xff, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xbf, 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xcf, 0xe7, +0xf3, 0xf9, 0x71, 0x03, 0x87, 0x8f, 0x1e, 0x3c, 0x79, 0xf3, 0xee, 0x9d, 0xfb, 0xf3, 0xf7, 0xfe, +0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xe7, 0xf3, +0xf9, 0xfc, 0xf9, 0xf3, 0xe7, 0xcf, 0x9f, 0x3f, 0x7e, 0xfe, 0xfc, 0xfd, 0xf9, 0xf8, 0xf8, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x9f, 0x3f, 0x7f, +0xff, 0xfe, 0xfe, 0xfc, 0xf0, 0xe6, 0xcd, 0x9d, 0x3b, 0x7a, 0xf0, 0xf1, 0xe1, 0xf3, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x47, 0x1f, +0x3d, 0xf9, 0xf9, 0xf3, 0x83, 0x30, 0x78, 0x78, 0x71, 0x23, 0x87, 0xcf, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xe7, 0xef, 0xcf, 0x0e, 0x0c, 0xe1, 0xe3, 0xe7, 0xcf, +0x1f, 0x3e, 0x7e, 0xff, 0xef, 0xe7, 0xf3, 0xf8, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf9, 0xf3, 0xe7, 0xcf, 0x9f, 0x3f, 0x7f, +0x7f, 0x3f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xbf, 0x9f, 0xbf, 0x3f, 0x3b, 0x33, 0x87, 0x8f, 0x9f, 0x3f, 0x7f, 0xff, 0xfe, +0xfc, 0xb9, 0x83, 0xc7, 0xe7, 0xf3, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xbf, 0x9f, 0xcf, 0xc7, 0x33, 0x7f, 0xfe, 0xfc, 0xfc, 0xf9, 0xf8, 0xf6, 0xe7, +0xee, 0xc8, 0x83, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xf9, 0xf9, 0xf9, 0xf9, +0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xf8, 0xfc, +0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x07, 0x73, +0xfb, 0xfb, 0xf3, 0xe7, 0xcf, 0x9f, 0x3f, 0xf8, 0xf0, 0xe7, 0xe7, 0xe7, 0xe7, 0xf0, 0xf8, 0xfd, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x87, 0x33, +0x3b, 0x39, 0x3b, 0x9f, 0x9f, 0x9f, 0x3f, 0x7f, 0xfe, 0xfc, 0xd9, 0xc3, 0xe3, 0xf3, 0xf9, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xdf, 0xdf, 0xdf, 0xbf, 0x7f, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xe7, 0xf3, 0xf9, 0xf8, 0xf1, 0xe3, 0xc7, 0x8f, 0x1f, 0x3e, +0x7c, 0xf9, 0xf3, 0xf3, 0xf3, 0xf3, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf3, 0xf9, 0xfc, 0xbe, 0x9c, 0xc1, 0xe3, 0xe7, 0xcf, +0x1f, 0x3f, 0xff, 0xf3, 0xf3, 0xfb, 0xf8, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xbf, +0xff, 0xff, 0xe7, 0xdb, 0xbb, 0x7b, 0xf7, 0xee, 0xdc, 0xbd, 0xff, 0xf7, 0xf7, 0xf6, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, +0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xf9, 0xfc, +0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, +0xf9, 0xf3, 0xa7, 0xcf, 0xef, 0xff, 0xfc, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; diff --git a/keyboards/avalanche/v4/keymaps/winder/keymap.c b/keyboards/avalanche/v4/keymaps/winder/keymap.c new file mode 100644 index 0000000000..75de2f11a8 --- /dev/null +++ b/keyboards/avalanche/v4/keymaps/winder/keymap.c @@ -0,0 +1,135 @@ +// Copyright 2022 Viatly Volkov (@vlkv) +// SPDX-License-Identifier: GPL-2.0-or-later + +/* +qmk compile -kb avalanche/v4 -km default +qmk flash -kb avalanche/v4 -km default +*/ + +#include QMK_KEYBOARD_H + +enum layer { + _QWERTY, + _LOWER, + _RAISE, +}; + +#define FN_1 MO(_LOWER) +#define FN_2 MO(_RAISE) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_DEL , + KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSPC, + KC_ESC , KC_LCTL, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_UNDS, + KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_DEL , KC_LGUI, /**/ KC_INS , KC_BSPC, KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, + KC_LGUI, KC_LALT, KC_LGUI, FN_1 , KC_ENT , /**/ FN_2 , KC_SPC , KC_BSPC, KC_RALT, KC_RGUI + ), + [_LOWER] = LAYOUT( + _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , + KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_DEL , + _______ , KC_TILD, KC_EXLM, KC_AT , KC_HASH, KC_DLR , KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE, _______, + _______, KC_EQL , KC_MINS, KC_PLUS, KC_LCBR, KC_RCBR, _______, _______, /**/ _______, _______, KC_LBRC, KC_RBRC, KC_SCLN, KC_COLN, KC_BSLS, _______, + _______, _______, _______, _______, _______, /**/ _______, _______, _______, _______, _______ + ), + [_RAISE] = LAYOUT( + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, KC_VOLU, KC_MUTE, XXXXXXX, XXXXXXX, XXXXXXX, + _______, KC_0, KC_1, KC_2, KC_3, KC_BSPC, KC_PGUP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, KC_0, KC_4, KC_5, KC_6, KC_DEL, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, + _______, KC_0, KC_7, KC_8, KC_9, KC_DOT, _______, _______, /**/ _______, _______, KC_PGDN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, _______, _______, /**/ _______, _______, _______, _______, _______ + ), +}; + +#ifdef OLED_ENABLE + +#include "images.h" + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_0; +} + +void shiftright(char* buf, int size, int num) { + for (int i = size-1; i > 0; i--) { + buf[i] >>= 1; + if (buf[i-1] & 0x01) { + buf[i] |= 0x80; + } + } + buf[0] >>= 1; +} + +// right to left, 8 bit vertical strips. +void mask(char* enable) { + char rowenable[3]; + const char* data = display; + int i = 0; + char blockmask[2] = { 0x00, 0x00 }; + + while (i < sizeof(display)) { + if (i % 128 == 0) { + // shift enable-mask right 1 at each row, reinitialize row copy + if (i != 0) { + shiftright(enable, 3, 2); + } + rowenable[0] = enable[0]; + rowenable[1] = enable[1]; + rowenable[2] = enable[2]; + } + + if (i % 8 == 0) { + if (rowenable[2] & 0x01) { + blockmask[1] = 0xff; + } else { + blockmask[1] = 0x00; + } + + if (rowenable[2] & 0x02) { + blockmask[0] = 0xff; + } else { + blockmask[0] = 0x00; + } + shiftright(rowenable, 3, 2); + } + + uint8_t c = pgm_read_byte(data++); + oled_write_raw_byte(c & blockmask[1], i++); + shiftright(blockmask, 2, 1); + } +} + +void setmask(char* mask) { + mask[0] = 0x00; + mask[1] = 0x00; + mask[2] = 0x00; + + uint8_t mod = get_mods() | get_oneshot_mods(); + if (mod & MOD_MASK_CTRL) { + mask[1] |= 0xf0; + } + if (mod & MOD_MASK_ALT) { + mask[1] |= 0x0f; + } + if (mod & MOD_MASK_GUI) { + mask[0] |= 0xf0; + } + + switch (get_highest_layer(layer_state)) { + case _LOWER: + mask[2] |= 0xf0; + break; + case _RAISE: + mask[0] |= 0x0f; + break; + } +} + +bool oled_task_user(void) { + char m[3]; + setmask(m); + mask(m); + return false; +} + +#endif + diff --git a/keyboards/avalanche/v4/keymaps/winder/rules.mk b/keyboards/avalanche/v4/keymaps/winder/rules.mk new file mode 100644 index 0000000000..1e3cebb145 --- /dev/null +++ b/keyboards/avalanche/v4/keymaps/winder/rules.mk @@ -0,0 +1 @@ +RGBLIGHT_ENABLE = yes -- cgit v1.2.3