_light.py 2.3 KB

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