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.

77 lines
2.1 KiB

  1. /* Copyright 2018 Jason Williams (Wilba)
  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. #pragma once
  17. #include <stdint.h>
  18. #include <stdbool.h>
  19. #include "progmem.h"
  20. #include "util.h"
  21. #define IS31FL3218_REG_SHUTDOWN 0x00
  22. #define IS31FL3218_REG_PWM 0x01
  23. #define IS31FL3218_REG_LED_CONTROL_1 0x13
  24. #define IS31FL3218_REG_LED_CONTROL_2 0x14
  25. #define IS31FL3218_REG_LED_CONTROL_3 0x15
  26. #define IS31FL3218_REG_UPDATE 0x16
  27. #define IS31FL3218_REG_RESET 0x17
  28. #define IS31FL3218_I2C_ADDRESS 0x54
  29. #if defined(RGB_MATRIX_IS31FL3218)
  30. # define IS31FL3218_LED_COUNT RGB_MATRIX_LED_COUNT
  31. #endif
  32. typedef struct is31fl3218_led_t {
  33. uint8_t r;
  34. uint8_t g;
  35. uint8_t b;
  36. } PACKED is31fl3218_led_t;
  37. extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT];
  38. void is31fl3218_init(void);
  39. void is31fl3218_write_register(uint8_t reg, uint8_t data);
  40. void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
  41. void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
  42. void is31fl3218_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
  43. void is31fl3218_update_pwm_buffers(void);
  44. void is31fl3218_update_led_control_registers(void);
  45. #define OUT1 0x00
  46. #define OUT2 0x01
  47. #define OUT3 0x02
  48. #define OUT4 0x03
  49. #define OUT5 0x04
  50. #define OUT6 0x05
  51. #define OUT7 0x06
  52. #define OUT8 0x07
  53. #define OUT9 0x08
  54. #define OUT10 0x09
  55. #define OUT11 0x0A
  56. #define OUT12 0x0B
  57. #define OUT13 0x0C
  58. #define OUT14 0x0D
  59. #define OUT15 0x0E
  60. #define OUT16 0x0F
  61. #define OUT17 0x10
  62. #define OUT18 0x11