aboutsummaryrefslogtreecommitdiff
path: root/keyboards/crawlpad/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/crawlpad/keymaps/default/keymap.c')
-rwxr-xr-xkeyboards/crawlpad/keymaps/default/keymap.c117
1 files changed, 117 insertions, 0 deletions
diff --git a/keyboards/crawlpad/keymaps/default/keymap.c b/keyboards/crawlpad/keymaps/default/keymap.c
new file mode 100755
index 000000000..49d8bfb1c
--- /dev/null
+++ b/keyboards/crawlpad/keymaps/default/keymap.c
@@ -0,0 +1,117 @@
1#include "../../crawlpad.h"
2
3enum custom_keycodes {
4 BL1 = SAFE_RANGE,
5 BL2,
6 BL3,
7 BL4
8};
9
10const uint8_t LED_PINS[] = LED_ROW_PINS;
11
12const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
13
14KEYMAP(
15 KC_P7, KC_P8, KC_P9, KC_PPLS,
16 KC_P4, KC_P5, KC_P6, KC_PMNS,
17 KC_P1, KC_P2, KC_P3, KC_PAST,
18 MO(1), KC_P0, KC_PDOT, KC_ENT),
19
20KEYMAP(
21 KC_NLCK, BL1, KC_TRNS, KC_PSLS,
22 RESET, BL2, KC_TRNS, KC_TRNS,
23 KC_TRNS, BL3, KC_TRNS, KC_TRNS,
24 KC_TRNS, BL4, KC_TRNS, KC_TRNS),
25
26};
27
28void set_led(int idx, bool enable) {
29 uint8_t pin = LED_PINS[idx];
30 if (enable) {
31 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);
32 } else {
33 /* PORTx &= ~n */
34 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF);
35 }
36}
37
38const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
39 return MACRO_NONE ;
40}
41
42void matrix_init_user(void) {
43 /* set LED row pins to output and low */
44 DDRB |= (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7);
45 PORTB &= ~(1 << 4) & ~(1 << 5) & ~(1 << 6) & ~(1 << 7);
46}
47
48void matrix_scan_user(void) {
49}
50
51bool process_record_user(uint16_t keycode, keyrecord_t *record) {
52 switch (keycode) {
53 case BL1:
54 if (record->event.pressed) {
55 PORTB |= (1 << 4);
56 } else {
57 PORTB &= ~(1 << 4);
58 }
59 return false;
60 case BL2:
61 if (record->event.pressed) {
62 PORTB |= (1 << 5);
63 } else {
64 PORTB &= ~(1 << 5);
65 }
66 return false;
67 case BL3:
68 if (record->event.pressed) {
69 PORTB |= (1 << 6);
70 } else {
71 PORTB &= ~(1 << 6);
72 }
73 return false;
74 case BL4:
75 if (record->event.pressed) {
76 PORTB |= (1 << 7);
77 } else {
78 PORTB &= ~(1 << 7);
79 }
80 return false;
81 }
82 return true;
83}
84
85void led_set_user(uint8_t usb_led) {
86
87 if (usb_led & (1 << USB_LED_NUM_LOCK)) {
88
89 } else {
90
91 }
92
93 if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
94
95 } else {
96
97 }
98
99 if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
100
101 } else {
102
103 }
104
105 if (usb_led & (1 << USB_LED_COMPOSE)) {
106
107 } else {
108
109 }
110
111 if (usb_led & (1 << USB_LED_KANA)) {
112
113 } else {
114
115 }
116
117}