]> git.donarmstrong.com Git - qmk_firmware.git/blob - users/drashna/template.c
027c780e9561b51abdaa12707259b9800ebce056
[qmk_firmware.git] / users / drashna / template.c
1 #include "drashna.h"
2 #include "quantum.h"
3 #include "action.h"
4 #include "version.h"
5
6 // Add reconfigurable functions here, for keymap customization
7 // This allows for a global, userspace functions, and continued
8 // customization of the keymap.  Use _keymap instead of _user
9 // functions in the keymaps
10 __attribute__ ((weak))
11 void matrix_init_keymap(void) {}
12
13 __attribute__ ((weak))
14 void matrix_scan_keymap(void) {}
15
16 __attribute__ ((weak))
17 bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
18   return true;
19 }
20 __attribute__ ((weak))
21 uint32_t layer_state_set_keymap (uint32_t state) {
22   return state;
23 }
24
25 // Call user matrix init, then call the keymap's init function
26 void matrix_init_user(void) {
27   matrix_init_keymap();
28 }
29
30 // No global matrix scan code, so just run keymap's matix
31 // scan function
32 void matrix_scan_user(void) {
33   matrix_scan_keymap();
34 }
35
36
37 // Defines actions tor my global custom keycodes. Defined in drashna.h file
38 // Then runs the _keymap's recod handier if not processed here,
39 // And use "NEWPLACEHOLDER" for new safe range
40 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
41   
42   switch (keycode) {
43   case KC_MAKE:
44     if (!record->event.pressed) {
45       SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
46 #ifndef CATERINA_BOOTLOADER
47       SEND_STRING(":teensy ");
48 #else
49       SEND_STRING(" ");
50 #endif
51       SEND_STRING(SS_TAP(X_ENTER));
52     }
53     return false;
54     break;
55   case KC_RESET:
56     if (!record->event.pressed) {
57       reset_keyboard();
58     }
59     return false;
60     break;
61   case EPRM:
62     if (record->event.pressed) {
63       eeconfig_init();
64     }
65     return false;
66     break;
67   case VRSN:
68     if (record->event.pressed) {
69       SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
70     }
71     return false;
72     break;
73   }
74   return process_record_keymap(keycode, record);
75 }
76
77 // Runs state check and changes underglow color and animation
78 // on layer change, no matter where the change was initiated
79 // Then runs keymap's layer change check
80 uint32_t layer_state_set_user (uint32_t state) {
81   return layer_state_set_keymap (state);
82 }