_light.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. from typing import Callable
  2. LIGHT_RED: int
  3. '''
  4. Constant value for the red LED light.
  5. '''
  6. LIGHT_GREEN: int
  7. '''
  8. Constant value for the green LED light.
  9. '''
  10. LIGHT_BLUE: int
  11. '''
  12. Constant value for the blue LED light.
  13. '''
  14. LIGHT_BACKLIGHT: int
  15. '''
  16. Constant value for the display backlight.
  17. '''
  18. def light_set(light: int, brightness: int) -> None:
  19. '''
  20. Control the RGB LED on your Flipper. You can also set the brightness of multiple channels at once using bitwise operations.
  21. The ``brightness`` parameter accepts values from 0 (light off) to 255 (very bright).
  22. :param light: The RGB channels to set.
  23. :param brightness: The brightness to use.
  24. .. code-block::
  25. import flipperzero as f0
  26. f0.light_set(f0.LIGHT_RED | f0.LIGHT_GREEN, 250)
  27. .. tip::
  28. You can use up to seven colors using `additive mixing <https://en.wikipedia.org/wiki/Additive_color>`_.
  29. '''
  30. pass
  31. def light_blink_start(light: int, brightness: int, on_time: int, period: int) -> None:
  32. '''
  33. Let the RGB LED blink. You can define the total duration of a blink period and the duration, the LED is active during a blink period.
  34. Hence, ``on_time`` must be smaller than ``period``. This is a non-blocking operation. The LED will continue to blink until you call :func:`light_blink_stop`.
  35. :param light: The RGB channels to set.
  36. :param brightness: The brightness to use.
  37. :param on_time: The LED's active duration in milliseconds.
  38. :param period: Total duration of a blink period in milliseconds.
  39. .. code-block::
  40. import flipperzero as f0
  41. f0.light_blink_start(f0.LIGHT_RED, 150, 100, 200)
  42. '''
  43. pass
  44. def light_blink_set_color(light: int) -> None:
  45. '''
  46. Change the RGB LED's color while blinking. This is a non-blocking operation.
  47. Be aware, that you must start the blinking procedure first by using the :func:`light_blink_start` function.
  48. Call the :func:`light_blink_stop` function to stop the blinking LED.
  49. :param light: The RGB channels to set.
  50. '''
  51. pass
  52. def light_blink_stop() -> None:
  53. '''
  54. Stop the blinking LED.
  55. '''
  56. pass