mine_sweeper_haptic.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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) notification_message(app->notification, &sequence_set_vibro_on);
  6. furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
  7. notification_message(app->notification, &sequence_reset_vibro);
  8. }
  9. void mine_sweeper_play_long_ok_bump(void* context) {
  10. MineSweeperApp* app = context;
  11. for(int i = 0; i < 2; i++) {
  12. if(app->feedback_enabled) notification_message(app->notification, &sequence_set_vibro_on);
  13. furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
  14. notification_message(app->notification, &sequence_reset_vibro);
  15. furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
  16. }
  17. }
  18. void mine_sweeper_play_oob_bump(void* context) {
  19. MineSweeperApp* app = context;
  20. if(app->feedback_enabled) notification_message(app->notification, &sequence_set_vibro_on);
  21. furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
  22. notification_message(app->notification, &sequence_reset_vibro);
  23. }
  24. void mine_sweeper_play_lose_bump(void* context) {
  25. MineSweeperApp* app = context;
  26. if(app->feedback_enabled) notification_message(app->notification, &sequence_set_vibro_on);
  27. furi_thread_flags_wait(0, FuriFlagWaitAny, 100);
  28. notification_message(app->notification, &sequence_reset_vibro);
  29. furi_thread_flags_wait(0, FuriFlagWaitAny, 400);
  30. }
  31. void mine_sweeper_play_win_bump(void* context) {
  32. MineSweeperApp* app = context;
  33. for(int i = 0; i < 4; i++) {
  34. if(app->feedback_enabled) notification_message(app->notification, &sequence_set_vibro_on);
  35. furi_thread_flags_wait(0, FuriFlagWaitAny, 50);
  36. notification_message(app->notification, &sequence_reset_vibro);
  37. furi_thread_flags_wait(0, FuriFlagWaitAny, 100);
  38. }
  39. }