is31flcommon.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Copyright 2017 Jason Williams
  2. * Copyright 2018 Jack Humbert
  3. * Copyright 2018 Yiancar
  4. * Copyright 2020 MelGeek
  5. * Copyright 2021 MasterSpoon
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #pragma once
  21. #include <stdint.h>
  22. #include <stdbool.h>
  23. #include "progmem.h"
  24. // Which variant header file to use
  25. #ifdef IS31FL3742A
  26. # include "is31fl3742.h"
  27. #elif defined(IS31FL3743A)
  28. # include "is31fl3743.h"
  29. #elif defined(IS31FL3745)
  30. # include "is31fl3745.h"
  31. #elif defined(IS31FL3746A)
  32. # include "is31fl3746.h"
  33. #endif
  34. #ifdef RGB_MATRIX_ENABLE
  35. typedef struct is31_led {
  36. uint8_t driver;
  37. uint8_t r;
  38. uint8_t g;
  39. uint8_t b;
  40. } __attribute__((packed)) is31_led;
  41. extern const is31_led __flash g_is31_leds[RGB_MATRIX_LED_COUNT];
  42. #elif defined(LED_MATRIX_ENABLE)
  43. typedef struct is31_led {
  44. uint8_t driver;
  45. uint8_t v;
  46. } __attribute__((packed)) is31_led;
  47. extern const is31_led __flash g_is31_leds[LED_MATRIX_LED_COUNT];
  48. #endif
  49. #ifdef ISSI_MANUAL_SCALING
  50. extern const is31_led __flash g_is31_scaling[];
  51. void IS31FL_set_manual_scaling_buffer(void);
  52. #endif
  53. void IS31FL_write_single_register(uint8_t addr, uint8_t reg, uint8_t data);
  54. bool IS31FL_write_multi_registers(uint8_t addr, uint8_t *source_buffer, uint8_t buffer_size, uint8_t transfer_size, uint8_t start_reg_addr);
  55. void IS31FL_unlock_register(uint8_t addr, uint8_t page);
  56. void IS31FL_common_init(uint8_t addr, uint8_t ssr);
  57. void IS31FL_common_update_pwm_register(uint8_t addr, uint8_t index);
  58. void IS31FL_common_update_scaling_register(uint8_t addr, uint8_t index);
  59. #ifdef RGB_MATRIX_ENABLE
  60. // RGB Matrix Specific scripts
  61. void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
  62. void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
  63. void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blue);
  64. #elif defined(LED_MATRIX_ENABLE)
  65. // LED Matrix Specific scripts
  66. void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value);
  67. void IS31FL_simple_set_brightness(int index, uint8_t value);
  68. void IS31FL_simple_set_brigntness_all(uint8_t value);
  69. #endif