def update(): """ Updates the RGB LEDs. This will apply changes that have been set with :func:`leds.prep` or :func:`leds.prep_hsv`. The LEDs can be only updated in bulk, so using this approach instead of :func:`leds.set` or :func:`leds.set_hsv` significantly reduces the load on the corresponding hardware bus. """ sys_leds.update()
def set_gamma(power=4.0): """ Applies same power function gamma correction to all RGB channels. :param float power: Exponent of power function. """ table = [ int(math.ceil(math.pow((x / 255.0), power) * 255)) for x in range(256) ] for i in range(3): sys_leds.set_gamma(i, table) sys_leds.update()
def set_gamma_rgb(channel, power=4.0, gain=1.0): """ Applies power function gamma correction with optional amplification to a single RGB channel. :param int channel: RGB channel to be adjusted. 0->Red, 1->Green, 2->Blue. :param float power: Exponent of power function. :param float gain: Amplification of channel. Values above 1.0 might cause overflow. """ table = [ int(math.ceil(math.pow((x / 255.0), power) * gain * 255)) for x in range(256) ] sys_leds.set_gamma(channel, table) sys_leds.update()