camera_suite_led.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "camera_suite_led.h"
  2. #include "../camera_suite.h"
  3. void camera_suite_led_set_rgb(void* context, int red, int green, int blue) {
  4. CameraSuite* app = context;
  5. if(app->led != 1) {
  6. return;
  7. }
  8. NotificationMessage notification_led_message_1;
  9. notification_led_message_1.type = NotificationMessageTypeLedRed;
  10. NotificationMessage notification_led_message_2;
  11. notification_led_message_2.type = NotificationMessageTypeLedGreen;
  12. NotificationMessage notification_led_message_3;
  13. notification_led_message_3.type = NotificationMessageTypeLedBlue;
  14. notification_led_message_1.data.led.value = red;
  15. notification_led_message_2.data.led.value = green;
  16. notification_led_message_3.data.led.value = blue;
  17. const NotificationSequence notification_sequence = {
  18. &notification_led_message_1,
  19. &notification_led_message_2,
  20. &notification_led_message_3,
  21. &message_do_not_reset,
  22. NULL,
  23. };
  24. notification_message(app->notification, &notification_sequence);
  25. //Delay, prevent removal from RAM before LED value set.
  26. furi_thread_flags_wait(0, FuriFlagWaitAny, 10);
  27. }
  28. void camera_suite_led_reset(void* context) {
  29. CameraSuite* app = context;
  30. notification_message(app->notification, &sequence_reset_red);
  31. notification_message(app->notification, &sequence_reset_green);
  32. notification_message(app->notification, &sequence_reset_blue);
  33. //Delay, prevent removal from RAM before LED value set.
  34. furi_thread_flags_wait(0, FuriFlagWaitAny, 300);
  35. }