1
0
Fork 0

support LEDs

This commit is contained in:
Gabriel Young 2017-03-19 20:45:10 -07:00
parent a43ae7c92f
commit 7e9ca9a976
2 changed files with 51 additions and 44 deletions

View file

@ -22,7 +22,25 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
}
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
DDRB |= (1<<7);
DDRC |= (1<<5) | (1<<6);
print_dec(usb_led);
if (usb_led & (1<<USB_LED_CAPS_LOCK))
PORTC &= ~(1<<5);
else
PORTC |= (1<<5);
if (usb_led & (1<<USB_LED_NUM_LOCK))
PORTB &= ~(1<<7);
else
PORTB |= (1<<7);
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
PORTC &= ~(1<<6);
else
PORTC |= (1<<6);
led_set_user(usb_led);
}

View file

@ -24,17 +24,6 @@
#include "util.h"
#include "matrix.h"
#define CONFIG_LED_IO \
DDRB |= (1<<7); \
DDRC |= (1<<5) | (1<<6);
#define USB_LED_CAPS_LOCK_ON PORTC &= ~(1<<5)
#define USB_LED_CAPS_LOCK_OFF PORTC |= (1<<5)
#define USB_LED_NUM_LOCK_ON PORTB &= ~(1<<7)
#define USB_LED_NUM_LOCK_OFF PORTB |= (1<<7)
#define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<6)
#define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<6)
#ifndef DEBOUNCING_DELAY
# define DEBOUNCING_DELAY 5
#endif