cospad.c 825 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "cospad.h"
  2. #include "led.h"
  3. extern inline void cospad_bl_led_on(void);
  4. extern inline void cospad_bl_led_off(void);
  5. extern inline void cospad_bl_led_togg(void);
  6. void matrix_init_kb(void) {
  7. // put your keyboard start-up code here
  8. // runs once when the firmware starts up
  9. matrix_init_user();
  10. led_init_ports();
  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. void led_init_ports(void) {
  18. // * Set our LED pins as output
  19. DDRB |= (1<<2);
  20. DDRF |= (1<<7);
  21. // * Setting BL LEDs to init as off
  22. PORTF |= (1<<7);
  23. }
  24. void led_set_kb(uint8_t usb_led) {
  25. if (usb_led & (1<<USB_LED_NUM_LOCK)) {
  26. // Turn numlock on
  27. PORTB &= ~(1<<2);
  28. } else {
  29. // Turn numlock off
  30. PORTB |= (1<<2);
  31. }
  32. }