/* Copyright 2017 Jason Williams (Wilba)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if RGB_BACKLIGHT_ENABLED
#if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_ZEAL65) || defined (RGB_BACKLIGHT_M60_A) || defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_KOYU)
#else
#error None of the following was defined: RGB_BACKLIGHT_ZEAL60, RGB_BACKLIGHT_ZEAL65, RGB_BACKLIGHT_M60_A, RGB_BACKLIGHT_M6_B, RGB_BACKLIGHT_KOYU
#endif
#include "quantum.h"
#include "rgb_backlight.h"
#include "rgb_backlight_api.h"
#include "rgb_backlight_keycodes.h"
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "progmem.h"
#include "quantum/color.h"
#include "drivers/avr/i2c_master.h"
#if defined (RGB_BACKLIGHT_M6_B)
#include "drivers/issi/is31fl3218.h"
#define BACKLIGHT_LED_COUNT 6
#else
#include "drivers/issi/is31fl3731.h"
#define BACKLIGHT_LED_COUNT 72
#endif
#define BACKLIGHT_EFFECT_MAX 10
backlight_config g_config = {
.use_split_backspace = RGB_BACKLIGHT_USE_SPLIT_BACKSPACE,
.use_split_left_shift = RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT,
.use_split_right_shift = RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT,
.use_7u_spacebar = RGB_BACKLIGHT_USE_7U_SPACEBAR,
.use_iso_enter = RGB_BACKLIGHT_USE_ISO_ENTER,
.disable_hhkb_blocker_leds = RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS,
.disable_when_usb_suspended = RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED,
.disable_after_timeout = RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT,
.brightness = 255,
.effect = RGB_BACKLIGHT_EFFECT,
.effect_speed = 0,
.color_1 = { .h = 0, .s = 255 },
.color_2 = { .h = 127, .s = 255 },
.caps_lock_indicator = { .color = { .h = 0, .s = 0 }, .index = 255 },
.layer_1_indicator = { .color = { .h = 0, .s = 0 }, .index = 255 },
.layer_2_indicator = { .color = { .h = 0, .s = 0 }, .index = 255 },
.layer_3_indicator = { .color = { .h = 0, .s = 0 }, .index = 255 },
.alphas_mods = {
RGB_BACKLIGHT_ALPHAS_MODS_ROW_0,
RGB_BACKLIGHT_ALPHAS_MODS_ROW_1,
RGB_BACKLIGHT_ALPHAS_MODS_ROW_2,
RGB_BACKLIGHT_ALPHAS_MODS_ROW_3,
RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 },
#if defined(RGB_BACKLIGHT_M6_B)
.custom_color = { { 0, 255 }, { 43, 255 }, { 85, 255 }, { 128, 255 }, { 171, 255 }, { 213, 255 } }
#endif
};
bool g_suspend_state = false;
uint8_t g_indicator_state = 0;
// Global tick at 20 Hz
|