All checks were successful
ESP32 Build & Release / build (push) Successful in 1m11s
54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
/*
|
|
* MTG RFID Companion - MFRC522 RFID manager (Core 0)
|
|
*
|
|
* Phase 3: Initializes the MFRC522 as a device on the shared SPI2_HOST bus,
|
|
* registers an ESP event loop listener for card state changes, converts UIDs
|
|
* to uppercase hex strings, and pins the polling task to Core 0.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "esp_err.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define RFID_UID_STR_MAX_LEN (24) /* 10 bytes x 2 hex chars */
|
|
|
|
/**
|
|
* @brief Initialize the MFRC522 driver and register event listeners.
|
|
* @return ESP_OK on success.
|
|
*/
|
|
esp_err_t rfid_manager_init(void);
|
|
|
|
/**
|
|
* @brief Start polling for cards and pin the polling task to Core 0.
|
|
* @return ESP_OK on success.
|
|
*/
|
|
esp_err_t rfid_manager_start(void);
|
|
|
|
/**
|
|
* @brief Return the most recently scanned UID (uppercase hex, no separators).
|
|
* 8 chars for 4-byte UIDs, 14 chars for 7-byte UIDs.
|
|
*/
|
|
const char *rfid_manager_last_uid(void);
|
|
|
|
/**
|
|
* @brief True once a new card has been scanned since the last poll().
|
|
*/
|
|
bool rfid_manager_has_pending_card(void);
|
|
|
|
/**
|
|
* @brief Clear the pending-card flag (call after consuming the UID).
|
|
*/
|
|
void rfid_manager_consume_card(void);
|
|
|
|
/**
|
|
* @brief Pause or resume RFID polling task (e.g. during OTA flash write).
|
|
*/
|
|
void rfid_manager_pause(bool pause);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |