Enhance HardwareRfid class with detailed logging and hardware verification; update main loop to log detected RFID tags
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <MFRC522.h>
|
||||
#include <functional>
|
||||
#include "hardware.pb.h"
|
||||
#include <MFRC522.h>
|
||||
|
||||
typedef std::function<void(const hardware_SensorToControlMessage&)> RfidCallback;
|
||||
|
||||
/**
|
||||
* @class HardwareRfid
|
||||
* @brief Manages an MFRC522 RFID reader on ESP8266.
|
||||
* Reads card UIDs and sends them via a callback using hardware_SensorToControlMessage.
|
||||
*/
|
||||
class HardwareRfid {
|
||||
public:
|
||||
using RfidCallback = void (*)(const hardware_SensorToControlMessage&);
|
||||
|
||||
/**
|
||||
* @brief Constructor for HardwareRfid.
|
||||
* @param ssPin SPI Slave Select (SS) pin for MFRC522.
|
||||
* @param rstPin Reset pin for MFRC522.
|
||||
*/
|
||||
HardwareRfid(uint8_t ssPin, uint8_t rstPin);
|
||||
void begin();
|
||||
void end();
|
||||
@@ -16,5 +25,5 @@ public:
|
||||
|
||||
private:
|
||||
MFRC522 _mfrc;
|
||||
RfidCallback _callback;
|
||||
};
|
||||
RfidCallback _callback = nullptr;
|
||||
};
|
||||
Reference in New Issue
Block a user