diff options
author | fauxpark <fauxpark@gmail.com> | 2019-02-15 15:07:13 +1100 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-02-14 20:07:13 -0800 |
commit | 9e4ac6cf29e6b2ce950135c8f877c95f2d1f1d55 (patch) | |
tree | df6cfe88ce0f51ea5ca7fd6b93aae7eaed67d8a5 /keyboards/clueboard | |
parent | d5bc7fc1575543eb27cffcc465a8f0c4e11b7de7 (diff) |
Migrate fn_actions for default keymaps (#4935)
* Migrate fn_actions for default keymaps
* Rename the Grave/Escape Shift masks
* No need for shift_esc_shift_mask
* Change breaks to return false
* Right align pointers
* Add default case
* Separate cases with empty lines
Diffstat (limited to 'keyboards/clueboard')
-rw-r--r-- | keyboards/clueboard/card/keymaps/default/keymap.c | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/keyboards/clueboard/card/keymaps/default/keymap.c b/keyboards/clueboard/card/keymaps/default/keymap.c index 687343e1b7..0fa1d9d989 100644 --- a/keyboards/clueboard/card/keymaps/default/keymap.c +++ b/keyboards/clueboard/card/keymaps/default/keymap.c @@ -1,12 +1,18 @@ #include QMK_KEYBOARD_H +enum custom_keycodes { + SONG_SU = SAFE_RANGE, + SONG_SC, + SONG_GB +}; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT( RGB_TOG, RGB_SAI, RGB_VAI, \ RGB_HUD, RGB_HUI, \ RGB_MOD, RGB_SAD, RGB_VAD, \ BL_STEP, \ - F(0), F(1), F(2) \ + SONG_SU,SONG_SC,SONG_GB \ ) }; @@ -23,28 +29,6 @@ float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(0), - [1] = ACTION_FUNCTION(1), - [2] = ACTION_FUNCTION(2) -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - if (record->event.pressed) { - switch (id) { - case 0: - PLAY_SONG(tone_startup); - break; - case 1: - PLAY_SONG(music_scale); - break; - case 2: - PLAY_SONG(tone_goodbye); - break; - } - } -}; - void matrix_init_user(void) { } @@ -53,7 +37,31 @@ void matrix_scan_user(void) { } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; + switch (keycode) { + case SONG_SU: + if (record->event.pressed) { + PLAY_SONG(tone_startup); + } + + return false; + + case SONG_SC: + if (record->event.pressed) { + PLAY_SONG(music_scale); + } + + return false; + + case SONG_GB: + if (record->event.pressed) { + PLAY_SONG(tone_goodbye); + } + + return false; + + default: + return true; + } } void led_set_user(uint8_t usb_led) { |