From 3917fd56395ca7e8b9c830d64e6943b644df5735 Mon Sep 17 00:00:00 2001 From: Dasky <32983009+daskygit@users.noreply.github.com> Date: Wed, 4 Aug 2021 20:10:31 +0100 Subject: [PATCH] [Keyboard] Fix knops keymaps (#13872) --- .../mini/keymaps/default-gsm-newbs/keymap.c | 42 +++---- keyboards/knops/mini/keymaps/default/keymap.c | 106 +++++++++--------- keyboards/knops/mini/keymaps/knops/keymap.c | 12 +- .../knops/mini/keymaps/mverteuil/keymap.c | 2 +- .../rama_works_m6_a/keymaps/knops/keymap.c | 2 +- 5 files changed, 82 insertions(+), 82 deletions(-) diff --git a/keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c b/keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c index 4ac904dc75..3851719f19 100644 --- a/keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c +++ b/keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c @@ -203,27 +203,7 @@ void set_layer_led(int layerId) { } } -void matrix_init_user(void) { - led_init_ports_user(); - - PORTB |= (1 << 7); - DDRB &= ~(1<<7); - - PORTD |= (1<<7); - PORTC |= (1<<6); - PORTC |= (1<<7); - PORTD |= (1<<4); - PORTE |= (1<<6); - PORTB |= (1<<4); - PORTD |= (1<<6); - - set_layer_led(0); -} - -void matrix_scan_user(void) { -} - -void led_init_ports_user() { +void led_init_ports_user(void) { // led voor switch #1 DDRD |= (1<<7); PORTD &= ~(1<<7); @@ -276,6 +256,26 @@ void led_init_ports_user() { //led_set_layer(0); } +void matrix_init_user(void) { + led_init_ports_user(); + + PORTB |= (1 << 7); + DDRB &= ~(1<<7); + + PORTD |= (1<<7); + PORTC |= (1<<6); + PORTC |= (1<<7); + PORTD |= (1<<4); + PORTE |= (1<<6); + PORTB |= (1<<4); + PORTD |= (1<<6); + + set_layer_led(0); +} + +void matrix_scan_user(void) { +} + void led_set_user(uint8_t usb_led) { if (usb_led & (1 << USB_LED_NUM_LOCK)) { diff --git a/keyboards/knops/mini/keymaps/default/keymap.c b/keyboards/knops/mini/keymaps/default/keymap.c index d916aa9d13..ee6a0741ca 100644 --- a/keyboards/knops/mini/keymaps/default/keymap.c +++ b/keyboards/knops/mini/keymaps/default/keymap.c @@ -129,72 +129,52 @@ void set_layer_led(int layerId) { } } -void matrix_init_user(void) { - led_init_ports_user(); - - PORTB |= (1 << 7); - DDRB &= ~(1<<7); - - PORTD |= (1<<7); - PORTC |= (1<<6); - PORTC |= (1<<7); - PORTD |= (1<<4); - PORTE |= (1<<6); - PORTB |= (1<<4); - PORTD |= (1<<6); - - set_layer_led(0); -} - -void matrix_scan_user(void) { -} - -void led_init_ports_user() { +void led_init_ports_user(void) { // led voor switch #1 DDRD |= (1<<7); PORTD &= ~(1<<7); - + // led voor switch #2 DDRC |= (1<<6); DDRC |= (1<<7); PORTC &= ~(1<<6); PORTC &= ~(1<<7); - + // led voor switch #3 DDRD |= (1<<4); PORTD &= ~(1<<4); - + // led voor switch #4 DDRE |= (1<<6); PORTE &= ~(1<<6); - + // led voor switch #5 DDRB |= (1<<4); PORTB &= ~(1<<4); - + // led voor switch #6 DDRD |= (1<<6); PORTD &= ~(1<<6); - + /* DDRD |= (1<<7); PORTD |= (1<<7); - + DDRC |= (1<<6); PORTC |= (1<<6); - + DDRD |= (1<<4); PORTD |= (1<<4); - + DDRE |= (1<<6); PORTE |= (1<<6); - + DDRB |= (1<<4); PORTB |= (1<<4); - + DDRD |= (1<<6); PORTD |= (1<<6); - // */ + // */ DDRD |= (1<<5); DDRB |= (1<<6); @@ -202,42 +182,62 @@ void led_init_ports_user() { //led_set_layer(0); } +void matrix_init_user(void) { + led_init_ports_user(); + + PORTB |= (1 << 7); + DDRB &= ~(1<<7); + + PORTD |= (1<<7); + PORTC |= (1<<6); + PORTC |= (1<<7); + PORTD |= (1<<4); + PORTE |= (1<<6); + PORTB |= (1<<4); + PORTD |= (1<<6); + + set_layer_led(0); +} + +void matrix_scan_user(void) { +} + void led_set_user(uint8_t usb_led) { if (usb_led & (1 << USB_LED_NUM_LOCK)) { - + } else { - + } if (usb_led & (1 << USB_LED_CAPS_LOCK)) { - + } else { - + } if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { - + } else { - + } if (usb_led & (1 << USB_LED_COMPOSE)) { - + } else { - + } if (usb_led & (1 << USB_LED_KANA)) { - + } else { - + } } -/* +/* * NOTE: * * In case you don't understand this coding stuff, please @@ -257,11 +257,11 @@ void led_set_user(uint8_t usb_led) { * | | | | | | | set_switch_led( [1-6], [true/false]); * | 4 | | 5 | | 6 | <--- * |_____| |_____| |_____| -* +* * < 0 > < 1 > < 2 > <--- These front-LEDs are called 'Layer LEDs' * To turn one of them on, use: * set_layer_led( [0-2] ); -* +* */ /* @@ -272,14 +272,14 @@ void led_set_user(uint8_t usb_led) { */ void led_set_layer(int layer) { switch(layer) { - + /** * Here is an example to turn LEDs on and of. By default: * - the LEDs are turned on in layer 0 * - the LEDs are turned off in layer 1 * - the LEDs don't change from state for layer 2 - */ - + */ + case 0: set_layer_led(0); // Turn on only the first/left layer indicator set_switch_led(1, true); @@ -289,7 +289,7 @@ void led_set_layer(int layer) { set_switch_led(5, true); set_switch_led(6, true); break; - + case 1: set_layer_led(1); // Turn on only the second/middle layer indicator set_switch_led(1, false); @@ -299,12 +299,12 @@ void led_set_layer(int layer) { set_switch_led(5, false); set_switch_led(6, false); break; - + case 2: set_layer_led(2); // Turn on only the third/right layer indicator - + // Keep leds for layer two in their current state, since we don't use set_switch_led(SWITCH_ID, TRUE_OR_FALSE) - + break; } } diff --git a/keyboards/knops/mini/keymaps/knops/keymap.c b/keyboards/knops/mini/keymaps/knops/keymap.c index 52360d6a8f..15d9e5bc11 100644 --- a/keyboards/knops/mini/keymaps/knops/keymap.c +++ b/keyboards/knops/mini/keymaps/knops/keymap.c @@ -82,10 +82,10 @@ void set_led_state(int ledId, bool state) { } } -void led_init_ports_user() { +void led_init_ports_user(void) { PORTB |= (1 << 7); DDRB &= ~(1<<7); - + DDRD |= (1<<7); DDRC |= (1<<6); DDRC |= (1<<7); @@ -107,9 +107,9 @@ void led_set_layer(int layer) { void matrix_init_user(void) { led_init_ports_user(); - + led_set_layer(1); - + /*KNOPS_INIT*/ } @@ -132,11 +132,11 @@ void led_set_user(uint8_t usb_led) { } bool process_record_user (uint16_t keycode, keyrecord_t *record) { - + /*KNOPS_PROCESS_STATE*/ return NULL; - + } diff --git a/keyboards/knops/mini/keymaps/mverteuil/keymap.c b/keyboards/knops/mini/keymaps/mverteuil/keymap.c index bd172e7aa8..12afb57da2 100644 --- a/keyboards/knops/mini/keymaps/mverteuil/keymap.c +++ b/keyboards/knops/mini/keymaps/mverteuil/keymap.c @@ -270,7 +270,7 @@ void led_set_layer(int layer) { /* * Prepare all LED ports for output */ -void led_init_ports_user() { +void led_init_ports_user(void) { setPinOutput(D7); // Switch 1 LED setPinOutput(C6); // Switch 2 LED Pin1 setPinOutput(C7); // Switch 2 LED Pin2 diff --git a/keyboards/wilba_tech/rama_works_m6_a/keymaps/knops/keymap.c b/keyboards/wilba_tech/rama_works_m6_a/keymaps/knops/keymap.c index db2167c467..bb2d104ee4 100644 --- a/keyboards/wilba_tech/rama_works_m6_a/keymaps/knops/keymap.c +++ b/keyboards/wilba_tech/rama_works_m6_a/keymaps/knops/keymap.c @@ -60,7 +60,7 @@ void set_led_state(int ledId, bool state) } } -void led_init_ports_user() +void led_init_ports_user(void) { // Switch #1 DDRD |= (1 << 6);