retro_refit.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "retro_refit.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. // Disable status LED on KB, enable status LED on Teensy (KB_STATUS = !TEENSY_STATUS)
  7. DDRD |= (1<<6);
  8. PORTD |= (1<<6);
  9. matrix_init_user();
  10. };
  11. void led_set_kb(uint8_t usb_led) {
  12. // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
  13. if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
  14. // output low
  15. DDRD |= (1<<0);
  16. PORTD &= ~(1<<0);
  17. } else {
  18. // Hi-Z
  19. DDRD &= ~(1<<0);
  20. PORTD &= ~(1<<0);
  21. }
  22. if (usb_led & (1<<USB_LED_NUM_LOCK)) {
  23. // output low
  24. DDRD |= (1<<1);
  25. PORTD &= ~(1<<1);
  26. } else {
  27. // Hi-Z
  28. DDRD &= ~(1<<1);
  29. PORTD &= ~(1<<1);
  30. }
  31. if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
  32. // output low
  33. DDRC |= (1<<6);
  34. PORTC &= ~(1<<6);
  35. } else {
  36. // Hi-Z
  37. DDRC &= ~(1<<6);
  38. PORTC &= ~(1<<6);
  39. }
  40. led_set_user(usb_led);
  41. };