diff --git a/sim/fakes/hardware.py b/sim/fakes/hardware.py index 27a7538caa07f519f9bf26778e023451059b1294..38438af9327846b77a81a3db1c84aa51b6e0354d 100644 --- a/sim/fakes/hardware.py +++ b/sim/fakes/hardware.py @@ -343,40 +343,11 @@ def display_update(subctx): def display_pipe_full(): return False -def set_led_rgb(ix, r, g, b): - ix = ((39-ix) + 1 + 32)%40; - - r = r << 3 - g = g << 2 - b = b << 3 - if r > 255: - r = 255 - if g > 255: - g = 255 - if b > 255: - b = 255 - _sim.set_led_rgb(ix, r, g, b) - - -def set_led_hsv(ix, h, s, v): - color = pygame.Color(0) - h /= 255.0 - color.hsva = (h, s, v, 1.0) - r, g, b = color.r, color.g, color.b - r *= 255 - g *= 255 - b *= 255 - _sim.set_led_rgb(ix, r, g, b) - - -def update_leds(): - _sim.leds_update() - _sim.render_gui_lazy() - def set_global_volume_dB(a): pass + def get_button_state(left): _sim.process_events() _sim.render_gui_lazy() @@ -437,4 +408,4 @@ def captouch_get_petal_pad(i, x): def freertos_sleep(ms): import _time - _time.sleep(ms / 1000.0) \ No newline at end of file + _time.sleep(ms / 1000.0) diff --git a/sim/fakes/leds.py b/sim/fakes/leds.py new file mode 100644 index 0000000000000000000000000000000000000000..24a1994b266e3946a9419f66b131d27049706268 --- /dev/null +++ b/sim/fakes/leds.py @@ -0,0 +1,34 @@ +from hardware import _sim + +import pygame + + +def set_rgb(ix, r, g, b): + ix = ((39-ix) + 1 + 32)%40; + + r = r << 3 + g = g << 2 + b = b << 3 + if r > 255: + r = 255 + if g > 255: + g = 255 + if b > 255: + b = 255 + _sim.set_led_rgb(ix, r, g, b) + + +def set_hsv(ix, h, s, v): + color = pygame.Color(0) + h /= 255.0 + color.hsva = (h, s, v, 1.0) + r, g, b = color.r, color.g, color.b + r *= 255 + g *= 255 + b *= 255 + _sim.set_led_rgb(ix, r, g, b) + + +def update(): + _sim.leds_update() + _sim.render_gui_lazy()