mine_sweeper_led.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "mine_sweeper_led.h"
  2. #include "../minesweeper.h"
  3. void mine_sweeper_led_set_rgb(void* context, int red, int green, int blue) {
  4. MineSweeperApp* app = context;
  5. NotificationMessage notification_led_message_1;
  6. notification_led_message_1.type = NotificationMessageTypeLedRed;
  7. NotificationMessage notification_led_message_2;
  8. notification_led_message_2.type = NotificationMessageTypeLedGreen;
  9. NotificationMessage notification_led_message_3;
  10. notification_led_message_3.type = NotificationMessageTypeLedBlue;
  11. notification_led_message_1.data.led.value = red;
  12. notification_led_message_2.data.led.value = green;
  13. notification_led_message_3.data.led.value = blue;
  14. const NotificationSequence notification_sequence = {
  15. &notification_led_message_1,
  16. &notification_led_message_2,
  17. &notification_led_message_3,
  18. &message_do_not_reset,
  19. NULL,
  20. };
  21. notification_message(app->notification, &notification_sequence);
  22. furi_thread_flags_wait(0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
  23. }
  24. void mine_sweeper_led_blink_red(void* context) {
  25. furi_assert(context);
  26. MineSweeperApp* app = context;
  27. notification_message(app->notification, &sequence_blink_red_100);
  28. furi_thread_flags_wait(0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
  29. }
  30. void mine_sweeper_led_blink_magenta(void* context) {
  31. furi_assert(context);
  32. MineSweeperApp* app = context;
  33. notification_message(app->notification, &sequence_blink_magenta_100);
  34. furi_thread_flags_wait(0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
  35. }
  36. void mine_sweeper_led_blink_cyan(void* context) {
  37. furi_assert(context);
  38. MineSweeperApp* app = context;
  39. notification_message(app->notification, &sequence_blink_cyan_100);
  40. furi_thread_flags_wait(0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
  41. }
  42. void mine_sweeper_led_reset(void* context) {
  43. MineSweeperApp* app = context;
  44. notification_message(app->notification, &sequence_reset_red);
  45. notification_message(app->notification, &sequence_reset_green);
  46. notification_message(app->notification, &sequence_reset_blue);
  47. furi_thread_flags_wait(0, FuriFlagWaitAny, 300); //Delay, prevent removal from RAM before LED value set
  48. }