rev2.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Copyright 2020 Team Mechlovin'
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "rev2.h"
  17. void matrix_init_kb(void) {
  18. matrix_init_user();
  19. led_init_ports();
  20. };
  21. void led_init_ports(void) {
  22. setPinOutput(A5);
  23. setPinOutput(A6);
  24. setPinOutput(A7);
  25. setPinOutput(C7);
  26. setPinOutput(C6);
  27. }
  28. layer_state_t layer_state_set_kb(layer_state_t state) {
  29. state = layer_state_set_user(state);
  30. writePinHigh(C6);
  31. writePinHigh(C7);
  32. writePinHigh(A7);
  33. writePinHigh(A6);
  34. writePinHigh(A5);
  35. switch (get_highest_layer(state)) {
  36. case 0:
  37. writePinLow(C6);
  38. break;
  39. case 1:
  40. writePinLow(C7);
  41. break;
  42. case 2:
  43. writePinLow(A7);
  44. break;
  45. case 3:
  46. writePinLow(A6);
  47. break;
  48. case 4:
  49. writePinLow(A5);
  50. break;
  51. }
  52. return state;
  53. }