support LEDs

pull/1168/head
Gabriel Young 8 years ago
parent a43ae7c92f
commit 7e9ca9a976

@ -22,7 +22,25 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
} }
void led_set_kb(uint8_t usb_led) { 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); led_set_user(usb_led);
} }

@ -24,17 +24,6 @@
#include "util.h" #include "util.h"
#include "matrix.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 #ifndef DEBOUNCING_DELAY
# define DEBOUNCING_DELAY 5 # define DEBOUNCING_DELAY 5
#endif #endif

Loading…
Cancel
Save