Phase 3: MFRC522 RFID subsystem on Core 0 with UID hex conversion, enable FreeRTOS SMP
This commit is contained in:
49
main/rfid_manager.h
Normal file
49
main/rfid_manager.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user