]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/knops/mini/keymaps/knops/keymap.c
Fixed various keymaps and the allocation of "key_combos" (#2526)
[qmk_firmware.git] / keyboards / knops / mini / keymaps / knops / keymap.c
1 #include "mini.h"
2
3 /*KNOPS_MISC*/
4
5 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
6
7         /*KNOPS_KEYMAP*/
8
9 };
10
11 void set_led_state(int ledId, bool state) {
12         if(state) {
13                 switch(ledId) {
14                         /* LED 0 to 5 are the leds of each keyswitch. From left to right, top to bottom. These are equal to the numbers in the legends of the default keycaps. */
15                         case 0:
16                                 PORTD |= (1<<7);
17                                 break;
18                         case 1:
19                                 if((PINB & (1 << 7)) != 0) {
20                                         PORTC |= (1<<6);
21                                 } else {
22                                         PORTC |= (1<<7);
23                                 }
24                                 break;
25                         case 2:
26                                 PORTD |= (1<<4);
27                                 break;
28                         case 3:
29                                 PORTE |= (1<<6);
30                                 break;
31                         case 4:
32                                 PORTB |= (1<<4);
33                                 break;
34                         case 5:
35                                 PORTD |= (1<<6);
36                                 break;
37                                 /* LED 6 to 8 are the three layer leds in front of the device from left to right. */
38                         case 6:
39                                 PORTD &= ~(1<<5);
40                                 break;
41                         case 7:
42                                 PORTB |= (1<<6);
43                                 break;
44                         case 8:
45                                 PORTB &= ~(1<<0);
46                                 break;
47                 }
48         } else {
49                 switch(ledId) {
50                         case 0:
51                                 PORTD &= ~(1<<7);
52                                 break;
53                         case 1:
54                                 if((PINB & (1 << 7)) != 0) {
55                                         PORTC &= ~(1<<6);
56                                 } else {
57                                         PORTC &= ~(1<<7);
58                                 }
59                                 break;
60                         case 2:
61                                 PORTD &= ~(1<<4);
62                                 break;
63                         case 3:
64                                 PORTE &= ~(1<<6);
65                                 break;
66                         case 4:
67                                 PORTB &= ~(1<<4);
68                                 break;
69                         case 5:
70                                 PORTD &= ~(1<<6);
71                                 break;
72                         case 6:
73                                 PORTD |= (1<<5);
74                                 break;
75                         case 7:
76                                 PORTB &= ~(1<<6);
77                                 break;
78                         case 8:
79                                 PORTB |= (1<<0);
80                                 break;
81                 }
82         }
83 }
84
85 void led_init_ports() {
86         PORTB |= (1 << 7);
87         DDRB &= ~(1<<7);
88         
89         DDRD |= (1<<7);
90         DDRC |= (1<<6);
91         DDRC |= (1<<7);
92         DDRD |= (1<<4);
93         DDRE |= (1<<6);
94         DDRB |= (1<<4);
95         DDRD |= (1<<6);
96
97         DDRD |= (1<<5);
98         DDRB |= (1<<6);
99         DDRB |= (1<<0);
100 }
101
102 void led_set_layer(int layer) {
103
104         /*KNOPS_SIMPLELED_STATES*/
105
106 }
107
108 void matrix_init_user(void) {
109         led_init_ports();
110         
111         led_set_layer(1);
112         
113         /*KNOPS_INIT*/
114 }
115
116 const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
117         //keyevent_t event = record->event;
118
119         /*KNOPS_MACRO*/
120         return NULL;
121 }
122
123
124 void matrix_scan_user(void) {
125         /*KNOPS_SCAN*/
126 }
127
128 void led_set_user(uint8_t usb_led) {
129
130         /*KNOPS_FUNCTIONALLED_STATES*/
131
132 }
133
134 bool process_record_user (uint16_t keycode, keyrecord_t *record) {
135   
136         /*KNOPS_PROCESS_STATE*/
137
138         return NULL;
139   
140 }
141
142