meal_pager_led.c 2.1 KB

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