rfid-reader.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. //#include "decoder-analyzer.h"
  3. #include "decoder-gpio-out.h"
  4. #include "decoder-emmarine.h"
  5. #include "decoder-hid26.h"
  6. #include "decoder-indala.h"
  7. #include "key-info.h"
  8. class RfidReader {
  9. public:
  10. enum class Type : uint8_t {
  11. Normal,
  12. Indala,
  13. };
  14. RfidReader();
  15. void start();
  16. void start_forced(RfidReader::Type type);
  17. void stop();
  18. bool read(LfrfidKeyType* type, uint8_t* data, uint8_t data_size);
  19. bool detect();
  20. bool any_read();
  21. private:
  22. friend struct RfidReaderAccessor;
  23. //DecoderAnalyzer decoder_analyzer;
  24. //DecoderGpioOut decoder_gpio_out;
  25. DecoderEMMarine decoder_em;
  26. DecoderHID26 decoder_hid26;
  27. DecoderIndala decoder_indala;
  28. uint32_t last_dwt_value;
  29. void start_comparator(void);
  30. void stop_comparator(void);
  31. void decode(bool polarity);
  32. uint32_t detect_ticks;
  33. uint32_t switch_os_tick_last;
  34. bool switch_timer_elapsed();
  35. void switch_timer_reset();
  36. void switch_mode();
  37. LfrfidKeyType last_readed_type;
  38. uint8_t last_readed_data[LFRFID_KEY_SIZE];
  39. uint8_t last_readed_count;
  40. Type type = Type::Normal;
  41. };