1
0

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
39 changed files with 77 additions and 533 deletions

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;
}