evil80.c 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "evil80.h"
  2. void matrix_init_kb(void) {
  3. // put your keyboard start-up code here
  4. // runs once when the firmware starts up
  5. led_init_ports();
  6. matrix_init_user();
  7. }
  8. void matrix_scan_kb(void) {
  9. // put your looping keyboard code here
  10. // runs every cycle (a lot)
  11. matrix_scan_user();
  12. }
  13. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  14. // put your per-action keyboard code here
  15. // runs for every action, just before processing by the firmware
  16. return process_record_user(keycode, record);
  17. }
  18. void led_init_ports(void) {
  19. DDRB |= (1<<6) | (1<<7); // OUT
  20. }
  21. void led_set_kb(uint8_t usb_led) {
  22. if (usb_led & (1<<USB_LED_CAPS_LOCK))
  23. {
  24. PORTB |= (1<<6); // HI
  25. }
  26. else
  27. {
  28. PORTB &= ~(1<<6); // LO
  29. }
  30. if (usb_led & (1<<USB_LED_SCROLL_LOCK))
  31. {
  32. PORTB |= (1<<7); // HI
  33. }
  34. else
  35. {
  36. PORTB &= ~(1<<7); // LO
  37. }
  38. led_set_user(usb_led);
  39. }