Skip to content

Instantly share code, notes, and snippets.

@ishtob
Created June 30, 2017 19:37
Show Gist options
  • Save ishtob/108f10441aad0ef2b71f52732d4e4176 to your computer and use it in GitHub Desktop.
Save ishtob/108f10441aad0ef2b71f52732d4e4176 to your computer and use it in GitHub Desktop.
void backlight_effect_solid_reactive(void)
{
// Relies on hue being 8-bit and wrapping
for ( int i=0; i<DRIVER_LED_TOTAL; i++ )
{
uint16_t offset2 = g_key_hit[i]<<2;
// stabilizer LEDs use spacebar hits
if ( i == 42 || // LC6, LD13
( g_config.use_7u_spacebar && i == 41 ) ) // LD14
{
// offset2 = g_key_hit[36+0]<<2;
offset2 = g_key_hit[42]<<2;
}
offset2 = (offset2<=63) ? (63-offset2) : 0;
HSV hsv = { .h = g_config.color_1.h+offset2, .s = 255, .v = g_config.brightness };
RGB rgb = hsv_to_rgb( hsv );
backlight_set_color( i, rgb.r, rgb.g, rgb.b );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment