decoder-hid26.h 510 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <stdint.h>
  3. #include <atomic>
  4. class DecoderHID26 {
  5. public:
  6. bool read(uint8_t* data, uint8_t data_size);
  7. void process_front(bool polarity, uint32_t time);
  8. DecoderHID26();
  9. private:
  10. uint32_t last_pulse_time = 0;
  11. bool last_pulse;
  12. uint8_t pulse_count;
  13. uint32_t stored_data[3] = {0, 0, 0};
  14. void store_data(bool data);
  15. void validate_stored_data();
  16. uint8_t facility = 0;
  17. uint16_t number = 0;
  18. std::atomic<bool> ready;
  19. void reset_state();
  20. };