diff options
-rw-r--r-- | keyboards/crkbd/keymaps/snowe/config.h | 55 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/snowe/keycode_aliases.h | 81 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/snowe/keymap.c | 190 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/snowe/rules.mk | 25 | ||||
-rw-r--r-- | users/snowe/luna.c | 229 | ||||
-rw-r--r-- | users/snowe/luna.h | 31 | ||||
-rw-r--r-- | users/snowe/ocean_dream.c | 555 | ||||
-rw-r--r-- | users/snowe/ocean_dream.h | 103 | ||||
-rw-r--r-- | users/snowe/oled_setup.c | 141 | ||||
-rw-r--r-- | users/snowe/oled_setup.h | 30 | ||||
-rw-r--r-- | users/snowe/readme.md | 10 | ||||
-rw-r--r-- | users/snowe/readme_ocean_dream.md | 258 | ||||
-rw-r--r-- | users/snowe/rules.mk | 27 | ||||
-rw-r--r-- | users/snowe/snowe.h | 43 | ||||
-rw-r--r-- | users/snowe/wrappers.h | 92 |
15 files changed, 1870 insertions, 0 deletions
diff --git a/keyboards/crkbd/keymaps/snowe/config.h b/keyboards/crkbd/keymaps/snowe/config.h new file mode 100644 index 0000000000..b624b589bc --- /dev/null +++ b/keyboards/crkbd/keymaps/snowe/config.h @@ -0,0 +1,55 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert + +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 + +//#define USE_MATRIX_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +#define USE_SERIAL_PD2 + +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 200 + +#define IGNORE_MOD_TAP_INTERRUPT +#undef PERMISSIVE_HOLD + +#ifdef RGBLIGHT_ENABLE + #undef RGBLED_NUM + #define RGBLIGHT_ANIMATIONS + #define RGBLED_NUM 27 + #define RGBLIGHT_LIMIT_VAL 120 + #define RGBLIGHT_HUE_STEP 10 + #define RGBLIGHT_SAT_STEP 17 + #define RGBLIGHT_VAL_STEP 17 +#endif + +#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" + +// fix for me putting alt under A and being a fast typist +#define IGNORE_MOD_TAP_INTERRUPT +//#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY + +#define LAYER_STATE_8BIT
\ No newline at end of file diff --git a/keyboards/crkbd/keymaps/snowe/keycode_aliases.h b/keyboards/crkbd/keymaps/snowe/keycode_aliases.h new file mode 100644 index 0000000000..bd70a79aa5 --- /dev/null +++ b/keyboards/crkbd/keymaps/snowe/keycode_aliases.h @@ -0,0 +1,81 @@ +/* + * Copyright 2020 Drashna Jaelre <@drashna> + * Copyright 2021 Tyler Thrailkill <@snowe/@snowe2010> + * + * 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 + +#define GUI_ESC GUI_T(KC_ESC) +#define CTL_ESC CTL_T(KC_ESC) +#define SH_BKSP SFT_T(KC_BSPC) +#define SP_RAIS LT(_UPPER, KC_SPC) + +#define LOWER MO(_LOWER) +#define RAISE MO(_UPPER) +#define ADJUST MO(_ADJUST) +#define TG_MODS TG(_MODS) +//#define TG_GAME TG(_GAMEPAD) +//#define OS_LWR OSL(_LOWER) +//#define OS_RSE OSL(_UPPER) + +//#define KC_SEC1 KC_SECRET_1 +//#define KC_SEC2 KC_SECRET_2 +//#define KC_SEC3 KC_SECRET_3 +//#define KC_SEC4 KC_SECRET_4 +//#define KC_SEC5 KC_SECRET_5 + +#define QWERTY KC_QWERTY +#define DVORAK KC_DVORAK +#define COLEMAK KC_COLEMAK +#define WORKMAN KC_WORKMAN + +#define KC_RESET RESET +#define KC_RST KC_RESET + +#ifdef SWAP_HANDS_ENABLE +# define KC_C1R3 SH_TT +#else // SWAP_HANDS_ENABLE +# define KC_C1R3 KC_BSPC +#endif // SWAP_HANDS_ENABLE + +#define BK_LWER LT(_LOWER, KC_BSPC) +#define SP_LWER LT(_LOWER, KC_SPC) +#define DL_RAIS LT(_UPPER, KC_DEL) +#define ET_RAIS LT(_UPPER, KC_ENTER) +#define SFT_ENT SFT_T(KC_ENTER) +#define SP_RAIS LT(_UPPER, KC_SPC) + +/* OSM keycodes, to keep things clean and easy to change */ +#define KC_MLSF OSM(MOD_LSFT) +#define KC_MRSF OSM(MOD_RSFT) + +#define OS_LGUI OSM(MOD_LGUI) +#define OS_RGUI OSM(MOD_RGUI) +#define OS_LSFT OSM(MOD_LSFT) +#define OS_RSFT OSM(MOD_RSFT) +#define OS_LCTL OSM(MOD_LCTL) +#define OS_RCTL OSM(MOD_RCTL) +#define OS_LALT OSM(MOD_LALT) +#define OS_RALT OSM(MOD_RALT) +#define OS_MEH OSM(MOD_MEH) +#define OS_HYPR OSM(MOD_HYPR) + +#define ALT_APP ALT_T(KC_APP) + +#define MG_NKRO MAGIC_TOGGLE_NKRO + +#define UC_IRNY UC(0x2E2E) +#define UC_CLUE UC(0x203D) diff --git a/keyboards/crkbd/keymaps/snowe/keymap.c b/keyboards/crkbd/keymaps/snowe/keymap.c new file mode 100644 index 0000000000..4dfd6ecbeb --- /dev/null +++ b/keyboards/crkbd/keymaps/snowe/keymap.c @@ -0,0 +1,190 @@ +/* +Copyright 2019 @foostan +Copyright 2020 Drashna Jaelre <@drashna> +Copyright 2021 Tyler Thrailkill <@snowe/@snowe2010> + +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/>. +*/ + +#include QMK_KEYBOARD_H +#include "snowe.h" + +// Symbols chart +// ↯ hyper key (ctrl, alt, shift, super) +// ⌘ command +// ⌥ option +// ⌃ control +// ⇧ shift +// ⌫ backspace +// ⌦ delete +// ⎋ escape +// ↩ enter + +/* Wrapper + * ,-----------------------------------------------. .-----------------------------------------------. + * | Tab | K01 | K02 | K03 | K04 | K05 | | K06 | K07 | K08 | K09 | K0A | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | ⌘/⎋ | ⌃/K11 | K12 | K13 | K14 | K15 | | K16 | K17 | K18 | K19 | ⌥/K1A | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | ↯/⌦ | ⌥/K21 | K22 | K23 | K24 | K25 | | K26 | K27 | K28 | K29 | ⌃/K2A | | + * `-----------------------. | | .-----------------------' + * |-------+-------+-------| |-------+-------+-------| + * | ⌃ | ⇧/↩ | ⌫/LWR | | ␣/RAY | ␣ | R ⌥ | + * `-----------------------' '-----------------------' + */ +// clang-format off +#define LAYOUT_crkbd_base( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ + ) \ + LAYOUT_wrapper( \ + KC_TAB, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ + GUI_ESC, CTL_T(K11), K12, K13, K14, K15, K16, K17, K18, K19, ALT_T(K1A), KC_QUOT, \ + HYPR_T(KC_DEL), ALT_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), KC_BSLS, \ + KC_LCTL, LOWER, SH_BKSP, KC_ENTER, SP_RAIS, KC_LALT \ + ) +// clang-format on +#define LAYOUT_crkbd_base_wrapper(...) LAYOUT_crkbd_base(__VA_ARGS__) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + // clang-format off + /* QWERTY + * ,-----------------------------------------------. .-----------------------------------------------. + * | | Q | W | E | R | T | | Y | U | I | O | P | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | | A | S | D | F | G | | H | J | K | L | ; | ' | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | | Z | X | C | V | B | | N | M | , | . | / | | + * `-----------------------. | | .-----------------------' + * |-------+-------+-------| |-------+-------+-------| + * | | | | | | | | + * `-----------------------' '-----------------------' + */ + [_MAIN] = LAYOUT_crkbd_base_wrapper( + _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, + _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, + _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ + ), + + /* Lower + * ,-----------------------------------------------. .-----------------------------------------------. + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | | | | | | | | | _ | + | [ | ] | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | | | | | | | | | ← | ↑ | ↓ | → | | + * `-----------------------. | | .-----------------------' + * |-------+-------+-------| |-------+-------+-------| + * | | | | | | | | + * `-----------------------' '-----------------------' + */ + [_LOWER] = LAYOUT_wrapper( + KC_TILDE, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11, + KC_F12 , _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, + _______ , _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, + _______, _______, _______, _______, _______, _______ + ), + + + /* + * ,-----------------------------------------------. .-----------------------------------------------. + * | | | | | | | | | | | | | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | | | | | | | | | | | | | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | | | | | | | | | | | | | | + * `-----------------------. | | .-----------------------' + * |-------+-------+-------| |-------+-------+-------| + * | | | | | | | | + * `-----------------------' '-----------------------' + */ + /* Raise + * ,-----------------------------------------------. .-----------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | | | | | | | | | ← | ↑ | ↓ | → | | + * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------| + * | | | | | | | | | home |pg down| pg up | end | | + * `-----------------------. | | .-----------------------' + * |-------+-------+-------| |-------+-------+-------| + * | | | | | | | | + * `-----------------------' '-----------------------' + */ + [_UPPER] = LAYOUT_wrapper( \ + KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, + _______, _______, _______, _______, _______, _______ + ), + + [_ADJUST] = LAYOUT_wrapper( \ + _______, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET, + _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST, + _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, + _______, _______, _______, _______, _______, _______ + ) + // clang-format on +}; + +layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _UPPER, _ADJUST); } + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_LCTL: + case KC_RCTL: +#ifdef OCEAN_DREAM_ENABLE + is_calm = (record->event.pressed) ? true : false; +#endif +#ifdef LUNA_ENABLE + if (record->event.pressed) { + isSneaking = true; + } else { + isSneaking = false; + } +#endif + break; + case KC_SPC: +#ifdef LUNA_ENABLE + if (record->event.pressed) { + isJumping = true; + showedJump = false; + } else { + isJumping = false; + } +#endif + break; + } + return true; +} + +// uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { +// switch (keycode) { +// case ALT_T(KC_A): +// case SH_BKSP: +// return TAPPING_TERM + 500; +// default: +// return TAPPING_TERM; +// } +//} +// +// bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { +// switch (keycode) { +// case ALT_T(KC_A): +// case SH_BKSP: +// return true; +// default: +// return false; +// } +//}
\ No newline at end of file diff --git a/keyboards/crkbd/keymaps/snowe/rules.mk b/keyboards/crkbd/keymaps/snowe/rules.mk new file mode 100644 index 0000000000..fac462a685 --- /dev/null +++ b/keyboards/crkbd/keymaps/snowe/rules.mk @@ -0,0 +1,25 @@ +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +AUDIO_ENABLE = no # Audio output on port C6 +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. +LEADER_ENABLE = no +MIDI_ENABLE = no # MIDI controls +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +SWAP_HANDS_ENABLE = no # Enable one-hand typing +RGBLIGHT_TWINKLE = no +OLED_DRIVER_ENABLE = yes +RGB_MATRIX_ENABLE = yes + +OCEAN_DREAM_ENABLE = yes +LUNA_ENABLE = no # disabled so travis build succeeds + +# if firmware size over limit, try this option +CFLAGS += -flto + +WPM_ENABLE = yes diff --git a/users/snowe/luna.c b/users/snowe/luna.c new file mode 100644 index 0000000000..4653abfaeb --- /dev/null +++ b/users/snowe/luna.c @@ -0,0 +1,229 @@ +/* + * Copyright 2021 QMK Community + * Copyright 2021 Tyler Thrailkill (@snowe/@snowe2010) <tyler.b.thrailkill@gmail.com> + * + * 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/>. +*/ + +#include "quantum.h" +#include "luna.h" + +// KEYBOARD PET START + +// settings +#define MIN_WALK_SPEED 10 +#define MIN_RUN_SPEED 40 + +// advanced settings +#define ANIM_FRAME_DURATION 200 // how long each frame lasts in ms +#define ANIM_SIZE 96 // number of bytes in array. If you change sprites, minimize for adequate firmware size. max is 1024 + +bool isSneaking = false; +bool isJumping = false; +bool showedJump = true; + +// status variables +int current_wpm = 0; +led_t led_usb_state = { + .num_lock = false, + .caps_lock = false, + .scroll_lock = false +}; + +// current frame +uint8_t current_frame = 0; + +// timers +uint32_t anim_timer = 0; +uint32_t anim_sleep = 0; + +// logic +void render_luna(int LUNA_X, int LUNA_Y) { + + // Sit + static const char PROGMEM sit[2][ANIM_SIZE] = { + // 'sit1', 32x22px + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, + 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x68, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, + 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + + // 'sit2', 32x22px + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, + 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x90, 0x08, 0x18, 0x60, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, + 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + } + }; + + // Walk + static const char PROGMEM walk[2][ANIM_SIZE] = { + // 'walk1', 32x22px + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x90, 0x90, 0x90, 0xa0, 0xc0, 0x80, 0x80, + 0x80, 0x70, 0x08, 0x14, 0x08, 0x90, 0x10, 0x10, 0x08, 0xa4, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0xea, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x03, + 0x06, 0x18, 0x20, 0x20, 0x3c, 0x0c, 0x12, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + + // 'walk2', 32x22px + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x20, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x10, 0x28, 0x10, 0x20, 0x20, 0x20, 0x10, 0x48, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x20, 0xf8, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x30, 0xd5, 0x20, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, + 0x02, 0x1c, 0x14, 0x08, 0x10, 0x20, 0x2c, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } + }; + + // Run + static const char PROGMEM run[2][ANIM_SIZE] = { + // 'run1', 32x22px + { + 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x08, 0xc8, 0xb0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x40, 0x40, 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0xc4, 0xa4, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x58, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x09, 0x04, 0x04, 0x04, 0x04, 0x02, 0x03, 0x02, 0x01, 0x01, + 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + + // 'run2', 32x22px + { + 0x00, 0x00, 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x80, 0x80, 0x78, 0x28, 0x08, 0x10, 0x20, 0x30, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0xb0, 0x50, 0x55, 0x20, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, + 0x02, 0x1e, 0x20, 0x20, 0x18, 0x0c, 0x14, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } + }; + + // Bark + static const char PROGMEM bark[2][ANIM_SIZE] = { + // 'bark1', 32x22px + { + 0x00, 0xc0, 0x20, 0x10, 0xd0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, + 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, + 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + + // 'bark2', 32x22px + { + 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, + 0x40, 0x2c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x20, 0x4a, 0x09, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, + 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } + }; + + // Sneak + static const char PROGMEM sneak[2][ANIM_SIZE] = { + // 'sneak1', 32x22px + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1e, 0x21, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x04, + 0x04, 0x04, 0x03, 0x01, 0x00, 0x00, 0x09, 0x01, 0x80, 0x80, 0xab, 0x04, 0xf8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x02, 0x06, + 0x18, 0x20, 0x20, 0x38, 0x08, 0x10, 0x18, 0x04, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, + }, + + // 'sneak2', 32x22px + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0xa0, 0x20, 0x40, 0x80, 0xc0, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3e, 0x41, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x04, + 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x40, 0x55, 0x82, 0x7c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, 0x04, + 0x18, 0x10, 0x08, 0x10, 0x20, 0x28, 0x34, 0x06, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + } + }; + + // animation + void animation_phase(void) { + + // jump + if (isJumping || !showedJump) { + + // clear + oled_set_cursor(LUNA_X,LUNA_Y +2); + oled_write(" ", false); + + oled_set_cursor(LUNA_X,LUNA_Y -1); + + showedJump = true; + } else { + + // clear + oled_set_cursor(LUNA_X,LUNA_Y -1); + oled_write(" ", false); + + oled_set_cursor(LUNA_X,LUNA_Y); + } + + // switch frame + current_frame = (current_frame + 1) % 2; + + // current status + if(led_usb_state.caps_lock) { + oled_write_raw_P(bark[abs(1 - current_frame)], ANIM_SIZE); + + } else if(isSneaking) { + oled_write_raw_P(sneak[abs(1 - current_frame)], ANIM_SIZE); + + } else if(current_wpm <= MIN_WALK_SPEED) { + oled_write_raw_P(sit[abs(1 - current_frame)], ANIM_SIZE); + + } else if(current_wpm <= MIN_RUN_SPEED) { + oled_write_raw_P(walk[abs(1 - current_frame)], ANIM_SIZE); + + } else { + oled_write_raw_P(run[abs(1 - current_frame)], ANIM_SIZE); + } + } + + // animation timer + if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { + anim_timer = timer_read32(); + current_wpm = get_current_wpm(); + animation_phase(); + } + + // this fixes the screen on and off bug + if (current_wpm > 0) { + oled_on(); + anim_sleep = timer_read32(); + } else if(timer_elapsed32(anim_sleep) > OLED_TIMEOUT) { + oled_off(); + } + +} + +// KEYBOARD PET END
\ No newline at end of file diff --git a/users/snowe/luna.h b/users/snowe/luna.h new file mode 100644 index 0000000000..c96d7a12df --- /dev/null +++ b/users/snowe/luna.h @@ -0,0 +1,31 @@ +/* + * Copyright 2021 QMK Community + * Copyright 2021 Tyler Thrailkill (@snowe/@snowe2010) <tyler.b.thrailkill@gmail.com> + * + * 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 + +extern bool isSneaking; +extern bool isJumping; +extern bool showedJump; + +// status variables +extern led_t led_usb_state; +//extern int current_wpm; + + +void render_luna(int LUNA_X, int LUNA_Y); + diff --git a/users/snowe/ocean_dream.c b/users/snowe/ocean_dream.c new file mode 100644 index 0000000000..2f372628da --- /dev/null +++ b/users/snowe/ocean_dream.c @@ -0,0 +1,555 @@ +/* + * Copyright 2021 Tyler Thrailkill (@snowe/@snowe2010) <tyler.b.thrailkill@gmail.com> + * + * 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/>. + */ + +#include "ocean_dream.h" +#include "quantum.h" +#include "print.h" + +// Calculated Parameters +#define TWINKLE_PROBABILITY_MODULATOR 100 / TWINKLE_PROBABILITY // CALCULATED: Don't Touch +#define TOTAL_STARS STARS_PER_LINE *NUMBER_OF_STAR_LINES // CALCULATED: Don't Touch +#define OCEAN_ANIMATION_MODULATOR NUMBER_OF_FRAMES / OCEAN_ANIMATION_SPEED // CALCULATED: Don't Touch +#define SHOOTING_STAR_ANIMATION_MODULATOR NUMBER_OF_FRAMES / SHOOTING_STAR_ANIMATION_SPEED // CALCULATED: Don't Touch +#define STAR_ANIMATION_MODULATOR NUMBER_OF_FRAMES / STAR_ANIMATION_SPEED // CALCULATED: Don't Touch + +uint8_t animation_counter = 0; // global animation counter. +bool is_calm = false; +uint32_t starry_night_anim_timer = 0; +uint32_t starry_night_anim_sleep = 0; +static int current_wpm = 0; + +static uint8_t increment_counter(uint8_t counter, uint8_t max) { + counter++; + if (counter >= max) { + return 0; + } else { + return counter; + } +} + +#ifdef ENABLE_WAVE +static uint8_t decrement_counter(uint8_t counter, uint8_t max) { + counter--; + if (counter < 0 || counter > max) { + return max; + } else { + return counter; + } +} +#endif + +#ifdef ENABLE_MOON // region +# ifndef STATIC_MOON +uint8_t moon_animation_frame = 0; // keeps track of current moon frame +uint16_t moon_animation_counter = 0; // counts how many frames to wait before animating moon to next frame +# endif + +# ifdef STATIC_MOON +static const char PROGMEM moon[6] = { + 0x18, 0x7E, 0xFF, 0xC3, 0x81, 0x81, +}; +# endif + +# ifndef STATIC_MOON +static const char PROGMEM moon_animation[14][8] = { + // clang-format off + { 0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, }, + { 0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0x42, 0x00, }, + { 0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xC3, 0x00, 0x00, }, + { 0x3C, 0x7E, 0xFF, 0xFF, 0xC3, 0x81, 0x00, 0x00, }, + { 0x3C, 0x7E, 0xFF, 0xC3, 0x81, 0x00, 0x00, 0x00, }, + { 0x3C, 0x7E, 0xC3, 0x81, 0x81, 0x00, 0x00, 0x00, }, + { 0x3C, 0x42, 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, + { 0x00, 0x00, 0x00, 0x00, 0x81, 0x81, 0x42, 0x3C, }, + { 0x00, 0x00, 0x00, 0x81, 0x81, 0xC3, 0x7E, 0x3C, }, + { 0x00, 0x00, 0x00, 0x81, 0xC3, 0xFF, 0x7E, 0x3C, }, + { 0x00, 0x00, 0x81, 0xC3, 0xFF, 0xFF, 0x7E, 0x3C, }, + { 0x00, 0x00, 0xC3, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, }, + { 0x00, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, }, + // clang-format on +}; +# endif + +static void draw_moon(void) { +# ifdef STATIC_MOON + oled_set_cursor(MOON_COLUMN, MOON_LINE); + oled_write_raw_P(moon, 6); +# endif +# ifndef STATIC_MOON + moon_animation_counter = increment_counter(moon_animation_counter, ANIMATE_MOON_EVERY_N_FRAMES); + if (moon_animation_counter == 0) { + moon_animation_frame = increment_counter(moon_animation_frame, 14); + oled_set_cursor(MOON_COLUMN, MOON_LINE); + oled_write_raw_P(moon_animation[moon_animation_frame], 8); + } +# endif +} +#endif // endregion + +#ifdef ENABLE_WAVE // region +uint8_t starry_night_wave_frame_width_counter = 31; +uint8_t rough_waves_frame_counter = 0; + +// clang-format off +static const char PROGMEM ocean_top[8][32] = { + // still ocean + { + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + }, + // small ripples + { + 0x20, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x20, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x20, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x20, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + }, + // level 2 ripples + { + 0x20, 0x60, 0x40, 0x40, 0x20, 0x60, 0x40, 0x40, + 0x20, 0x60, 0x40, 0x40, 0x20, 0x60, 0x40, 0x40, + 0x20, 0x60, 0x40, 0x40, 0x20, 0x60, 0x40, 0x40, + 0x20, 0x60, 0x40, 0x40, 0x20, 0x60, 0x40, 0x40, + }, + // level 3 waves + { + 0x40, 0x20, 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x20, 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x20, 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x20, 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, + }, + { + 0x40, 0x40, 0x20, 0x10, 0x28, 0x50, 0x40, 0x40, + 0x40, 0x40, 0x20, 0x10, 0x28, 0x50, 0x40, 0x40, + 0x40, 0x40, 0x20, 0x10, 0x28, 0x50, 0x40, 0x40, + 0x40, 0x40, 0x20, 0x10, 0x28, 0x50, 0x40, 0x40, + }, + { + 0x40, 0x40, 0x40, 0x20, 0x10, 0x30, 0x70, 0x60, + 0x40, 0x40, 0x40, 0x20, 0x10, 0x30, 0x70, 0x60, + 0x40, 0x40, 0x40, 0x20, 0x10, 0x30, 0x70, 0x60, + 0x40, 0x40, 0x40, 0x20, 0x10, 0x30, 0x70, 0x60, + }, +}; +static const char PROGMEM ocean_bottom[8][32] = { + // still ocean + { + 0x00, 0x40, 0x40, 0x41, 0x01, 0x01, 0x01, 0x21, + 0x20, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, + 0x44, 0x40, 0x40, 0x00, 0x00, 0x08, 0x08, 0x00, + 0x01, 0x01, 0x01, 0x00, 0x40, 0x40, 0x00, 0x00, + }, + // small ripples + { + 0x00, 0x00, 0x40, 0x40, 0x01, 0x01, 0x01, 0x20, + 0x20, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, + 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x01, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, + }, + // level 2 ripples + { + 0x00, 0x00, 0x40, 0x40, 0x01, 0x01, 0x01, 0x20, + 0x20, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, + 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x01, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, + }, + // level 3 waves + { + 0x00, 0x40, 0x40, 0x42, 0x42, 0x03, 0x11, 0x11, + 0x20, 0x20, 0x00, 0x00, 0x08, 0x0C, 0x0C, 0x04, + 0x05, 0x41, 0x41, 0x21, 0x20, 0x00, 0x00, 0x08, + 0x0A, 0x0A, 0x0B, 0x41, 0x41, 0x41, 0x41, 0x00, + }, + { + 0x10, 0x10, 0x00, 0x80, 0x84, 0xC4, 0x02, 0x06, + 0x84, 0x44, 0xC0, 0x80, 0x80, 0x20, 0x20, 0x10, + 0x08, 0x12, 0x91, 0x81, 0x42, 0x40, 0x00, 0x00, + 0x10, 0x12, 0x22, 0x22, 0x24, 0x04, 0x84, 0x80, + }, + { + 0x08, 0x80, 0x80, 0x82, 0x82, 0x03, 0x21, 0x21, + 0x10, 0x10, 0x00, 0x00, 0x04, 0x04, 0x0C, 0x08, + 0x09, 0x41, 0x42, 0x22, 0x20, 0x00, 0x00, 0x08, + 0x0A, 0x0A, 0x0B, 0x41, 0x43, 0x42, 0x42, 0x00, + }, +}; +// c |