Correct capslock led and add new "numlock" led
This commit is contained in:
parent
f3687d4249
commit
6eb4e4ba5d
@ -64,6 +64,9 @@ static void layer_state_set(uint32_t state)
|
|||||||
layer_state = state;
|
layer_state = state;
|
||||||
layer_debug(); dprintln();
|
layer_debug(); dprintln();
|
||||||
clear_keyboard_but_mods(); // To avoid stuck keys
|
clear_keyboard_but_mods(); // To avoid stuck keys
|
||||||
|
#ifdef ON_LAYER_CHANGE
|
||||||
|
layer_change(layer_state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void layer_clear(void)
|
void layer_clear(void)
|
||||||
|
@ -56,6 +56,7 @@ void layer_invert(uint8_t layer);
|
|||||||
void layer_or(uint32_t state);
|
void layer_or(uint32_t state);
|
||||||
void layer_and(uint32_t state);
|
void layer_and(uint32_t state);
|
||||||
void layer_xor(uint32_t state);
|
void layer_xor(uint32_t state);
|
||||||
|
void layer_change(uint32_t state);
|
||||||
#else
|
#else
|
||||||
#define layer_state 0
|
#define layer_state 0
|
||||||
#define layer_clear()
|
#define layer_clear()
|
||||||
@ -68,6 +69,7 @@ void layer_xor(uint32_t state);
|
|||||||
#define layer_and(state)
|
#define layer_and(state)
|
||||||
#define layer_xor(state)
|
#define layer_xor(state)
|
||||||
#define layer_debug()
|
#define layer_debug()
|
||||||
|
#define layer_change(state)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
#include "action_layer.h"
|
||||||
|
|
||||||
|
|
||||||
/* LED pin configration
|
/* LED pin configration
|
||||||
@ -27,12 +28,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
void led_set(uint8_t usb_led)
|
void led_set(uint8_t usb_led)
|
||||||
{
|
{
|
||||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
||||||
// output low
|
// output high
|
||||||
DDRB |= (1<<PB5);
|
DDRB |= (1<<PB5);
|
||||||
PORTB &= ~(1<<PB5);
|
PORTB |= (1<<PB5);
|
||||||
} else {
|
} else {
|
||||||
// Hi-Z
|
// Hi-Z
|
||||||
DDRB &= ~(1<<PB5);
|
DDRB &= ~(1<<PB5);
|
||||||
PORTB &= ~(1<<PB5);
|
PORTB &= ~(1<<PB5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ON_LAYER_CHANGE
|
||||||
|
void layer_change(uint32_t state)
|
||||||
|
{
|
||||||
|
if (state & (1UL<<2)) {
|
||||||
|
// output high
|
||||||
|
DDRB |= (1<<PB7);
|
||||||
|
PORTB |= (1<<PB7);
|
||||||
|
} else {
|
||||||
|
// Hi-Z
|
||||||
|
DDRB &= ~(1<<PB7);
|
||||||
|
PORTB &= ~(1<<PB7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user