1 #include QMK_KEYBOARD_H
4 * Copy of knopps mini default May 16,2018
5 * Added comments in code to more easilly understand it.
11 * |_____| |_____| |_____|
15 * |_____| |_____| |_____|
17 * Each Layout row below keys. 1,2,3,4,5,6
19 * Hold 3 when powering on for DFU Program Mode
22 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
29 * |_____| |_____| |_____|
33 * |_____| |_____| |_____|
35 * Button 1 (stop) is Held to activate Layer 3 only while held, User then selects the keymap to change to
38 LT(3, KC_MSTP), KC_VOLU, KC_MPLY, KC_MPRV, KC_VOLD, KC_MNXT),
45 * |_____| |_____| |_____|
48 * Macro5 Macro6 Macro7
49 * |_____| |_____| |_____|
53 LT(3, KC_ESC), M(3), M(4), M(5), M(6), M(7)),
60 * |_____| |_____| |_____|
63 * | 4 | |Macro0 Macro1
64 * |_____| |_____| |_____|
68 LT(3, KC_1), KC_2, KC_3, KC_4, M(0), M(1)),
72 * This Layer does the Layer Selection
75 * |None | |None | | FLash
76 * |_____| |_____| |_____|
81 * |_____| |_____| |_____|
83 * Layers 0,1,2 have Button 1 held to activate this layer. Then press the specific layer to switch to it.
87 KC_TRNS, KC_TRNS, RESET, TO(0), TO(1), TO(2)),
89 // More Layers that can be used, but are not by default
92 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
95 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
98 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
101 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
104 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
107 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
110 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
113 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
116 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
119 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
122 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
125 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
129 // Older way of Macros found here: https://docs.qmk.fm/features/macros
131 const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
132 //keyevent_t event = record->event;
136 if (record->event.pressed) {
139 * Content: tglhf<enter>
141 return MACRO( T(T), T(G), T(L), T(H), T(F), T(ENT), END );
145 if (record->event.pressed) {
148 * Content: tgg<enter>
150 return MACRO( T(T), T(G), T(G), T(ENT), END );
154 if (record->event.pressed) {
157 * Content: Press and hold "no" , type "l", release "no"<enter>
158 * I haven't found what this "NO" key maps to
160 return MACRO( D(NO), T(L), U(NO), END );
164 if (record->event.pressed) {
167 * Content: press/hold LCTRL, type "2", release LCTRL
169 return MACRO( D(LCTL), T(Z), U(LCTL), END );
173 if (record->event.pressed) {
176 * Content: press/hold LCTRL, type "2", release LCTRL
178 return MACRO( D(LCTL), D(LSFT), T(Z), U(LSFT), U(LCTL), END );
182 if (record->event.pressed) {
185 * Content: press/hold LCTRL, type "x", release LCTRL
187 return MACRO( D(LCTL), T(X), U(LCTL), END );
191 if (record->event.pressed) {
194 * Content: press/hold LCTRL, type "c", release LCTRL
196 return MACRO( D(LCTL), T(C), U(LCTL), END );
200 if (record->event.pressed) {
203 * Content: press/hold LCTRL, type "v", release LCTRL
205 return MACRO( D(LCTL), T(V), U(LCTL), END );
214 void set_switch_led(int ledId, bool state) {
221 if((PINB & (1 << 7)) != 0) {
246 if((PINB & (1 << 7)) != 0) {
269 void set_layer_led(int layerId) {
286 void matrix_init_user(void) {
303 void matrix_scan_user(void) {
306 void led_init_ports() {
307 // led voor switch #1
311 // led voor switch #2
317 // led voor switch #3
321 // led voor switch #4
325 // led voor switch #5
329 // led voor switch #6
359 void led_set_user(uint8_t usb_led) {
361 if (usb_led & (1 << USB_LED_NUM_LOCK)) {
367 if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
373 if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
379 if (usb_led & (1 << USB_LED_COMPOSE)) {
385 if (usb_led & (1 << USB_LED_KANA)) {
397 * In case you don't understand this coding stuff, please
398 * feel free to mail me or post something
399 * at the /r/knops subreddit and I will configure the code as
400 * you wish for your needs to make the LEDs do what you want :-).
402 * Contact me at: support@knops.io
405 * Knops Mini LED Numbers:
408 * | 1 | | 2 | | 3 | <---
409 * |_____| |_____| |_____| | These LEDs are called 'Switch LEDs'
410 * _____ _____ _____ |----- To turn on/off these leds, use:
411 * | | | | | | | set_switch_led( [1-6], [true/false]);
412 * | 4 | | 5 | | 6 | <---
413 * |_____| |_____| |_____|
415 * < 0 > < 1 > < 2 > <--- These front-LEDs are called 'Layer LEDs'
416 * To turn one of them on, use:
417 * set_layer_led( [0-2] );
422 * This function led_set_layer gets called when you switch between layers.
423 * It allows you to turn on and off leds for each different layer and do
424 * other cool stuff. Currently the GUI does not have LED support. I am working
425 * on that, but takes time.
427 void led_set_layer(int layer) {
431 * Here is an example to turn LEDs on and of. By default:
432 * - the LEDs are turned on in layer 0
433 * - the LEDs are turned off in layer 1
434 * - the LEDs don't change from state for layer 2
438 set_layer_led(0); // Turn on only the first/left layer indicator
439 set_switch_led(1, true);
440 set_switch_led(2, true);
441 set_switch_led(3, true);
442 set_switch_led(4, true);
443 set_switch_led(5, true);
444 set_switch_led(6, true);
448 set_layer_led(1); // Turn on only the second/middle layer indicator
449 set_switch_led(1, false);
450 set_switch_led(2, false);
451 set_switch_led(3, false);
452 set_switch_led(4, false);
453 set_switch_led(5, false);
454 set_switch_led(6, false);
458 set_layer_led(2); // Turn on only the third/right layer indicator
460 // Keep leds for layer two in their current state, since we don't use set_switch_led(SWITCH_ID, TRUE_OR_FALSE)
466 bool process_record_user (uint16_t keycode, keyrecord_t *record) {
469 if (record->event.pressed) {
474 if (record->event.pressed) {
479 if (record->event.pressed) {