stapelberg.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "stapelberg.h"
  2. void matrix_init_kb(void) {
  3. // put your keyboard start-up code here
  4. // runs once when the firmware starts up
  5. // * Set our LED pins as output
  6. DDRF |= (1<<0); // Keypad LED
  7. DDRF |= (1<<1); // ScrLock LED
  8. DDRF |= (1<<2); // NumLock LED
  9. DDRF |= (1<<3); // CapsLock LED
  10. matrix_init_user();
  11. }
  12. void matrix_scan_kb(void) {
  13. // put your looping keyboard code here
  14. // runs every cycle (a lot)
  15. matrix_scan_user();
  16. }
  17. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  18. // put your per-action keyboard code here
  19. // runs for every action, just before processing by the firmware
  20. return process_record_user(keycode, record);
  21. }
  22. void led_init_ports() {
  23. // * Set our LED pins as output
  24. DDRF |= (1<<0); // Keypad LED
  25. DDRF |= (1<<1); // ScrLock LED
  26. DDRF |= (1<<2); // NumLock LED
  27. DDRF |= (1<<3); // CapsLock LED
  28. }
  29. void led_set_kb(uint8_t usb_led) {
  30. if (usb_led & (1<<USB_LED_COMPOSE)) {
  31. PORTF &= ~(1<<0);
  32. } else {
  33. PORTF |= (1<<0);
  34. }
  35. if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
  36. PORTF &= ~(1<<1);
  37. } else {
  38. PORTF |= (1<<1);
  39. }
  40. if (usb_led & (1<<USB_LED_NUM_LOCK)) {
  41. PORTF &= ~(1<<2);
  42. } else {
  43. PORTF |= (1<<2);
  44. }
  45. if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
  46. PORTF &= ~(1<<3);
  47. } else {
  48. PORTF |= (1<<3);
  49. }
  50. }