*/
#include <avr/io.h>
+#include "stdint.h"
#include "led.h"
+void led_init(void) {
+ // * Set our LED pins as output
+ DDRB |= (1<<6);
+ DDRB |= (1<<7);
+}
-void led_set(uint8_t usb_led)
-{
- if (usb_led & (1<<USB_LED_CAPS_LOCK))
- {
- // Output high.
- DDRB |= (1<<6);
+void led_set_kb(uint8_t usb_led) {
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ // Turn capslock on
PORTB |= (1<<6);
- }
- else
- {
- // Output low.
- DDRB &= ~(1<<6);
+ } else {
+ // Turn capslock off
PORTB &= ~(1<<6);
}
-
- if (usb_led & (1<<USB_LED_SCROLL_LOCK))
- {
- // Output high.
- DDRB |= (1<<7);
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
+ // Turn scrolllock on
PORTB |= (1<<7);
- }
- else
- {
- // Output low.
- DDRB &= ~(1<<7);
+ } else {
+ // Turn scrolllock off
PORTB &= ~(1<<7);
}
}