logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

magnum_ergo_1.c (2533B)


  1. /* Copyright 2023 Gondolindrim <gondolindrim@acheronproject.com>
  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 "quantum.h"
  17. void keyoard_post_init_kb(void) {
  18. gpio_set_pin_output(LED_CAPS_LOCK_PIN);
  19. gpio_set_pin_output(LED_INDICATOR_1);
  20. gpio_set_pin_output(LED_INDICATOR_2);
  21. gpio_set_pin_output(LED_INDICATOR_3);
  22. gpio_set_pin_output(LED_INDICATOR_4);
  23. gpio_set_pin_output(LED_INDICATOR_5);
  24. #ifndef LED_CAPS_LOCK_PIN
  25. gpio_write_pin(LED_CAPS_LOCK_PIN, 0);
  26. #endif
  27. #ifndef LED_INDICATOR_1
  28. gpio_write_pin(LED_INDICATOR_1, 0);
  29. #endif
  30. #ifndef LED_INDICATOR_2
  31. gpio_write_pin(LED_INDICATOR_2, 0);
  32. #endif
  33. #ifndef LED_INDICATOR_3
  34. gpio_write_pin(LED_INDICATOR_3, 0);
  35. #endif
  36. #ifndef LED_INDICATOR_4
  37. gpio_write_pin(LED_INDICATOR_4, 0);
  38. #endif
  39. #ifndef LED_INDICATOR_5
  40. gpio_write_pin(LED_INDICATOR_5, 0);
  41. #endif
  42. keyboard_post_init_user();
  43. }
  44. layer_state_t layer_state_set_kb(layer_state_t state) {
  45. switch (get_highest_layer(state)) {
  46. case 1:
  47. #ifdef LED_INDICATOR_4
  48. gpio_write_pin(LED_INDICATOR_4, 1);
  49. #endif
  50. #ifdef LED_INDICATOR_5
  51. gpio_write_pin(LED_INDICATOR_5, 1);
  52. #endif
  53. break;
  54. case 2:
  55. #ifdef LED_INDICATOR_1
  56. gpio_write_pin(LED_INDICATOR_1, 1);
  57. #endif
  58. #ifdef LED_INDICATOR_2
  59. gpio_write_pin(LED_INDICATOR_2, 1);
  60. #endif
  61. #ifdef LED_INDICATOR_3
  62. gpio_write_pin(LED_INDICATOR_3, 1);
  63. #endif
  64. break;
  65. default:
  66. #ifdef LED_INDICATOR_1
  67. gpio_write_pin(LED_INDICATOR_1, 0);
  68. #endif
  69. #ifdef LED_INDICATOR_2
  70. gpio_write_pin(LED_INDICATOR_2, 0);
  71. #endif
  72. #ifdef LED_INDICATOR_3
  73. gpio_write_pin(LED_INDICATOR_3, 0);
  74. #endif
  75. #ifdef LED_INDICATOR_4
  76. gpio_write_pin(LED_INDICATOR_4, 0);
  77. #endif
  78. #ifdef LED_INDICATOR_5
  79. gpio_write_pin(LED_INDICATOR_5, 0);
  80. #endif
  81. break;
  82. }
  83. return layer_state_set_user(state);
  84. }