1
0
Fork 0
forked from forks/qmk_firmware

Migrate led_update_kb implementations to DD (#23980)

This commit is contained in:
Joel Challis 2024-06-22 09:10:12 +01:00 committed by GitHub
parent 35f0a17679
commit 99aa4f5191
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 96 additions and 601 deletions

View file

@ -13,6 +13,11 @@
"extrakey": true, "extrakey": true,
"nkro": true "nkro": true
}, },
"indicators": {
"caps_lock": "D3",
"num_lock": "D5",
"scroll_lock": "D2"
},
"processor": "atmega32u4", "processor": "atmega32u4",
"bootloader": "atmel-dfu", "bootloader": "atmel-dfu",
"diode_direction": "COL2ROW", "diode_direction": "COL2ROW",

View file

@ -16,23 +16,10 @@
#include "quantum.h" #include "quantum.h"
void keyboard_pre_init_user(void) { void keyboard_pre_init_kb(void) {
// Call the keyboard pre init code.
// Set our LED pins as output
gpio_set_pin_output(D5);
gpio_set_pin_output(D3);
gpio_set_pin_output(D2);
gpio_set_pin_output(D1); gpio_set_pin_output(D1);
}
bool led_update_kb(led_t led_state) { keyboard_pre_init_user();
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(D5, led_state.num_lock);
gpio_write_pin(D3, led_state.caps_lock);
gpio_write_pin(D2, led_state.scroll_lock);
}
return res;
} }
layer_state_t layer_state_set_kb(layer_state_t state) { layer_state_t layer_state_set_kb(layer_state_t state) {

View file

@ -22,6 +22,11 @@
"levels": 6, "levels": 6,
"breathing": true "breathing": true
}, },
"indicators": {
"caps_lock": "B3",
"num_lock": "B4",
"scroll_lock": "A15"
},
"rgblight": { "rgblight": {
"led_count": 24, "led_count": 24,
"animations": { "animations": {

View file

@ -69,26 +69,11 @@ bool oled_task_kb(void) {
#else #else
void keyboard_pre_init_kb(void) { void keyboard_pre_init_kb(void) {
// Call the keyboard pre init code.
// Set our LED pins as output
gpio_set_pin_output(B4);
gpio_set_pin_output(B3);
gpio_set_pin_output(A15);
gpio_set_pin_output(A14); gpio_set_pin_output(A14);
keyboard_pre_init_user(); keyboard_pre_init_user();
} }
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
gpio_write_pin(B4, led_state.num_lock);
gpio_write_pin(B3, led_state.caps_lock);
gpio_write_pin(A15, led_state.scroll_lock);
}
return res;
}
layer_state_t layer_state_set_kb(layer_state_t state) { layer_state_t layer_state_set_kb(layer_state_t state) {
switch (get_highest_layer(state)) { switch (get_highest_layer(state)) {
case 1: case 1:

View file

@ -25,6 +25,12 @@
"backlight": { "backlight": {
"pin": "B7" "pin": "B7"
}, },
"indicators": {
"caps_lock": "D6",
"num_lock": "D7",
"scroll_lock": "D4",
"on_state": 0
},
"processor": "atmega32u4", "processor": "atmega32u4",
"bootloader": "atmel-dfu", "bootloader": "atmel-dfu",
"layouts": { "layouts": {

View file

@ -1,39 +0,0 @@
/* Copyright 2019 HELIAR MK
*
* 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_write_pin_high(D7);
gpio_set_pin_output(D6);
gpio_write_pin_high(D6);
gpio_set_pin_output(D4);
gpio_write_pin_high(D4);
}
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)){
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 true;
}

View file

@ -1,34 +0,0 @@
/* Copyright 2020 hineybush
*
* 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(F7);
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
gpio_write_pin(F7, !led_state.num_lock);
}
return true;
}

View file

@ -32,6 +32,10 @@
"pin": "B7", "pin": "B7",
"breathing": true "breathing": true
}, },
"indicators": {
"caps_lock": "F7",
"on_state": 0
},
"processor": "atmega32u4", "processor": "atmega32u4",
"bootloader": "atmel-dfu", "bootloader": "atmel-dfu",
"community_layouts": ["ortho_6x4", "numpad_6x4"], "community_layouts": ["ortho_6x4", "numpad_6x4"],

View file

@ -1,31 +0,0 @@
/* Copyright 2020 hineybush
*
* 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(C6);
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
gpio_write_pin(C6, !led_state.caps_lock);
}
return true;
}

View file

@ -34,6 +34,10 @@
"pin": "B7", "pin": "B7",
"levels": 12 "levels": 12
}, },
"indicators": {
"caps_lock": "C6",
"on_state": 0
},
"rgblight": { "rgblight": {
"saturation_steps": 8, "saturation_steps": 8,
"brightness_steps": 8, "brightness_steps": 8,

View file

@ -15,22 +15,6 @@
*/ */
#include "quantum.h" #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(D5);
gpio_set_pin_output(E6);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
gpio_write_pin(D5, !led_state.caps_lock);
gpio_write_pin(E6, !led_state.scroll_lock);
}
return true;
}
void eeconfig_init_kb(void) { // EEPROM is getting reset! void eeconfig_init_kb(void) { // EEPROM is getting reset!
rgblight_enable(); // Enable RGB by default rgblight_enable(); // Enable RGB by default
rgblight_sethsv(0, 255, 128); // Set default HSV - red hue, full saturation, medium brightness rgblight_sethsv(0, 255, 128); // Set default HSV - red hue, full saturation, medium brightness

View file

@ -35,6 +35,11 @@
"backlight": { "backlight": {
"pin": "B7" "pin": "B7"
}, },
"indicators": {
"caps_lock": "D5",
"scroll_lock": "E6",
"on_state": 0
},
"ws2812": { "ws2812": {
"pin": "D3" "pin": "D3"
}, },

View file

@ -15,22 +15,6 @@
*/ */
#include "quantum.h" #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(D5);
gpio_set_pin_output(E6);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
gpio_write_pin(D5, !led_state.caps_lock);
gpio_write_pin(E6, !led_state.scroll_lock);
}
return true;
}
void eeconfig_init_kb(void) { // EEPROM is getting reset! void eeconfig_init_kb(void) { // EEPROM is getting reset!
rgblight_enable(); // Enable RGB by default rgblight_enable(); // Enable RGB by default
rgblight_sethsv(0, 255, 128); // Set default HSV - red hue, full saturation, medium brightness rgblight_sethsv(0, 255, 128); // Set default HSV - red hue, full saturation, medium brightness

View file

@ -35,6 +35,11 @@
"backlight": { "backlight": {
"pin": "B7" "pin": "B7"
}, },
"indicators": {
"caps_lock": "D5",
"scroll_lock": "E6",
"on_state": 0
},
"rgblight": { "rgblight": {
"saturation_steps": 8, "saturation_steps": 8,
"brightness_steps": 8, "brightness_steps": 8,

View file

@ -33,6 +33,10 @@
"pin": "B7", "pin": "B7",
"breathing": true "breathing": true
}, },
"indicators": {
"caps_lock": "D3",
"scroll_lock": "D5"
},
"rgblight": { "rgblight": {
"saturation_steps": 8, "saturation_steps": 8,
"brightness_steps": 8, "brightness_steps": 8,

View file

@ -1,49 +0,0 @@
/* Copyright 2019 hineybush
*
* 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(D3);
gpio_set_pin_output(D5);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
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(D3, led_state.caps_lock);
gpio_write_pin(D5, led_state.scroll_lock);
}
return res;
return led_update_user(led_state);
}

View file

@ -1,30 +0,0 @@
/* Copyright 2017 Blake C. Lewis
*
* 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(B2);
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(B2, !led_state.caps_lock);
}
return res;
}

View file

@ -27,6 +27,10 @@
"pin": "F5", "pin": "F5",
"levels": 6 "levels": 6
}, },
"indicators": {
"caps_lock": "B2",
"on_state": 0
},
"processor": "atmega32u4", "processor": "atmega32u4",
"bootloader": "atmel-dfu", "bootloader": "atmel-dfu",
"community_layouts": ["60_ansi", "60_ansi_split_bs_rshift", "60_iso", "60_iso_split_bs_rshift"], "community_layouts": ["60_ansi", "60_ansi_split_bs_rshift", "60_iso", "60_iso_split_bs_rshift"],

View file

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

View file

@ -1,42 +0,0 @@
/* Copyright 2020 Mathias Andersson <wraul@dbox.se>
*
* 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"
#define CAPS_PIN B5
#define SCROLL_PIN B6
// 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(CAPS_PIN);
gpio_set_pin_output(SCROLL_PIN);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(CAPS_PIN, led_state.caps_lock);
gpio_write_pin(SCROLL_PIN, led_state.scroll_lock);
}
return res;
}

View file

@ -1,40 +0,0 @@
/**
* cain_re.c
*
Copyright 2020 astro <yuleiz@gmail.com>
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_PIN);
gpio_set_pin_output(CAPS_PIN);
gpio_set_pin_output(SCROLL_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_PIN, led_state.num_lock);
gpio_write_pin(CAPS_PIN, led_state.caps_lock);
gpio_write_pin(SCROLL_PIN, led_state.scroll_lock);
}
return res;
}

View file

@ -1,24 +0,0 @@
/**
* config.h
*
Copyright 2020 astro <yuleiz@gmail.com>
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 CAPS_PIN D3
#define NUM_PIN F7
#define SCROLL_PIN B0

View file

@ -8,6 +8,11 @@
"pid": "0x0106", "pid": "0x0106",
"device_version": "0.0.1" "device_version": "0.0.1"
}, },
"indicators": {
"caps_lock": "D3",
"num_lock": "F7",
"scroll_lock": "B0"
},
"rgblight": { "rgblight": {
"saturation_steps": 8, "saturation_steps": 8,
"brightness_steps": 8, "brightness_steps": 8,

View file

@ -8,6 +8,12 @@
"pid": "0x8712", "pid": "0x8712",
"device_version": "0.0.1" "device_version": "0.0.1"
}, },
"indicators": {
"caps_lock": "C6",
"num_lock": "B1",
"scroll_lock": "B2",
"on_state": 0
},
"rgblight": { "rgblight": {
"saturation_steps": 8, "saturation_steps": 8,
"brightness_steps": 8, "brightness_steps": 8,

View file

@ -1,23 +0,0 @@
/**
* rev2.c
*/
#include "quantum.h"
void matrix_init_kb(void) {
gpio_set_pin_output(C6);
gpio_set_pin_output(B2);
gpio_set_pin_output(B1);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
gpio_write_pin(B1, !led_state.num_lock);
gpio_write_pin(C6, !led_state.caps_lock);
gpio_write_pin(B2, !led_state.scroll_lock);
}
return res;
}

View file

@ -33,6 +33,11 @@
"pin": "B7", "pin": "B7",
"levels": 5 "levels": 5
}, },
"indicators": {
"caps_lock": "B1",
"scroll_lock": "B2",
"on_state": 0
},
"ws2812": { "ws2812": {
"pin": "B0" "pin": "B0"
}, },

View file

@ -1,39 +0,0 @@
/* Copyright 2019 Ryota Goto
*
* 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(B1);
gpio_set_pin_output(B2);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(B1, !led_state.caps_lock);
gpio_write_pin(B2, !led_state.scroll_lock);
}
return res;
}

View file

@ -35,6 +35,12 @@
"levels": 24, "levels": 24,
"breathing": true "breathing": true
}, },
"indicators": {
"caps_lock": "B3",
"num_lock": "A14",
"scroll_lock": "A15",
"on_state": 0
},
"rgblight": { "rgblight": {
"led_count": 24, "led_count": 24,
"animations": { "animations": {

View file

@ -1,35 +0,0 @@
/* Copyright 2020 Ramon Imbao
*
* 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_user(void) {
// Initialize indicator LED pins
gpio_set_pin_output(A14); // Num Lock
gpio_set_pin_output(A15); // Scroll Lock
gpio_set_pin_output(B3); // Caps Lock
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
gpio_write_pin(A14, !led_state.num_lock);
gpio_write_pin(A15, !led_state.scroll_lock);
gpio_write_pin(B3, !led_state.caps_lock);
}
return res;
}

View file

@ -29,6 +29,10 @@
"pin": "B5", "pin": "B5",
"levels": 10 "levels": 10
}, },
"indicators": {
"caps_lock": "B6",
"on_state": 0
},
"rgblight": { "rgblight": {
"led_count": 9, "led_count": 9,
"animations": { "animations": {

View file

@ -1,30 +0,0 @@
/* Copyright 2019
*
* 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(B6);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(B6, !led_state.caps_lock);
}
return res;
}

View file

@ -31,6 +31,12 @@
"backlight": { "backlight": {
"pin": "B7" "pin": "B7"
}, },
"indicators": {
"caps_lock": "D4",
"num_lock": "D3",
"scroll_lock": "D5",
"on_state": 0
},
"processor": "at90usb1286", "processor": "at90usb1286",
"bootloader": "atmel-dfu", "bootloader": "atmel-dfu",
"layouts": { "layouts": {

View file

@ -1,51 +0,0 @@
/* Copyright 2020 Ryota Goto
*
* 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.
#define INDICATOR_NUM D3
#define INDICATOR_CAPS D4
#define INDICATOR_SCR D5
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
// D3 Numlock, D4 Capslock, D5 Scrlock
gpio_set_pin_output(INDICATOR_NUM);
gpio_set_pin_output(INDICATOR_CAPS);
gpio_set_pin_output(INDICATOR_SCR);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
bool res = led_update_user(led_state);
if (res)
{
gpio_write_pin(INDICATOR_NUM, !led_state.num_lock);
gpio_write_pin(INDICATOR_CAPS, !led_state.caps_lock);
gpio_write_pin(INDICATOR_SCR, !led_state.scroll_lock);
}
return res;
}

View file

@ -31,6 +31,11 @@
"levels": 5, "levels": 5,
"breathing": true "breathing": true
}, },
"indicators": {
"caps_lock": "F1",
"num_lock": "F4",
"scroll_lock": "F5"
},
"processor": "atmega32u4", "processor": "atmega32u4",
"bootloader": "atmel-dfu", "bootloader": "atmel-dfu",
"layouts": { "layouts": {

View file

@ -1,31 +0,0 @@
/* Copyright 2019 westfoxtrot
*
* 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"
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(F4, led_state.num_lock);
gpio_write_pin(F1, led_state.caps_lock);
gpio_write_pin(F5, led_state.scroll_lock);
}
return res;
}

View file

@ -33,6 +33,11 @@
"levels": 5, "levels": 5,
"breathing": true "breathing": true
}, },
"indicators": {
"caps_lock": "D5",
"num_lock": "D3",
"scroll_lock": "D2"
},
"rgblight": { "rgblight": {
"hue_steps": 12, "hue_steps": 12,
"saturation_steps": 25, "saturation_steps": 25,

View file

@ -1,31 +0,0 @@
/* Copyright 2019 westfoxtrot
*
* 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"
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(D3, led_state.num_lock);
gpio_write_pin(D5, led_state.caps_lock);
gpio_write_pin(D2, led_state.scroll_lock);
}
return res;
}

View file

@ -17,6 +17,9 @@
"nkro": true, "nkro": true,
"sleep_led": true "sleep_led": true
}, },
"indicators": {
"caps_lock": "B13"
},
"qmk": { "qmk": {
"locking": { "locking": {
"enabled": true, "enabled": true,

View file

@ -2,15 +2,8 @@
void keyboard_pre_init_kb(void) { void keyboard_pre_init_kb(void) {
gpio_set_pin_output(B12); gpio_set_pin_output(B12);
gpio_set_pin_output(B13);
}
bool led_update_kb(led_t led_state) { keyboard_pre_init_user();
bool res = led_update_user(led_state);
if(res) {
gpio_write_pin(B13, led_state.caps_lock);
}
return res;
} }
__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {