meal_pager_led.c 2.0 KB

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