This commit is contained in:
2026-09-12 03:40:10 +02:00
parent 029ceee69a
commit 8ac465229c
20 changed files with 220 additions and 422 deletions

View File

@@ -11,7 +11,6 @@
#include "rc522_picc.h"
#include "driver/rc522_spi.h"
#include "hw_pins.h"
#include "spi_bus_manager.h"
#include "rfid_manager.h"
static const char *TAG = "rfid";
@@ -72,12 +71,6 @@ static void on_picc_state_changed(void *arg, esp_event_base_t base, int32_t even
}
}
/* Read the MFRC522 VersionReg (0x37) directly over SPI3 with a temporary
* hardware-CS device. Any plausible value (0x88/0x91/0x92) means the chip is
* alive and MISO works; 0x00/0xFF means MISO/power/wiring is dead. This is a
* pure diagnostic and does not depend on the rc522 driver's reset path. */
esp_err_t rfid_manager_init(void)
{
esp_log_level_set("rc522", ESP_LOG_INFO);
@@ -166,8 +159,10 @@ esp_err_t rfid_manager_start(void)
#else
if (ret != ESP_OK) {
ESP_LOGE(TAG, "MFRC522 self-test failed (%s). Check: reader powered "
"(3.3V), SPI wiring (SCK=16/MOSI=17/MISO=13, CS=26, RST=22), "
"and if it is a clone try lowering RC522_SPI_CLK_HZ", esp_err_to_name(ret));
"(3.3V), SPI wiring (SCK=%d/MOSI=%d/MISO=%d, CS=%d, RST=%d), "
"and if it is a clone try lowering RC522_SPI_CLK_HZ",
esp_err_to_name(ret),
HW_RFID_SCK_GPIO, HW_RFID_MOSI_GPIO, HW_RFID_MISO_GPIO, HW_RC522_CS_GPIO, HW_RC522_RST_GPIO);
return ret;
}
#endif
@@ -182,7 +177,7 @@ esp_err_t rfid_manager_start(void)
ESP_LOGW(TAG, "%s handle not found, affinity not set", RC522_TASK_NAME);
}
ESP_LOGI(TAG, "RFID scanner ready (SPI3_HOST, CS=%d)RST=%d)",
ESP_LOGI(TAG, "RFID scanner ready (SPI3_HOST, CS=%d RST=%d)",
HW_RC522_CS_GPIO, HW_RC522_RST_GPIO);
return ESP_OK;
}