subghz_worker.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #pragma once
  2. #include <furi_hal.h>
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. typedef struct SubGhzWorker SubGhzWorker;
  7. typedef void (*SubGhzWorkerOverrunCallback)(void* context);
  8. typedef void (*SubGhzWorkerPairCallback)(void* context, bool level, uint32_t duration);
  9. void subghz_worker_rx_callback(bool level, uint32_t duration, void* context);
  10. /**
  11. * Allocate SubGhzWorker.
  12. * @return SubGhzWorker* Pointer to a SubGhzWorker instance
  13. */
  14. SubGhzWorker* subghz_worker_alloc();
  15. /**
  16. * Free SubGhzWorker.
  17. * @param instance Pointer to a SubGhzWorker instance
  18. */
  19. void subghz_worker_free(SubGhzWorker* instance);
  20. /**
  21. * Overrun callback SubGhzWorker.
  22. * @param instance Pointer to a SubGhzWorker instance
  23. * @param callback SubGhzWorkerOverrunCallback callback
  24. */
  25. void subghz_worker_set_overrun_callback(
  26. SubGhzWorker* instance,
  27. SubGhzWorkerOverrunCallback callback);
  28. /**
  29. * Pair callback SubGhzWorker.
  30. * @param instance Pointer to a SubGhzWorker instance
  31. * @param callback SubGhzWorkerOverrunCallback callback
  32. */
  33. void subghz_worker_set_pair_callback(SubGhzWorker* instance, SubGhzWorkerPairCallback callback);
  34. /**
  35. * Context callback SubGhzWorker.
  36. * @param instance Pointer to a SubGhzWorker instance
  37. * @param context
  38. */
  39. void subghz_worker_set_context(SubGhzWorker* instance, void* context);
  40. /**
  41. * Start SubGhzWorker.
  42. * @param instance Pointer to a SubGhzWorker instance
  43. */
  44. void subghz_worker_start(SubGhzWorker* instance);
  45. /** Stop SubGhzWorker
  46. * @param instance Pointer to a SubGhzWorker instance
  47. */
  48. void subghz_worker_stop(SubGhzWorker* instance);
  49. /**
  50. * Check if worker is running.
  51. * @param instance Pointer to a SubGhzWorker instance
  52. * @return bool - true if running
  53. */
  54. bool subghz_worker_is_running(SubGhzWorker* instance);
  55. /**
  56. * Short duration filter setting.
  57. * glues short durations into 1. The default setting is 30 us, if set to 0 the filter will be disabled
  58. * @param instance Pointer to a SubGhzWorker instance
  59. * @param timeout time in us
  60. */
  61. void subghz_worker_set_filter(SubGhzWorker* instance, uint16_t timeout);
  62. #ifdef __cplusplus
  63. }
  64. #endif