diff options
author | Drashna Jael're <drashna@live.com> | 2021-06-29 12:23:03 -0700 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2021-06-29 12:24:07 -0700 |
commit | acf2c323e2927f6007b17ded577cf49fd86fec6c (patch) | |
tree | 8334dc5c71e6ab9bf33c76143eac7bb0e60159b0 /keyboards/moonlander/moonlander.c | |
parent | ec7a7beeed3046e9144d4c4ce0ef3b2c4f9e4341 (diff) | |
parent | f55e39e8a2246f6f96fd5d4a84a866e2615cde7b (diff) |
Merge upstream QMK Firmware at '0.12.52~1'
Diffstat (limited to 'keyboards/moonlander/moonlander.c')
-rw-r--r-- | keyboards/moonlander/moonlander.c | 80 |
1 files changed, 37 insertions, 43 deletions
diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c index 42c119c2d9..efc7de85bb 100644 --- a/keyboards/moonlander/moonlander.c +++ b/keyboards/moonlander/moonlander.c @@ -1,36 +1,37 @@ -/* -Copyright 2018 Jack Humbert <jack.humb@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. +/* Copyright 2020 ZSA Technology Labs, Inc <@zsa> + * Copyright 2020 Jack Humbert <jack.humb@gmail.com> + * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * + * 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/>. +*/ -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 "moonlander.h" #ifdef WEBUSB_ENABLE -#include "webusb.h" +# include "webusb.h" #endif keyboard_config_t keyboard_config; bool mcp23018_leds[3] = {0, 0, 0}; -bool is_launching = false; +bool is_launching = false; #ifdef DYNAMIC_MACRO_ENABLE static bool is_dynamic_recording = false; -void dynamic_macro_record_start_user(void) { - is_dynamic_recording = true; -} +void dynamic_macro_record_start_user(void) { is_dynamic_recording = true; } void dynamic_macro_record_end_user(int8_t direction) { is_dynamic_recording = false; @@ -163,8 +164,7 @@ void keyboard_pre_init_kb(void) { writePinLow(B4); writePinLow(B3); - - chThdCreateStatic(waLEDThread, sizeof(waLEDThread), NORMALPRIO-16, LEDThread, NULL); + chThdCreateStatic(waLEDThread, sizeof(waLEDThread), NORMALPRIO - 16, LEDThread, NULL); /* the array is initialized to 0, no need to re-set it here */ // mcp23018_leds[0] = 0; // blue @@ -176,7 +176,7 @@ void keyboard_pre_init_kb(void) { #if !defined(MOONLANDER_USER_LEDS) layer_state_t layer_state_set_kb(layer_state_t state) { - state = layer_state_set_user(state); + state = layer_state_set_user(state); if (is_launching || !keyboard_config.led_level) return state; ML_LED_1(false); @@ -361,7 +361,7 @@ void suspend_power_down_kb(void) { suspend_power_down_user(); } - void suspend_wakeup_init_kb(void) { +void suspend_wakeup_init_kb(void) { rgb_matrix_set_suspend_state(false); suspend_wakeup_init_user(); } @@ -423,13 +423,11 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = LAYOUT_moonlander( // clang-format on #endif - bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch (keycode) { #ifdef WEBUSB_ENABLE case WEBUSB_PAIR: - if (!record->event.pressed && !webusb_state.pairing) - layer_state_set_kb(layer_state); + if (!record->event.pressed && !webusb_state.pairing) layer_state_set_kb(layer_state); break; #endif #if !defined(MOONLANDER_USER_LEDS) @@ -454,27 +452,24 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { case TOGGLE_LAYER_COLOR: if (record->event.pressed) { keyboard_config.disable_layer_led ^= 1; - if (keyboard_config.disable_layer_led) - rgb_matrix_set_color_all(0, 0, 0); + if (keyboard_config.disable_layer_led) rgb_matrix_set_color_all(0, 0, 0); eeconfig_update_kb(keyboard_config.raw); } break; case RGB_TOG: if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - keyboard_config.rgb_matrix_enable = false; - rgb_matrix_set_color_all(0, 0, 0); - } - break; - default: { - rgb_matrix_set_flags(LED_FLAG_ALL); - keyboard_config.rgb_matrix_enable = true; - } - break; - } - eeconfig_update_kb(keyboard_config.raw); + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + keyboard_config.rgb_matrix_enable = false; + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + keyboard_config.rgb_matrix_enable = true; + } break; + } + eeconfig_update_kb(keyboard_config.raw); } return false; #endif @@ -490,7 +485,6 @@ void matrix_init_kb(void) { keyboard_config.led_level_res = 0b11; eeconfig_update_kb(keyboard_config.raw); } - #ifdef RGB_MATRIX_ENABLE if (keyboard_config.rgb_matrix_enable) { rgb_matrix_set_flags(LED_FLAG_ALL); |