mine_sweeper_haptic.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "mine_sweeper_haptic.h"
  2. #include "../minesweeper.h"
  3. void mine_sweeper_play_happy_bump(void* context) {
  4. MineSweeperApp* app = context;
  5. if (app->feedback_enabled)
  6. notification_message(app->notification, &sequence_set_vibro_on);
  7. furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
  8. notification_message(app->notification, &sequence_reset_vibro);
  9. }
  10. void mine_sweeper_play_long_ok_bump(void* context) {
  11. MineSweeperApp* app = context;
  12. for (int i = 0; i < 2; i++) {
  13. if (app->feedback_enabled)
  14. notification_message(app->notification, &sequence_set_vibro_on);
  15. furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
  16. notification_message(app->notification, &sequence_reset_vibro);
  17. furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
  18. }
  19. }
  20. void mine_sweeper_play_oob_bump(void* context) {
  21. MineSweeperApp* app = context;
  22. if (app->feedback_enabled)
  23. notification_message(app->notification, &sequence_set_vibro_on);
  24. furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
  25. notification_message(app->notification, &sequence_reset_vibro);
  26. }
  27. void mine_sweeper_play_lose_bump(void* context) {
  28. MineSweeperApp* app = context;
  29. if (app->feedback_enabled)
  30. notification_message(app->notification, &sequence_set_vibro_on);
  31. furi_thread_flags_wait(0, FuriFlagWaitAny, 100);
  32. notification_message(app->notification, &sequence_reset_vibro);
  33. furi_thread_flags_wait(0, FuriFlagWaitAny, 400);
  34. }
  35. void mine_sweeper_play_win_bump(void* context) {
  36. MineSweeperApp* app = context;
  37. for (int i = 0; i < 4; i++) {
  38. if (app->feedback_enabled)
  39. notification_message(app->notification, &sequence_set_vibro_on);
  40. furi_thread_flags_wait(0, FuriFlagWaitAny, 50);
  41. notification_message(app->notification, &sequence_reset_vibro);
  42. furi_thread_flags_wait(0, FuriFlagWaitAny, 100);
  43. }
  44. }