encoder_cyfral.h 965 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @file encoder_cyfral.h
  3. *
  4. * Cyfral pulse format encoder
  5. */
  6. #pragma once
  7. #include <stdlib.h>
  8. #include <stdint.h>
  9. #include <stdbool.h>
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. typedef struct EncoderCyfral EncoderCyfral;
  14. /**
  15. * Allocate Cyfral encoder
  16. * @return EncoderCyfral*
  17. */
  18. EncoderCyfral* encoder_cyfral_alloc();
  19. /**
  20. * Deallocate Cyfral encoder
  21. * @param cyfral
  22. */
  23. void encoder_cyfral_free(EncoderCyfral* cyfral);
  24. /**
  25. * Reset Cyfral encoder
  26. * @param cyfral
  27. */
  28. void encoder_cyfral_reset(EncoderCyfral* cyfral);
  29. /**
  30. * Set data to be encoded to Cyfral pulse format, 2 bytes
  31. * @param cyfral
  32. * @param data
  33. * @param data_size
  34. */
  35. void encoder_cyfral_set_data(EncoderCyfral* cyfral, const uint8_t* data, size_t data_size);
  36. /**
  37. * Pop pulse from Cyfral encoder
  38. * @param cyfral
  39. * @param polarity
  40. * @param length
  41. */
  42. void encoder_cyfral_get_pulse(EncoderCyfral* cyfral, bool* polarity, uint32_t* length);
  43. #ifdef __cplusplus
  44. }
  45. #endif