utils.c 802 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <furi.h>
  2. #include "utils.h"
  3. static const NotificationSequence sequence_beep = {
  4. &message_blue_255,
  5. &message_note_d5,
  6. &message_delay_100,
  7. &message_sound_off,
  8. NULL,
  9. };
  10. void notification_beep_once() {
  11. notification_message(furi_record_open(RECORD_NOTIFICATION), &sequence_beep);
  12. notification_off();
  13. }
  14. void notification_off() {
  15. furi_record_close(RECORD_NOTIFICATION);
  16. }
  17. void notification_timeup() {
  18. notification_message(furi_record_open(RECORD_NOTIFICATION), &sequence_audiovisual_alert);
  19. }
  20. void parse_sec_to_time_str(char* buffer, size_t len, int32_t sec) {
  21. snprintf(
  22. buffer,
  23. len,
  24. "%02ld:%02ld:%02ld",
  25. (sec % (60 * 60 * 24)) / (60 * 60), // hour
  26. (sec % (60 * 60)) / 60, // minute
  27. sec % 60); // second
  28. }