]> git.donarmstrong.com Git - qmk_firmware.git/blob - users/drashna/template.c
[Keyboard] Add QMK configurator JSON for Alice PCB (#6397)
[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 VRSN:
54     if (record->event.pressed) {
55       SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
56     }
57     return false;
58     break;
59   }
60   return process_record_keymap(keycode, record);
61 }
62
63
64 __attribute__ ((weak))
65 layer_state_t layer_state_set_keymap (layer_state_t state) {
66   return state;
67 }
68
69 layer_state_t layer_state_set_user (layer_state_t state) {
70   return layer_state_set_keymap (state);
71 }
72
73
74
75 __attribute__ ((weak))
76 void led_set_keymap(uint8_t usb_led) {}
77
78 void led_set_user(uint8_t usb_led) {
79    led_set_keymap(usb_led);
80 }
81
82
83
84 __attribute__ ((weak))
85 void suspend_power_down_keymap(void) {}
86
87 void suspend_power_down_user(void)
88 {
89     suspend_power_down_keymap();
90 }
91
92
93
94 __attribute__ ((weak))
95 void suspend_wakeup_init_keymap(void) {}
96
97 void suspend_wakeup_init_user(void)
98 {
99   suspend_wakeup_init_keymap();
100   #ifdef KEYBOARD_ergodox_ez
101   wait_ms(10);
102   #endif
103 }
104
105
106
107 __attribute__ ((weak))
108 void startup_keymap(void) {}
109
110 void startup_user (void) {
111   #ifdef RGBLIGHT_ENABLE
112     matrix_init_rgb();
113   #endif //RGBLIGHT_ENABLE
114   startup_keymap();
115 }
116
117
118
119 __attribute__ ((weak))
120 void shutdown_keymap(void) {}
121
122 void shutdown_user (void) {
123   shutdown_keymap();
124 }