2021-05-04 13:21:16 +00:00
|
|
|
#pragma once
|
2022-01-05 16:10:18 +00:00
|
|
|
//#include "decoder_analyzer.h"
|
|
|
|
#include "decoder_gpio_out.h"
|
|
|
|
#include "decoder_emmarin.h"
|
|
|
|
#include "decoder_hid26.h"
|
|
|
|
#include "decoder_indala.h"
|
2022-05-23 13:21:34 +00:00
|
|
|
#include "decoder_ioprox.h"
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "key_info.h"
|
2021-05-04 13:21:16 +00:00
|
|
|
|
2021-08-09 12:33:13 +00:00
|
|
|
//#define RFID_GPIO_DEBUG 1
|
|
|
|
|
2021-05-04 13:21:16 +00:00
|
|
|
class RfidReader {
|
|
|
|
public:
|
|
|
|
enum class Type : uint8_t {
|
|
|
|
Normal,
|
|
|
|
Indala,
|
|
|
|
};
|
|
|
|
|
|
|
|
RfidReader();
|
2021-08-01 22:11:18 +00:00
|
|
|
void start();
|
|
|
|
void start_forced(RfidReader::Type type);
|
2021-05-04 13:21:16 +00:00
|
|
|
void stop();
|
2021-11-16 08:47:49 +00:00
|
|
|
bool read(LfrfidKeyType* type, uint8_t* data, uint8_t data_size, bool switch_enable = true);
|
2021-05-04 13:21:16 +00:00
|
|
|
|
2021-08-01 22:11:18 +00:00
|
|
|
bool detect();
|
|
|
|
bool any_read();
|
|
|
|
|
2021-05-04 13:21:16 +00:00
|
|
|
private:
|
|
|
|
friend struct RfidReaderAccessor;
|
|
|
|
|
|
|
|
//DecoderAnalyzer decoder_analyzer;
|
2021-08-09 12:33:13 +00:00
|
|
|
#ifdef RFID_GPIO_DEBUG
|
|
|
|
DecoderGpioOut decoder_gpio_out;
|
|
|
|
#endif
|
2021-08-10 23:09:51 +00:00
|
|
|
DecoderEMMarin decoder_em;
|
2021-05-04 13:21:16 +00:00
|
|
|
DecoderHID26 decoder_hid26;
|
|
|
|
DecoderIndala decoder_indala;
|
2022-05-23 13:21:34 +00:00
|
|
|
DecoderIoProx decoder_ioprox;
|
2021-05-04 13:21:16 +00:00
|
|
|
|
|
|
|
uint32_t last_dwt_value;
|
|
|
|
|
|
|
|
void start_comparator(void);
|
|
|
|
void stop_comparator(void);
|
|
|
|
|
|
|
|
void decode(bool polarity);
|
|
|
|
|
2021-08-01 22:11:18 +00:00
|
|
|
uint32_t detect_ticks;
|
|
|
|
|
|
|
|
uint32_t switch_os_tick_last;
|
|
|
|
bool switch_timer_elapsed();
|
|
|
|
void switch_timer_reset();
|
|
|
|
void switch_mode();
|
|
|
|
|
2022-04-14 12:03:47 +00:00
|
|
|
LfrfidKeyType last_read_type;
|
|
|
|
uint8_t last_read_data[LFRFID_KEY_SIZE];
|
|
|
|
uint8_t last_read_count;
|
2021-08-01 22:11:18 +00:00
|
|
|
|
2021-05-04 13:21:16 +00:00
|
|
|
Type type = Type::Normal;
|
|
|
|
};
|