blink.c 677 B

12345678910111213141516171819202122232425262728293031
  1. #include <furi.h>
  2. #include <api-hal.h>
  3. void rgb_set(bool r, bool g, bool b) {
  4. api_hal_light_set(LightRed, r ? 0xFF : 0x00);
  5. api_hal_light_set(LightGreen, g ? 0xFF : 0x00);
  6. api_hal_light_set(LightBlue, b ? 0xFF : 0x00);
  7. }
  8. int32_t application_blink(void* p) {
  9. while(1) {
  10. rgb_set(1, 0, 0);
  11. delay(500);
  12. rgb_set(0, 1, 0);
  13. delay(500);
  14. rgb_set(0, 0, 1);
  15. delay(500);
  16. rgb_set(1, 1, 0);
  17. delay(500);
  18. rgb_set(0, 1, 1);
  19. delay(500);
  20. rgb_set(1, 0, 1);
  21. delay(500);
  22. rgb_set(1, 1, 1);
  23. delay(500);
  24. rgb_set(0, 0, 0);
  25. delay(500);
  26. }
  27. return 0;
  28. }