Migrate led_update_kb implementations to DD (#23985)

This commit is contained in:
Joel Challis 2024-06-25 03:25:05 +01:00 committed by GitHub
parent 751482580e
commit a2176f6a03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 77 additions and 533 deletions

View file

@ -24,6 +24,9 @@
"resync": true
}
},
"indicators": {
"caps_lock": "F7"
},
"matrix_pins": {
"cols": ["B5", "C7", "C6", "F0", "E6", "B7", "D0", "D1", "D2", "D3", "D5", "D4", "D6", "D7", "B4"],
"rows": ["F5", "F6", "F4", "F1", "B0", "B6"]

View file

@ -1,34 +0,0 @@
/*
Copyright 2020 chemicalwill <https://github.com/chemicalwill>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void keyboard_pre_init_kb(void) {
//Sets LED pin as output
gpio_set_pin_output(F7);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
// Caps Lock LED indicator toggling code here
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(F7, led_state.caps_lock);
}
return res;
}

View file

@ -1,34 +0,0 @@
/*
Copyright 2020 chemicalwill <https://github.com/chemicalwill>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void keyboard_pre_init_kb(void) {
//Sets LED pin as output
gpio_set_pin_output(F7);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
// Caps Lock LED indicator toggling code here
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(F7, led_state.caps_lock);
}
return res;
}

View file

@ -1,29 +0,0 @@
/* Copyright 2020 dztech
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void matrix_init_kb(void) {
gpio_set_pin_output(E6);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(E6, !led_state.caps_lock);
}
return res;
}

View file

@ -33,6 +33,10 @@
"pin": "B7",
"levels": 5
},
"indicators": {
"caps_lock": "E6",
"on_state": 0
},
"rgblight": {
"saturation_steps": 8,
"brightness_steps": 8,

View file

@ -15,24 +15,16 @@
*/
#include "quantum.h"
void led_init_ports(void) {
gpio_set_pin_output(E6);
void keyboard_pre_init_kb(void) {
gpio_set_pin_output(B1);
gpio_set_pin_output(D0);
gpio_set_pin_output(D1);
gpio_set_pin_output(F0);
gpio_write_pin_high(E6);
gpio_write_pin_high(B1);
gpio_write_pin_high(D0);
gpio_write_pin_high(D1);
gpio_write_pin_high(F0);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
gpio_write_pin(E6, !led_state.num_lock);
}
return true;
}

View file

@ -23,6 +23,10 @@
"resync": true
}
},
"indicators": {
"num_lock": "E6",
"on_state": 0
},
"matrix_pins": {
"cols": ["B0", "D7", "D6", "D4"],
"rows": ["B3", "C7", "C6", "B6", "B5", "B4"]

View file

@ -1,32 +0,0 @@
/* Copyright 2020 MechMerlin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void keyboard_pre_init_kb(void) {
gpio_set_pin_output(C7);
gpio_set_pin_output(B5);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
gpio_write_pin(C7, led_state.caps_lock);
gpio_write_pin(B5, led_state.scroll_lock);
}
return true;
}

View file

@ -18,6 +18,10 @@
"levels": 6,
"breathing": true
},
"indicators": {
"caps_lock": "C7",
"scroll_lock": "B5"
},
"rgblight": {
"saturation_steps": 8,
"brightness_steps": 8,

View file

@ -1,28 +0,0 @@
/*
Copyright 2020 <me@homedrop.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void matrix_init_kb(void) {
// Initialize indicator LEDs to output
gpio_set_pin_output(F7); // Caps
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(F7, led_state.caps_lock);
}
return res;
}

View file

@ -8,6 +8,9 @@
"pid": "0x0001",
"device_version": "0.0.1"
},
"indicators": {
"caps_lock": "F7"
},
"matrix_pins": {
"cols": ["C7", "B1", "B2", "B3", "B7", "D0", "D1", "D2", "D3", "D5", "D4", "D6", "D7", "B4", "B5"],
"rows": ["F1", "F0", "F6", "F5", "F4"]

View file

@ -30,6 +30,11 @@
"pin": "B7",
"levels": 5
},
"indicators": {
"caps_lock": "E6",
"scroll_lock": "B2",
"on_state": 0
},
"rgblight": {
"saturation_steps": 8,
"brightness_steps": 8,

View file

@ -1,34 +0,0 @@
/* Copyright 2019 MechMerlin
* Edits etc 2020 Flexerm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
gpio_set_pin_output(E6);
gpio_set_pin_output(B2);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
gpio_write_pin(E6, !led_state.caps_lock);
gpio_write_pin(B2, !led_state.scroll_lock);
}
return true;
}

View file

@ -51,18 +51,3 @@ void suspend_wakeup_init_kb(void)
suspend_wakeup_init_user();
}
#endif
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
// gpio_write_pin sets the pin high for 1 and low for 0.
// In this example the pins are inverted, setting
// it low/0 turns it on, and high/1 turns the LED off.
// This behavior depends on whether the LED is between the pin
// and VCC or the pin and GND.
gpio_write_pin(B2, !led_state.num_lock);
gpio_write_pin(C6, !led_state.caps_lock);
gpio_write_pin(B7, !led_state.scroll_lock);
}
return res;
}

View file

@ -65,6 +65,12 @@
"build": {
"lto": true
},
"indicators": {
"caps_lock": "C6",
"num_lock": "B2",
"scroll_lock": "B7",
"on_state": 0
},
"features": {
"bootmagic": true,
"command": false,

View file

@ -33,12 +33,3 @@ __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
gpio_write_pin(D5, layer_state_cmp(state, 1));
return state;
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
// gpio_write_pin sets the pin high for 1 and low for 0.
gpio_write_pin(D4, led_state.caps_lock);
}
return res;
}

View file

@ -23,6 +23,12 @@
"resync": true
}
},
"indicators": {
"caps_lock": "D0",
"num_lock": "D1",
"scroll_lock": "C6",
"on_state": 0
},
"matrix_pins": {
"cols": ["B0", "B1", "B2", "B3", "D2", "D3", "C7", "D5"],
"rows": ["D4", "D7", "B4", "B5", "B6", "F7", "F6", "F5", "F4", "F1", "F0"]

View file

@ -1,5 +1,4 @@
#include "quantum.h"
#include "led.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
@ -11,14 +10,3 @@ void matrix_init_kb(void) {
matrix_init_user();
};
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(D0, !led_state.caps_lock);
gpio_write_pin(D1, !led_state.num_lock);
gpio_write_pin(C6, !led_state.scroll_lock);
}
return res;
}

View file

@ -8,6 +8,11 @@
"pid": "0x0001",
"device_version": "0.0.1"
},
"indicators": {
"caps_lock": "A2",
"num_lock": "A0",
"scroll_lock": "A1"
},
"rgblight": {
"led_count": 50
},

View file

@ -15,24 +15,8 @@
*/
#include "selene.h"
void matrix_init_kb(void){
gpio_set_pin_output(NUM_LOCK_PIN);
gpio_set_pin_output(CAPS_LOCK_PIN);
gpio_set_pin_output(SCROLL_LOCK_PIN);
}
#include "quantum.h"
void keyboard_post_init_user(void) {
rgblight_setrgb(0xff, 0xff, 0xff);
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(NUM_LOCK_PIN, led_state.num_lock);
gpio_write_pin(CAPS_LOCK_PIN, led_state.caps_lock);
gpio_write_pin(SCROLL_LOCK_PIN, led_state.scroll_lock);
}
return res;
}

View file

@ -1,23 +0,0 @@
/* Copyright 2020 Bpendragon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#define NUM_LOCK_PIN A0
#define CAPS_LOCK_PIN A2
#define SCROLL_LOCK_PIN A1

View file

@ -1,38 +0,0 @@
/*
Copyright 2020 DmNosachev
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define NUM_LOCK_LED_PIN B5
#define SCROLL_LOCK_LED_PIN B4
#define CAPS_LOCK_LED_PIN B3
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT

View file

@ -16,6 +16,12 @@
"mousekey": true,
"nkro": false
},
"indicators": {
"caps_lock": "B3",
"num_lock": "B5",
"scroll_lock": "B4",
"on_state": 0
},
"matrix_pins": {
"cols": ["B11", "B10", "B1", "B0", "A7", "A6", "A5", "A4"],
"rows": ["B13", "B14", "B15", "A8", "A9", "A3", "A10", "A1", "A2", "A15", "A0"]

View file

@ -1,39 +0,0 @@
/* Copyright 2020 DmNosachev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void matrix_init_kb(void) {
gpio_set_pin_output(NUM_LOCK_LED_PIN);
gpio_set_pin_output(CAPS_LOCK_LED_PIN);
gpio_set_pin_output(SCROLL_LOCK_LED_PIN);
gpio_write_pin_low(NUM_LOCK_LED_PIN);
gpio_write_pin_low(CAPS_LOCK_LED_PIN);
gpio_write_pin_low(SCROLL_LOCK_LED_PIN);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(NUM_LOCK_LED_PIN, !led_state.num_lock);
gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
gpio_write_pin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock);
}
return res;
}

View file

@ -1,8 +0,0 @@
#include "quantum.h"
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
gpio_write_pin(E6, !led_state.caps_lock);
}
return true;
}

View file

@ -8,6 +8,10 @@
"pid": "0x3938",
"device_version": "0.0.1"
},
"indicators": {
"caps_lock": "E6",
"on_state": 0
},
"rgblight": {
"saturation_steps": 8,
"brightness_steps": 8,

View file

@ -32,6 +32,9 @@
"backlight": {
"pin": "B7"
},
"indicators": {
"caps_lock": "B0"
},
"rgblight": {
"hue_steps": 16,
"saturation_steps": 16,

View file

@ -1,34 +0,0 @@
/* Copyright 2020 Rozakiin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
// Optional override functions below.
// You can leave any or all of these undefined.
// These are only required if you want to perform custom actions.
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
gpio_set_pin_output(B0);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
gpio_write_pin(B0, led_state.caps_lock);
}
return true;
}

View file

@ -1,20 +0,0 @@
/*
Copyright 2020 dsanchezseco
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define LED A0

View file

@ -32,6 +32,10 @@
{"pin_a": "B1", "pin_b": "B0"}
]
},
"indicators": {
"caps_lock": "A0",
"on_state": 0
},
"processor": "atmega32a",
"bootloader": "usbasploader",
"community_layouts": ["ortho_5x15"],

View file

@ -74,7 +74,7 @@ void led_keypress_update(pin_t led_pin, uint16_t keycode, keyrecord_t *record) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Update LED state
led_keypress_update(LED, keycode, record);
led_keypress_update(LED_CAPS_LOCK_PIN, keycode, record);
return true;
}

View file

@ -69,7 +69,7 @@ void led_keypress_update(pin_t led_pin, uint16_t keycode, keyrecord_t *record) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Update LED state
led_keypress_update(LED, keycode, record);
led_keypress_update(LED_CAPS_LOCK_PIN, keycode, record);
return true;
}

View file

@ -1,32 +0,0 @@
/* Copyright 2020 dsanchezseco
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void matrix_init_kb(void) {
// Set our LED pin as output
gpio_set_pin_output(LED);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(LED, !led_state.caps_lock);
}
return res;
}

View file

@ -25,6 +25,10 @@
"backlight": {
"pin": "B5"
},
"indicators": {
"num_lock": "F7",
"on_state": 0
},
"processor": "atmega32u4",
"bootloader": "atmel-dfu",
"community_layouts": ["ortho_5x4", "ortho_6x4", "numpad_5x4", "numpad_6x4"],

View file

@ -18,21 +18,13 @@
void keyboard_pre_init_kb(void) {
// initialize top row leds
gpio_set_pin_output(F7);
gpio_set_pin_output(F6);
gpio_set_pin_output(F5);
// and then turn them off
gpio_write_pin_high(F7);
gpio_write_pin_high(F6);
gpio_write_pin_high(F5);
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(F7, !led_state.num_lock);
}
return res;
keyboard_pre_init_user();
}
layer_state_t layer_state_set_kb(layer_state_t state) {

View file

@ -1,36 +0,0 @@
/*
Copyright 2020 Bryan Ong
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void keyboard_pre_init_kb(void) {
gpio_set_pin_output(D7);
gpio_set_pin_output(D6);
gpio_set_pin_output(D4);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(D7, led_state.num_lock);
gpio_write_pin(D6, led_state.caps_lock);
gpio_write_pin(D4, led_state.scroll_lock);
}
return res;
}

View file

@ -36,6 +36,11 @@
"bootmagic": {
"matrix": [2, 0]
},
"indicators": {
"caps_lock": "D6",
"num_lock": "D7",
"scroll_lock": "D4"
},
"processor": "atmega32u4",
"bootloader": "atmel-dfu",
"community_layouts": ["alice", "alice_split_bs"],

View file

@ -1,37 +0,0 @@
/* Copyright 2020 Yiancar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void keyboard_pre_init_kb(void) {
// Set our LED pins as output
gpio_set_pin_output(B5);
gpio_set_pin_output(C0);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
// gpio_write_pin sets the pin high for 1 and low for 0.
// In this example the pins are inverted, setting
// it low/0 turns it on, and high/1 turns the LED off.
// This behavior depends on whether the LED is between the pin
// and VCC or the pin and GND.
gpio_write_pin(B5, led_state.caps_lock);
gpio_write_pin(C0, led_state.num_lock);
}
return res;
}

View file

@ -19,6 +19,10 @@
"resync": true
}
},
"indicators": {
"caps_lock": "B5",
"num_lock": "C0"
},
"processor": "atmega328p",
"bootloader": "usbasploader",
"layouts": {