logo

qmk_firmware

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

indicators.c (1479B)


  1. /* Copyright 2020 B. Fletcher (toraifu) <typefast@kyaa.gg>
  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 "indicators.h"
  17. #include "drivers/led/issi/is31fl3731-mono.h"
  18. #include "i2c_master.h"
  19. /* Set up IS31FL3731 for use in powering indicator LEDs. Absolutely overkill for this job but it was already in the design.
  20. * init IS31FL3731 and i2c
  21. */
  22. void init_fallacy_leds(void) {
  23. is31fl3731_init_drivers();
  24. }
  25. /* update the buffer
  26. */
  27. void update_fallacy_leds(void) {
  28. is31fl3731_flush();
  29. }
  30. /* wrapper to actually set the LED PWM
  31. */
  32. void set_fallacy_led(int index, bool state) {
  33. if (state) {
  34. is31fl3731_set_value(index, 128);
  35. }
  36. else {
  37. is31fl3731_set_value(index, 0);
  38. }
  39. }
  40. /* define LED matrix
  41. */
  42. const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
  43. {0, C1_1},
  44. {0, C2_1},
  45. {0, C3_1},
  46. };