logo

qmk_firmware

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

kastenwagen48.c (1863B)


  1. /* Copyright 2022 W. Alex Ronke, a.k.a. NoPunIn10Did (w.alex.ronke@gmail.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. #ifndef LAYER_LED_DISABLE
  18. void keyboard_pre_init_kb(void) {
  19. gpio_set_pin_output(LED_INDICATOR_TOP);
  20. gpio_set_pin_output(LED_INDICATOR_MID);
  21. gpio_set_pin_output(LED_INDICATOR_BOT);
  22. keyboard_pre_init_user();
  23. }
  24. __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
  25. gpio_write_pin_high(LED_INDICATOR_TOP);
  26. gpio_write_pin_high(LED_INDICATOR_MID);
  27. gpio_write_pin_high(LED_INDICATOR_BOT);
  28. switch(get_highest_layer(state) % 4) {
  29. case 1:
  30. gpio_write_pin_low(LED_INDICATOR_TOP);
  31. gpio_write_pin_low(LED_INDICATOR_MID);
  32. break;
  33. case 2:
  34. gpio_write_pin_low(LED_INDICATOR_TOP);
  35. gpio_write_pin_low(LED_INDICATOR_BOT);
  36. break;
  37. case 3:
  38. gpio_write_pin_low(LED_INDICATOR_MID);
  39. gpio_write_pin_low(LED_INDICATOR_BOT);
  40. break;
  41. }
  42. return state;
  43. }
  44. #endif
  45. bool encoder_update_kb(uint8_t index, bool clockwise) {
  46. if (!encoder_update_user(index, clockwise)) { return false; }
  47. if (clockwise) {
  48. tap_code(KC_PGUP);
  49. } else {
  50. tap_code(KC_PGUP);
  51. }
  52. return true;
  53. };