Parent directory

rgb_matrix_drivers.c

5259 bytes
  1/* Copyright 2018 James Laird-Wah
  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
 17#include "rgb_matrix_drivers.h"
 18
 19#include <stdbool.h>
 20#include "keyboard.h"
 21#include "color.h"
 22#include "util.h"
 23
 24/* Each driver needs to define the struct
 25 *    const rgb_matrix_driver_t rgb_matrix_driver;
 26 * All members must be provided.
 27 * Keyboard custom drivers can define this in their own files, it should only
 28 * be here if shared between boards.
 29 */
 30
 31#if defined(RGB_MATRIX_IS31FL3218)
 32const rgb_matrix_driver_t rgb_matrix_driver = {
 33    .init          = is31fl3218_init,
 34    .flush         = is31fl3218_update_pwm_buffers,
 35    .set_color     = is31fl3218_set_color,
 36    .set_color_all = is31fl3218_set_color_all,
 37};
 38
 39#elif defined(RGB_MATRIX_IS31FL3236)
 40const rgb_matrix_driver_t rgb_matrix_driver = {
 41    .init          = is31fl3236_init_drivers,
 42    .flush         = is31fl3236_flush,
 43    .set_color     = is31fl3236_set_color,
 44    .set_color_all = is31fl3236_set_color_all,
 45};
 46
 47#elif defined(RGB_MATRIX_IS31FL3729)
 48const rgb_matrix_driver_t rgb_matrix_driver = {
 49    .init          = is31fl3729_init_drivers,
 50    .flush         = is31fl3729_flush,
 51    .set_color     = is31fl3729_set_color,
 52    .set_color_all = is31fl3729_set_color_all,
 53};
 54
 55#elif defined(RGB_MATRIX_IS31FL3731)
 56const rgb_matrix_driver_t rgb_matrix_driver = {
 57    .init          = is31fl3731_init_drivers,
 58    .flush         = is31fl3731_flush,
 59    .set_color     = is31fl3731_set_color,
 60    .set_color_all = is31fl3731_set_color_all,
 61};
 62
 63#elif defined(RGB_MATRIX_IS31FL3733)
 64const rgb_matrix_driver_t rgb_matrix_driver = {
 65    .init          = is31fl3733_init_drivers,
 66    .flush         = is31fl3733_flush,
 67    .set_color     = is31fl3733_set_color,
 68    .set_color_all = is31fl3733_set_color_all,
 69};
 70
 71#elif defined(RGB_MATRIX_IS31FL3736)
 72const rgb_matrix_driver_t rgb_matrix_driver = {
 73    .init          = is31fl3736_init_drivers,
 74    .flush         = is31fl3736_flush,
 75    .set_color     = is31fl3736_set_color,
 76    .set_color_all = is31fl3736_set_color_all,
 77};
 78
 79#elif defined(RGB_MATRIX_IS31FL3737)
 80const rgb_matrix_driver_t rgb_matrix_driver = {
 81    .init          = is31fl3737_init_drivers,
 82    .flush         = is31fl3737_flush,
 83    .set_color     = is31fl3737_set_color,
 84    .set_color_all = is31fl3737_set_color_all,
 85};
 86
 87#elif defined(RGB_MATRIX_IS31FL3741)
 88const rgb_matrix_driver_t rgb_matrix_driver = {
 89    .init          = is31fl3741_init_drivers,
 90    .flush         = is31fl3741_flush,
 91    .set_color     = is31fl3741_set_color,
 92    .set_color_all = is31fl3741_set_color_all,
 93};
 94
 95#elif defined(RGB_MATRIX_IS31FL3742A)
 96const rgb_matrix_driver_t rgb_matrix_driver = {
 97    .init          = is31fl3742a_init_drivers,
 98    .flush         = is31fl3742a_flush,
 99    .set_color     = is31fl3742a_set_color,
100    .set_color_all = is31fl3742a_set_color_all,
101};
102
103#elif defined(RGB_MATRIX_IS31FL3743A)
104const rgb_matrix_driver_t rgb_matrix_driver = {
105    .init          = is31fl3743a_init_drivers,
106    .flush         = is31fl3743a_flush,
107    .set_color     = is31fl3743a_set_color,
108    .set_color_all = is31fl3743a_set_color_all,
109};
110
111#elif defined(RGB_MATRIX_IS31FL3745)
112const rgb_matrix_driver_t rgb_matrix_driver = {
113    .init          = is31fl3745_init_drivers,
114    .flush         = is31fl3745_flush,
115    .set_color     = is31fl3745_set_color,
116    .set_color_all = is31fl3745_set_color_all,
117};
118
119#elif defined(RGB_MATRIX_IS31FL3746A)
120const rgb_matrix_driver_t rgb_matrix_driver = {
121    .init          = is31fl3746a_init_drivers,
122    .flush         = is31fl3746a_flush,
123    .set_color     = is31fl3746a_set_color,
124    .set_color_all = is31fl3746a_set_color_all,
125};
126
127#elif defined(RGB_MATRIX_SNLED27351)
128const rgb_matrix_driver_t rgb_matrix_driver = {
129    .init          = snled27351_init_drivers,
130    .flush         = snled27351_flush,
131    .set_color     = snled27351_set_color,
132    .set_color_all = snled27351_set_color_all,
133};
134
135#elif defined(RGB_MATRIX_AW20216S)
136const rgb_matrix_driver_t rgb_matrix_driver = {
137    .init          = aw20216s_init_drivers,
138    .flush         = aw20216s_flush,
139    .set_color     = aw20216s_set_color,
140    .set_color_all = aw20216s_set_color_all,
141};
142
143#elif defined(RGB_MATRIX_WS2812)
144#    if defined(RGBLIGHT_WS2812)
145#        pragma message "Cannot use RGBLIGHT and RGB Matrix using WS2812 at the same time."
146#        pragma message "You need to use a custom driver, or re-implement the WS2812 driver to use a different configuration."
147#    endif
148
149const rgb_matrix_driver_t rgb_matrix_driver = {
150    .init          = ws2812_init,
151    .flush         = ws2812_flush,
152    .set_color     = ws2812_set_color,
153    .set_color_all = ws2812_set_color_all,
154};
155
156#endif