You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
920 B

  1. #include "quantum.h"
  2. #include "talljoe.h"
  3. bool process_indicator_led_user(uint32_t state){
  4. return false;
  5. }
  6. #define LED_MASK (_BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3))
  7. #define WHITE (_BV(PB0))
  8. #define YELLOW (_BV(PB1))
  9. #define MAGENTA (_BV(PB2))
  10. #define RED (_BV(PB3))
  11. void matrix_scan_keymap(void) {
  12. uint32_t lights = WHITE;
  13. switch(get_highest_layer(layer_state))
  14. {
  15. case _NAV:
  16. lights |= YELLOW;
  17. break;
  18. case _NUM:
  19. lights |= MAGENTA;
  20. break;
  21. case _ADJUST:
  22. lights |= RED;
  23. break;
  24. default: {
  25. uint8_t default_layer = get_highest_layer(default_layer_state);
  26. lights = 0; // no white LED by default.
  27. if(default_layer & 1)
  28. lights |= YELLOW;
  29. if(default_layer & 2)
  30. lights |= MAGENTA;
  31. if(default_layer & 4)
  32. lights |= RED;
  33. }
  34. }
  35. uint32_t port = PORTB;
  36. port |= LED_MASK;
  37. port &= ~lights;
  38. PORTB = port;
  39. }