fsk_demod.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct FSKDemod FSKDemod;
  8. /**
  9. * @brief Allocate a new FSKDemod instance
  10. * FSKDemod is a demodulator that can decode FSK encoded data
  11. *
  12. * @param low_time time between rising edges for the 0 bit
  13. * @param low_pulses rising edges count for the 0 bit
  14. * @param hi_time time between rising edges for the 1 bit
  15. * @param hi_pulses rising edges count for the 1 bit
  16. * @return FSKDemod*
  17. */
  18. FSKDemod*
  19. fsk_demod_alloc(uint32_t low_time, uint32_t low_pulses, uint32_t hi_time, uint32_t hi_pulses);
  20. /**
  21. * @brief Free a FSKDemod instance
  22. *
  23. * @param fsk_demod
  24. */
  25. void fsk_demod_free(FSKDemod* fsk_demod);
  26. /**
  27. * @brief Feed sample to demodulator
  28. *
  29. * @param demod FSKDemod instance
  30. * @param polarity sample polarity
  31. * @param time sample time
  32. * @param value demodulated bit value
  33. * @param count demodulated bit count
  34. */
  35. void fsk_demod_feed(FSKDemod* demod, bool polarity, uint32_t time, bool* value, uint32_t* count);
  36. #ifdef __cplusplus
  37. }
  38. #endif