]> git.donarmstrong.com Git - qmk_firmware.git/blob - users/drashna/template.c
Yet another update to drashna keymaps and userspace (#3787)
[qmk_firmware.git] / users / drashna / template.c
1 #include "template.h"
2
3
4 // Add reconfigurable functions here, for keymap customization
5 // This allows for a global, userspace functions, and continued
6 // customization of the keymap.  Use _keymap instead of _user
7 // functions in the keymaps
8 __attribute__ ((weak))
9 void matrix_init_keymap(void) {}
10
11 // Call user matrix init, then call the keymap's init function
12 void matrix_init_user(void) {
13   matrix_init_keymap();
14 }
15
16
17 __attribute__ ((weak))
18 void matrix_scan_keymap(void) {}
19
20 // No global matrix scan code, so just run keymap's matix
21 // scan function
22 void matrix_scan_user(void) {
23   matrix_scan_keymap();
24 }
25
26
27 __attribute__ ((weak))
28 bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
29   return true;
30 }
31
32 // Defines actions tor my global custom keycodes. Defined in drashna.h file
33 // Then runs the _keymap's recod handier if not processed here,
34 // And use "NEWPLACEHOLDER" for new safe range
35 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
36
37   switch (keycode) {
38   case KC_MAKE:
39     if (!record->event.pressed) {
40       SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
41 #if  (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
42         ":dfu"
43 #elif defined(BOOTLOADER_HALFKAY)
44         ":teensy"
45 #elif defined(BOOTLOADER_CATERINA)
46         ":avrdude"
47 #endif
48         SS_TAP(X_ENTER));
49     }
50     return false;
51     break;
52
53   case EPRM:
54     if (record->event.pressed) {
55       eeconfig_init();
56     }
57     return false;
58     break;
59   case VRSN:
60     if (record->event.pressed) {
61       SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
62     }
63     return false;
64     break;
65   }
66   return process_record_keymap(keycode, record);
67 }
68
69
70 __attribute__ ((weak))
71 uint32_t layer_state_set_keymap (uint32_t state) {
72   return state;
73 }
74
75 uint32_t layer_state_set_user (uint32_t state) {
76   return layer_state_set_keymap (state);
77 }
78
79
80
81 __attribute__ ((weak))
82 void led_set_keymap(uint8_t usb_led) {}
83
84 void led_set_user(uint8_t usb_led) {
85    led_set_keymap(usb_led);
86 }
87
88
89
90 __attribute__ ((weak))
91 void suspend_power_down_keymap(void) {}
92
93 void suspend_power_down_user(void)
94 {
95     suspend_power_down_keymap();
96 }
97
98
99
100 __attribute__ ((weak))
101 void suspend_wakeup_init_keymap(void) {}
102
103 void suspend_wakeup_init_user(void)
104 {
105   suspend_wakeup_init_keymap();
106   #ifdef KEYBOARD_ergodox_ez
107   wait_ms(10);
108   #endif
109 }
110
111
112
113 __attribute__ ((weak))
114 void startup_keymap(void) {}
115
116 void startup_user (void) {
117   #ifdef RGBLIGHT_ENABLE
118     matrix_init_rgb();
119   #endif //RGBLIGHT_ENABLE
120   startup_keymap();
121 }
122
123
124
125 __attribute__ ((weak))
126 void shutdown_keymap(void) {}
127
128 void shutdown_user (void) {
129   shutdown_keymap();
130 }
131