rev2.c 698 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "rev2.h"
  2. #include "led.h"
  3. void matrix_init_kb(void) {
  4. // put your keyboard start-up code here
  5. // runs once when the firmware starts up
  6. matrix_init_user();
  7. led_init_ports();
  8. };
  9. void matrix_scan_kb(void) {
  10. // put your looping keyboard code here
  11. // runs every cycle (a lot)
  12. matrix_scan_user();
  13. };
  14. void led_init_ports(void) {
  15. // * Set our LED pins as output
  16. DDRB &= ~(1<<5);
  17. //Set output high, so the capslock led is off
  18. PORTB |= (1 << 5);
  19. }
  20. void led_set_kb(uint8_t usb_led) {
  21. if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
  22. // Turn capslock on
  23. PORTF |= (1<<5);
  24. } else {
  25. // Turn capslock off
  26. PORTF &= ~(1<<5);
  27. }
  28. led_set_user(usb_led);
  29. }