Update Iris VIA configuration (#18306)
* Update RGB matrix max brightness * Remove old VIA workaround code * Fix default encoder rotations for encoder map
This commit is contained in:
		
							parent
							
								
									b0dc789a1b
								
							
						
					
					
						commit
						3f65d48539
					
				
					 4 changed files with 5 additions and 66 deletions
				
			
		| 
						 | 
				
			
			@ -63,61 +63,6 @@ led_config_t g_led_config = { {
 | 
			
		|||
 | 
			
		||||
} };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#    if defined(VIA_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE)
 | 
			
		||||
 | 
			
		||||
// VIA supports only 4 discrete values for effect speed; map these to some
 | 
			
		||||
// useful speed values for RGB Matrix.
 | 
			
		||||
enum speed_values {
 | 
			
		||||
    RGBLIGHT_SPEED_0 = UINT8_MAX / 16, // not 0 to avoid really slow effects
 | 
			
		||||
    RGBLIGHT_SPEED_1 = UINT8_MAX / 4,
 | 
			
		||||
    RGBLIGHT_SPEED_2 = UINT8_MAX / 2,     // matches the default value
 | 
			
		||||
    RGBLIGHT_SPEED_3 = UINT8_MAX / 4 * 3, // UINT8_MAX is really fast
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static uint8_t speed_from_rgblight(uint8_t rgblight_speed) {
 | 
			
		||||
    switch (rgblight_speed) {
 | 
			
		||||
        case 0:
 | 
			
		||||
            return RGBLIGHT_SPEED_0;
 | 
			
		||||
        case 1:
 | 
			
		||||
            return RGBLIGHT_SPEED_1;
 | 
			
		||||
        case 2:
 | 
			
		||||
        default:
 | 
			
		||||
            return RGBLIGHT_SPEED_2;
 | 
			
		||||
        case 3:
 | 
			
		||||
            return RGBLIGHT_SPEED_3;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint8_t speed_to_rgblight(uint8_t rgb_matrix_speed) {
 | 
			
		||||
    if (rgb_matrix_speed < ((RGBLIGHT_SPEED_0 + RGBLIGHT_SPEED_1) / 2)) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_1 + RGBLIGHT_SPEED_2) / 2)) {
 | 
			
		||||
        return 1;
 | 
			
		||||
    } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_2 + RGBLIGHT_SPEED_3) / 2)) {
 | 
			
		||||
        return 2;
 | 
			
		||||
    } else {
 | 
			
		||||
        return 3;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
 | 
			
		||||
    switch (data[0]) {
 | 
			
		||||
        case id_lighting_get_value:
 | 
			
		||||
            if (data[1] == id_qmk_rgblight_effect_speed) {
 | 
			
		||||
                data[2] = speed_to_rgblight(rgb_matrix_get_speed());
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case id_lighting_set_value:
 | 
			
		||||
            if (data[1] == id_qmk_rgblight_effect_speed) {
 | 
			
		||||
                rgb_matrix_set_speed_noeeprom(speed_from_rgblight(data[2]));
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#    endif // defined(VIA_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef ENCODER_ENABLE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue