logo

qmk_firmware

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

m65ha_alpha.c (2160B)


  1. /*
  2. Copyright 2020 Álvaro "Gondolindrim" Volpato <alvaro.volpato@usp.br>
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include "quantum.h"
  15. void board_init(void) {
  16. gpio_set_pin_input(B10);
  17. }
  18. void led_init_ports(void) {
  19. /** If the OPENDRAIN_INDICATORS option is not defined in config.h, the indicator
  20. pins default to push-pull output. Else, they are defined as open-drain. The
  21. pin mode configuration is done through the INDICATOR_PIN_MODE which is
  22. attributed right at the beggining. **/
  23. #ifndef OPENDRAIN_INDICATORS
  24. # define INDICATOR_PIN_MODE PAL_MODE_OUTPUT_PUSHPULL
  25. #else
  26. # define INDICATOR_PIN_MODE PAL_MODE_OUTPUT_OPENDRAIN
  27. #endif
  28. #ifdef LED_NUM_LOCK_PIN
  29. palSetLineMode(LED_NUM_LOCK_PIN, INDICATOR_PIN_MODE);
  30. #endif
  31. #ifdef LED_CAPS_LOCK_PIN
  32. palSetLineMode(LED_CAPS_LOCK_PIN, INDICATOR_PIN_MODE);
  33. #endif
  34. #ifdef LED_SCROLL_LOCK_PIN
  35. palSetLineMode(LED_SCROLL_LOCK_PIN, INDICATOR_PIN_MODE);
  36. #endif
  37. #ifdef LED_COMPOSE_PIN
  38. palSetLineMode(LED_COMPOSE_PIN, INDICATOR_PIN_MODE);
  39. #endif
  40. #ifdef LED_KANA_PIN
  41. palSetLineMode(LED_KANA_PIN, INDICATOR_PIN_MODE);
  42. #endif
  43. }
  44. bool led_update_kb(led_t led_state) {
  45. bool res = led_update_user(led_state);
  46. if(res) {
  47. // gpio_write_pin sets the pin high for 1 and low for 0.
  48. // In this example the pins are inverted, setting
  49. // it low/0 turns it on, and high/1 turns the LED off.
  50. // This behavior depends on whether the LED is between the pin
  51. // and VCC or the pin and GND.
  52. gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock);
  53. }
  54. return res;
  55. }