qmk_firmware/keyboards/cannonkeys/petrichor/petrichor.c
Andrew Kannan e3fed98ecb
[Keyboard] Add Petrichor Keyboard (#23413)
Co-authored-by: jack <0x6a73@protonmail.com>
2024-05-02 17:42:33 -07:00

40 lines
1.1 KiB
C

// Copyright 2023 Andrew Kannan
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h"
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{2, 1, HSV_PURPLE}
);
const rgblight_segment_t PROGMEM my_numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{1, 1, HSV_GREEN}
);
const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, 1, HSV_BLUE}
);
const rgblight_segment_t* const PROGMEM enabled_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
my_capslock_layer,
my_numlock_layer,
my_layer1_layer
);
void keyboard_post_init_kb(void) {
keyboard_post_init_user();
rgblight_layers = enabled_rgb_layers;
}
bool led_update_kb(led_t led_state) {
if(!led_update_user(led_state)){
return false;
}
rgblight_set_layer_state(0, led_state.caps_lock);
rgblight_set_layer_state(1, led_state.num_lock);
return true;
}
layer_state_t layer_state_set_kb(layer_state_t state) {
state = layer_state_set_user(state);
rgblight_set_layer_state(2, layer_state_cmp(state, 1));
return state;
}