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.

45 lines
1.5 KiB

  1. /* Copyright 2019 Yiancar-Designs
  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 keyboard_pre_init_kb(void) {
  18. setPinOutput(C6);
  19. setPinOutput(B0);
  20. }
  21. bool led_update_kb(led_t led_state) {
  22. bool res = led_update_user(led_state);
  23. if (res) {
  24. // writePin sets the pin high for 1 and low for 0.
  25. // In this example the pins are inverted, setting
  26. // it low/0 turns it on, and high/1 turns the LED off.
  27. // This behavior depends on whether the LED is between the pin
  28. // and VCC or the pin and GND.
  29. writePin(C6, !led_state.caps_lock);
  30. }
  31. return res;
  32. }
  33. __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
  34. writePin(B0, !(state & (1UL << 1)));
  35. return state;
  36. }
  37. // Override core logic as we reuse SPLIT_HAND_PIN within matrix pins
  38. bool is_keyboard_left(void) {
  39. setPinInput(SPLIT_HAND_PIN);
  40. return gpio_read_pin(SPLIT_HAND_PIN);
  41. }