]> git.donarmstrong.com Git - qmk_firmware.git/blob - users/drashna/template.c
20dbb96d7f043c2e69b6887aaf4bae5ba4ba22cd
[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 __attribute__ ((weak))
25 void led_set_keymap(uint8_t usb_led) {}
26
27 // Call user matrix init, then call the keymap's init function
28 void matrix_init_user(void) {
29   matrix_init_keymap();
30 }
31
32 // No global matrix scan code, so just run keymap's matix
33 // scan function
34 void matrix_scan_user(void) {
35   matrix_scan_keymap();
36 }
37
38
39 // Defines actions tor my global custom keycodes. Defined in drashna.h file
40 // Then runs the _keymap's recod handier if not processed here,
41 // And use "NEWPLACEHOLDER" for new safe range
42 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
43   
44   switch (keycode) {
45   case KC_MAKE:
46     if (!record->event.pressed) {
47       SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
48 #if  (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
49         ":dfu"
50 #elif defined(BOOTLOADER_HALFKAY)
51         ":teensy"
52 #elif defined(BOOTLOADER_CATERINA)
53         ":avrdude"
54 #endif
55         SS_TAP(X_ENTER));
56     }
57     return false;
58     break;
59   case KC_RESET:
60     if (!record->event.pressed) {
61       reset_keyboard();
62     }
63     return false;
64     break;
65   case EPRM:
66     if (record->event.pressed) {
67       eeconfig_init();
68     }
69     return false;
70     break;
71   case VRSN:
72     if (record->event.pressed) {
73       SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
74     }
75     return false;
76     break;
77   }
78   return process_record_keymap(keycode, record);
79 }
80
81 // Runs state check and changes underglow color and animation
82 // on layer change, no matter where the change was initiated
83 // Then runs keymap's layer change check
84 uint32_t layer_state_set_user (uint32_t state) {
85   return layer_state_set_keymap (state);
86 }
87
88 void led_set_user(uint8_t usb_led) {
89    led_set_keymap(usb_led);
90 }