hex_viewer_led.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "hex_viewer_led.h"
  2. #include "../hex_viewer.h"
  3. void hex_viewer_led_set_rgb(void* context, int red, int green, int blue) {
  4. HexViewer* 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. furi_thread_flags_wait(0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
  26. }
  27. void hex_viewer_led_reset(void* context) {
  28. HexViewer* app = context;
  29. notification_message(app->notification, &sequence_reset_red);
  30. notification_message(app->notification, &sequence_reset_green);
  31. notification_message(app->notification, &sequence_reset_blue);
  32. furi_thread_flags_wait(0, FuriFlagWaitAny, 300); //Delay, prevent removal from RAM before LED value set
  33. }