Get rid of USB_LED_CAPS_LOCK (#21436)
This commit is contained in:
parent
928e03e8d6
commit
87b11345a5
70 changed files with 214 additions and 226 deletions
|
|
@ -157,11 +157,11 @@ void dynamic_macro_record_end_user(int8_t direction) {
|
|||
// Custom Caps Lock backlight behaviour
|
||||
// ------------------------------------
|
||||
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
bool led_update_user(led_t led_state) {
|
||||
// This exists because I don't like the backlight to turn OFF when the Caps Lock is ON.
|
||||
// That is, this will turn the backlight ON (at half the brightness) when the Caps Lock is ON as well.
|
||||
static bool prev_is_caps_on;
|
||||
bool is_caps_on = IS_LED_ON(usb_led, USB_LED_CAPS_LOCK);
|
||||
bool is_caps_on = led_state.caps_lock;
|
||||
|
||||
if (prev_is_caps_on != is_caps_on) {
|
||||
prev_is_caps_on = is_caps_on;
|
||||
|
|
@ -178,7 +178,7 @@ void led_set_user(uint8_t usb_led) {
|
|||
}
|
||||
|
||||
// Turn on the Pro Micro's on-board LEDs for Caps Lock
|
||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||
if (led_state.caps_lock) {
|
||||
// Set to low
|
||||
setPinOutput(B0);
|
||||
writePinLow(B0);
|
||||
|
|
@ -189,6 +189,7 @@ void led_set_user(uint8_t usb_led) {
|
|||
setPinInput(B0);
|
||||
setPinInput(D5);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Backlight idle timeout feature
|
||||
|
|
|
|||
|
|
@ -35,11 +35,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
)
|
||||
};
|
||||
|
||||
|
||||
|
||||
void led_set_user(uint8_t usb_led){
|
||||
bool led_update_user(led_t led_state){
|
||||
//turn on the Pro Micro's on board LEDs for CAPS LOCK
|
||||
if(IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)){
|
||||
if(led_state.caps_lock){
|
||||
//set led pins to low
|
||||
setPinOutput(B0);
|
||||
writePinLow(B0);
|
||||
|
|
@ -50,4 +48,5 @@ void led_set_user(uint8_t usb_led){
|
|||
setPinInput(B0);
|
||||
setPinInput(D5);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,20 +19,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <stdint.h>
|
||||
#include "led.h"
|
||||
|
||||
|
||||
void led_set(uint8_t usb_led)
|
||||
bool led_update_kb(led_t led_state)
|
||||
{
|
||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
||||
// output low
|
||||
DDRB |= (1<<0);
|
||||
PORTB &= ~(1<<0);
|
||||
DDRD |= (1<<5);
|
||||
PORTD &= ~(1<<5);
|
||||
} else {
|
||||
// Hi-Z
|
||||
DDRB &= ~(1<<0);
|
||||
PORTB &= ~(1<<0);
|
||||
DDRD &= ~(1<<5);
|
||||
PORTD &= ~(1<<5);
|
||||
bool res = led_update_user(led_state);
|
||||
if (res) {
|
||||
if (led_state.caps_lock) {
|
||||
// output low
|
||||
DDRB |= (1<<0);
|
||||
PORTB &= ~(1<<0);
|
||||
DDRD |= (1<<5);
|
||||
PORTD &= ~(1<<5);
|
||||
} else {
|
||||
// Hi-Z
|
||||
DDRB &= ~(1<<0);
|
||||
PORTB &= ~(1<<0);
|
||||
DDRD &= ~(1<<5);
|
||||
PORTD &= ~(1<<5);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue