mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-21 07:02:01 +00:00
updates as per @sigprof review plus reformat
This commit is contained in:
parent
e2145f02d3
commit
5c0485da8d
@ -17,12 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
enum layer_names {
|
enum layer_names { _QW = 0, _LWR, _RSE, _ADJ };
|
||||||
_QW = 0,
|
|
||||||
_LWR,
|
|
||||||
_RSE,
|
|
||||||
_ADJ
|
|
||||||
};
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
@ -61,15 +56,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
bool toggle_lwr = false;
|
bool toggle_lwr = false;
|
||||||
bool toggle_rse = false;
|
bool toggle_rse = false;
|
||||||
|
|
||||||
static inline void led_lwr(const bool on){
|
static inline void led_lwr(const bool on) {
|
||||||
#ifdef LED_NUM_LOCK_PIN
|
#ifdef LED_NUM_LOCK_PIN
|
||||||
writePin(LED_NUM_LOCK_PIN, on);
|
writePin(LED_NUM_LOCK_PIN, on);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void led_rse(const bool on){
|
static inline void led_rse(const bool on) {
|
||||||
#ifdef LED_CAPS_LOCK_PIN
|
#ifdef LED_CAPS_LOCK_PIN
|
||||||
writePin(LED_CAPS_LOCK_PIN , on);
|
writePin(LED_CAPS_LOCK_PIN, on);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,31 +74,28 @@ bool led_update_user(led_t led_state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
led_lwr(toggle_lwr);
|
led_lwr(toggle_lwr);
|
||||||
led_rse(toggle_rse);
|
led_rse(toggle_rse);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
switch (keycode) {
|
case (TT(_LWR)):
|
||||||
case(TT(_LWR)):
|
if (!record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
|
||||||
if (!record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
|
// This runs before the TT() handler toggles the layer state, so the current layer state is the opposite of the final one after toggle.
|
||||||
// This runs before the TT() handler toggles the layer state, so the current layer state is the opposite of the final one after toggle.
|
toggle_lwr = !layer_state_is(_LWR);
|
||||||
toggle_lwr = !layer_state_is(_LWR);
|
}
|
||||||
}
|
return true;
|
||||||
return true;
|
break;
|
||||||
break;
|
case (TT(_RSE)):
|
||||||
case(TT(_RSE)):
|
if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
|
||||||
if (record->event.pressed && record->tap.count == TAPPING_TOGGLE){
|
toggle_rse = !layer_state_is(_RSE);
|
||||||
toggle_rse = toggle_rse ? false : true;
|
}
|
||||||
}
|
return true;
|
||||||
return true;
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LWR, _RSE, _ADJ); }
|
||||||
return update_tri_layer_state(state, _LWR, _RSE, _ADJ);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user