#include "hbcp.h"
#ifndef HSV_CAPS
#define HSV_CAPS 0, 0, 120
#endif
#ifndef HSV_NLCK
#define HSV_NLCK 0, 0, 120
#endif
#ifndef HSV_SCRL
#define HSV_SCRL 0, 0, 120
#endif
#ifndef HSV_BLACK
#define HSV_BLACK 0, 0, 0
#endif
void matrix_init_kb(void) {
matrix_init_user();
}
void matrix_scan_kb(void) {
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) {
led_set_user(usb_led);
}
void eeconfig_init_kb(void) { rgblight_enable(); rgblight_sethsv(0, 255, 128); rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 2);
eeconfig_update_kb(0);
eeconfig_init_user();
}
#ifdef RGBLIGHT_ENABLE
__attribute__ ((weak))
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
sethsv_raw(HSV_CAPS, (LED_TYPE *)&led[0]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[0]);
}
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
sethsv_raw(HSV_NLCK, (LED_TYPE *)&led[1]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[1]);
}
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
sethsv_raw(HSV_SCRL, (LED_TYPE *)&led[2]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[2]);
}
rgblight_set();
}
__attribute__ ((weak))
void keyboard_post_init_user(void) {
rgblight_set_effect_range(3, RGBLED_NUM-3);
led_set_user(_BV(USB_LED_CAPS_LOCK)|_BV(USB_LED_NUM_LOCK)|_BV(USB_LED_SCROLL_LOCK));
wait_ms(300);
led_set_user(0);
}
__attribute__ ((weak))
void hbcp_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end) {
LED_TYPE tmp_led;
sethsv_raw(hue, sat, val, &tmp_led);
for (uint8_t i = start; i < end; i++) {
led[i] = tmp_led;
}
rgblight_set();
}
#endif