meal_pager_led.c 1.5 KB

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