uhf_data.h 840 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdlib.h>
  4. #define MAX_DATA_SIZE 32
  5. typedef struct UHFData {
  6. uint8_t data[MAX_DATA_SIZE];
  7. size_t length;
  8. bool start;
  9. bool end;
  10. struct UHFData* next;
  11. } UHFData;
  12. typedef struct UHFResponseData {
  13. UHFData* head;
  14. UHFData* tail;
  15. size_t size;
  16. } UHFResponseData;
  17. UHFData* uhf_data_alloc();
  18. int uhf_data_append(UHFData* uhf_data, uint8_t data);
  19. void uhf_data_reset(UHFData* uhf_data);
  20. void uhf_data_free(UHFData* uhf_data);
  21. UHFResponseData* uhf_response_data_alloc();
  22. UHFData* uhf_response_data_add_new_uhf_data(UHFResponseData* uhf_response_data);
  23. UHFData* uhf_response_data_get_uhf_data(UHFResponseData* uhf_response_data, uint index);
  24. void uhf_response_data_reset(UHFResponseData* uhf_response_data);
  25. void uhf_response_data_free(UHFResponseData* uhf_response_data);