xremote_led.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "xremote_led.h"
  2. void xremote_led_set_rgb(void* context, int red, int green, int blue) {
  3. XRemote* 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(
  25. 0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
  26. }
  27. void xremote_led_reset(void* context) {
  28. XRemote* 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(
  33. 0, FuriFlagWaitAny, 300); //Delay, prevent removal from RAM before LED value set
  34. }