qmk_firmware/keyboards/zeal60/rgb_backlight.h
Wilba6582 48a992f1c0 Zeal60/Zeal65/M60-A implementation (#3879)
* Initial version of zeal60

* WIP

* Fixes issue #900

* Adding RGB underglow functionality.
Fixed a compile-time conflict caused by enabling RGB underglow functionality.

* Refactor RPC protocol

* Fix last merge

* README for RGB underglow updated.

* Additional README changes.

* Adding RGBW strip software-based current-limiting functionality.

* RGBW current-limiting functionality should be handled by RGBSTRIP_MAX_CURRENT_PER_LIGHT instead.

* Updated README to reflect implementation of built-in current limiting.

* Keymap readability improvements.

* Minor keymap improvements.

* Fixed LED driver init sequence, formatting

* Dimming implementation tested, working.

* Stab LEDs synced with spacebar hits in effects.

* RGB underglow tested and functional. Simplified README for RGB underglow.

* Undid accidental file deletion from previous merge conflict. Safer values for RGB underglow.

* Improved arrow key positions in keymap.

* Added functionality to correct uneven RGB underglow. Refactored related code.

* Reverted to safer values for underglow.

* Changes for v0.3

* Custom LED brightness scaling will take place after current adjustment in order to avoid being overridden.

* Create keymap.c

Added split backspace and split shift to ISO layout

* Create config.h

Turned on LEDs for new layout

* Fixed bug where left spacebar stabilizer LED (LC06) would adopt color of row above.

* Added hhkb_wilba keymap

* Update keymap.c

* Update keymap.c

* Update keymap.c

* Added indicators, full param setting via host

* Added "mousekey" layout

* Added Zeal65 support, factory test mode

* Keycode safe range changed, caused bugs

* Bumped EEPROM version due to change in QMK keycodes

* Disable HHKB "blocked" LEDs if KC_NO in keymap

* Added "disable_hhkb_blocker_leds"

* Required overridden function for keymaps in EEPROM

* Added polar coordinate mapping, effect speed

* Force Raw HID interface number to 1 always

* Fixed last merge from master

* Added effect speed to default keymaps

* add BACKLIGHT_ prefix to vars

* add BACKLIGHT_ prefix to vars

* Keymap speed effect; keymap improvements/fixes
Readme updated to match changes

* Refactored to use common IS31FL3731/I2C drivers

* Fixed make rules, backlight disabled feature

* Make split rightshift default for Zeal65

* Added M60-A as a "version" of Zeal60.

* Renamed IS31FL3731 driver functions

* Fix suspend_wakeup_init_kb() being defined twice

* First pass refactor dynamic keymaps

* Updated to changed I2C and ISSI drivers

* Refactor zeal_color.* usage to quantum/color.*

* Updated Zeal65, fixed dynamic_keymap

* Major refactoring of Zeal60 backlight and API

* Lots of little cleanups

* Added readme.md

* Added readme.md

* Added LAYOUT_60*() macros, refactored and cleaned up default keymaps

* Fix compile error in suspend.c

* Added Zeal65 LAYOUT macros, info.json

* Added rama/m60_a, deleted zeal60/keymaps/m60_a

* Fixed rama/m60_a/keymaps/proto

* Fixed compilation error for suspend.c

* Requested changes for PR

* Fixed readme.md images

* Another readme.md fix

* Added drashna's requested changes
2018-09-13 14:37:13 -04:00

101 lines
3.4 KiB
C

/* 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/>.
*/
#pragma once
#if RGB_BACKLIGHT_ENABLED
#else
#error rgb_backlight.h included when RGB_BACKLIGHT_ENABLED == 0
#endif // RGB_BACKLIGHT_ENABLED
#include <stdint.h>
#include <stdbool.h>
#include "quantum/color.h"
typedef struct
{
HSV color;
uint8_t index;
} backlight_config_indicator;
typedef struct
{
bool use_split_backspace:1; // |
bool use_split_left_shift:1; // |
bool use_split_right_shift:1; // |
bool use_7u_spacebar:1; // |
bool use_iso_enter:1; // |
bool disable_when_usb_suspended:1; // |
bool disable_hhkb_blocker_leds:1; // |
bool __pad7:1; // 1 byte
uint8_t disable_after_timeout; // 1 byte
uint8_t brightness; // 1 byte
uint8_t effect; // 1 byte
uint8_t effect_speed; // 1 byte
HSV color_1; // 3 bytes
HSV color_2; // 3 bytes
backlight_config_indicator caps_lock_indicator; // 4 bytes
backlight_config_indicator layer_1_indicator; // 4 bytes
backlight_config_indicator layer_2_indicator; // 4 bytes
backlight_config_indicator layer_3_indicator; // 4 bytes
uint16_t alphas_mods[5]; // 10 bytes
} backlight_config; // = 37 bytes
void backlight_config_load(void);
void backlight_config_save(void);
void backlight_config_set_value( uint8_t *data );
void backlight_config_get_value( uint8_t *data );
void backlight_init_drivers(void);
void backlight_timer_init(void);
void backlight_timer_enable(void);
void backlight_timer_disable(void);
void backlight_set_suspend_state(bool state);
void backlight_set_indicator_state(uint8_t state);
// This should not be called from an interrupt
// (eg. from a timer interrupt).
// Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer.
void backlight_update_pwm_buffers(void);
// Handle backlight specific keycodes
bool process_record_backlight(uint16_t keycode, keyrecord_t *record);
void backlight_set_key_hit(uint8_t row, uint8_t col);
void backlight_effect_increase(void);
void backlight_effect_decrease(void);
void backlight_effect_speed_increase(void);
void backlight_effect_speed_decrease(void);
void backlight_brightness_increase(void);
void backlight_brightness_decrease(void);
void backlight_color_1_hue_increase(void);
void backlight_color_1_hue_decrease(void);
void backlight_color_1_sat_increase(void);
void backlight_color_1_sat_decrease(void);
void backlight_color_2_hue_increase(void);
void backlight_color_2_hue_decrease(void);
void backlight_color_2_sat_increase(void);
void backlight_color_2_sat_decrease(void);
void backlight_test_led( uint8_t index, bool red, bool green, bool blue );
void backlight_debug_led(bool state);