Migrate crkbd/soundmonster to split common, fix OLED and RGB matrix (#15717)

Co-authored-by: Leo B <leo.the.soundmonster@gmail.com>
This commit is contained in:
Leo Batyuk 2022-01-07 00:49:55 +01:00 committed by GitHub
parent a6ed0e10f3
commit 845529782e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 59 deletions

View File

@ -51,9 +51,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_VAL_STEP 17 #define RGBLIGHT_VAL_STEP 17
#endif #endif
#define OLED_FONT_H "keyboards/crkbd/keymaps/soundmonster/glcdfont.c"
// #define OLED_FONT_WIDTH 5 #ifdef OLED_ENABLE
// #define OLED_FONT_HEIGHT 7 # define SPLIT_LAYER_STATE_ENABLE
# define SPLIT_LED_STATE_ENABLE
# define SPLIT_MODS_ENABLE
# define SPLIT_OLED_ENABLE
# define OLED_FONT_H "keyboards/crkbd/keymaps/soundmonster/glcdfont.c"
# define OLED_TIMEOUT 30000
#endif
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses # define RGB_MATRIX_KEYPRESSES // reacts to keypresses
@ -71,12 +77,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Disable the animations you don't want/need. You will need to disable a good number of these * /* Disable the animations you don't want/need. You will need to disable a good number of these *
* because they take up a lot of space. Disable until you can successfully compile your firmware. */ * because they take up a lot of space. Disable until you can successfully compile your firmware. */
// # undef ENABLE_RGB_MATRIX_ALPHAS_MODS # define ENABLE_RGB_MATRIX_ALPHAS_MODS
# undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN # undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
# undef ENABLE_RGB_MATRIX_BREATHING # undef ENABLE_RGB_MATRIX_BREATHING
// # undef ENABLE_RGB_MATRIX_BAND_SAT # undef ENABLE_RGB_MATRIX_BAND_SAT
# undef ENABLE_RGB_MATRIX_BAND_VAL # undef ENABLE_RGB_MATRIX_BAND_VAL
# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT # define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL # undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT # undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL # undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
@ -85,26 +91,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN # undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN # undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN
# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL # undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
// # undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON # define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
# undef ENABLE_RGB_MATRIX_DUAL_BEACON # undef ENABLE_RGB_MATRIX_DUAL_BEACON
# undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL # undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
# undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL # undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL
# undef ENABLE_RGB_MATRIX_RAINBOW_BEACON # undef ENABLE_RGB_MATRIX_RAINBOW_BEACON
# undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS # undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
// # undef ENABLE_RGB_MATRIX_RAINDROPS # undef ENABLE_RGB_MATRIX_RAINDROPS
# undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS # undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
// # undef ENABLE_RGB_MATRIX_TYPING_HEATMAP # define ENABLE_RGB_MATRIX_TYPING_HEATMAP
// # undef ENABLE_RGB_MATRIX_DIGITAL_RAIN # define ENABLE_RGB_MATRIX_DIGITAL_RAIN
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
// # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
# undef ENABLE_RGB_MATRIX_SPLASH # undef ENABLE_RGB_MATRIX_SPLASH
// # undef ENABLE_RGB_MATRIX_MULTISPLASH # define ENABLE_RGB_MATRIX_MULTISPLASH
# undef ENABLE_RGB_MATRIX_SOLID_SPLASH # undef ENABLE_RGB_MATRIX_SOLID_SPLASH
# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH # undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
#endif #endif

View File

@ -1,3 +1,6 @@
// Copyright 2022 Soundmonster (@soundmonster)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern keymap_config_t keymap_config; extern keymap_config_t keymap_config;
@ -7,10 +10,6 @@ extern keymap_config_t keymap_config;
extern rgblight_config_t rgblight_config; extern rgblight_config_t rgblight_config;
#endif #endif
#ifdef OLED_ENABLE
static uint32_t oled_timer = 0;
#endif
// Each layer gets a name for readability, which is then used in the keymap matrix below. // Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them // Layer names don't all need to be of the same length, obviously, and you can also skip them
@ -278,53 +277,19 @@ void render_layer_state(void) {
} }
} }
void render_status_main(void) {
render_logo();
render_space();
render_layer_state();
render_space();
render_mod_status_gui_alt(get_mods()|get_oneshot_mods());
render_mod_status_ctrl_shift(get_mods()|get_oneshot_mods());
}
void render_status_secondary(void) {
render_logo();
render_space();
render_layer_state();
render_space();
render_mod_status_gui_alt(get_mods()|get_oneshot_mods());
render_mod_status_ctrl_shift(get_mods()|get_oneshot_mods());
}
void suspend_power_down_user() {
oled_off();
}
bool oled_task_user(void) { bool oled_task_user(void) {
if (timer_elapsed32(oled_timer) > 30000) { // Renders the current keyboard state (layers and mods)
oled_off(); render_logo();
return false; render_space();
} render_layer_state();
#ifndef SPLIT_KEYBOARD render_space();
else { oled_on(); } render_mod_status_gui_alt(get_mods()|get_oneshot_mods());
#endif render_mod_status_ctrl_shift(get_mods()|get_oneshot_mods());
if (is_keyboard_master()) {
render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_status_secondary();
}
return false; return false;
} }
#endif #endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
#ifdef OLED_ENABLE
oled_timer = timer_read32();
#endif
// set_timelog();
}
static uint16_t my_colon_timer; static uint16_t my_colon_timer;
switch (keycode) { switch (keycode) {

View File

@ -2,6 +2,7 @@ RGBLIGHT_ENABLE = no
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
MOUSEKEY_ENABLE = no MOUSEKEY_ENABLE = no
NKRO_ENABLE = yes NKRO_ENABLE = yes
OLED_ENABLE = yes OLED_ENABLE = yes
OLED_DRIVER = SSD1306 OLED_DRIVER = SSD1306
LTO_ENABLE = yes