You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is after applying pull requests #20, #22, #24
The pin map:
/* * SPI for sdcard of esp32-cam and rc522*/#defineSPI_MISO 2
#defineSPI_MOSI 15
#defineSPI_SCLK 14
#defineSDCARD_CS (13) // the chip select pin for sdcard
#defineRC522_SS (16) // the chip select pin for scanner
esp_err_tinitialize_rc522(rc522_handle_t*out)
{
rc522_config_tconfig= {
#if defined CONFIG_IDF_TARGET_ESP32||CONFIG_IDF_TARGET_ESP32S2
.spi.host=HSPI_HOST,
#else
.spi.host=SPI2_HOST#endif// .spi.miso_gpio = SPI_MISO,// .spi.mosi_gpio = SPI_MOSI,// .spi.sck_gpio = SPI_SCLK,
.spi.sda_gpio=RC522_SS,
.spi.bus_is_initialized= true, // use existing spi bus created for sdcard
};
esp_err_tret=ESP_OK;
if (ESP_OK== (ret=rc522_create(&config, &scanner)))
{
*out=scanner;
ESP_LOGI(TAG, "Registering event handler for rc522 events.");
rc522_register_events(scanner, RC522_EVENT_ANY, rc522_handler, NULL);
ESP_LOGI(TAG, "Starting the rc522 scanner.");
if (ESP_OK!= (ret=rc522_start(scanner)))
{
ESP_LOGE(TAG, "Error %s from rc522_start", esp_err_to_name(ret));
}
}
else
{
ESP_LOGE(TAG, "Couldn't create rc522 scanner. %s", esp_err_to_name(ret));
}
returnret;
}
The above function calling block:
{
uint8_tsd_valid=0; // 1 if card is valid sdmmc_card_t else 0sdmmc_card_t*card=NULL;
uint8_trfid_scanner_valid=0; // 1 if rfid scanner is valid rc522 scanner else 0rc522_handle_tscanner=NULL;
/** Not using when using rc522 as both use SPI protocol */if (USE_ESP32CAM==1)
{
// initialize cameraESP_LOGI(TAG, "Initializing camera for taking photo.\n");
camera_init();
// taking a photoESP_LOGI(TAG, "Taking a photo");
camera_capture();
if (ESP_OK==init_sd_card(&card))
{
sd_valid=1;
}
}
if (USE_RC522==1)
{
// initialize rfid stuffsESP_LOGI(TAG, "Initializing rc522 for rfid scan.\n");
if (ESP_OK==initialize_rc522(&scanner))
rfid_scanner_valid=1;
}
// ...// some other logic to blink leds to keep main loop alive//...
}
Log for initialization of sdcard followed by rc522
This is after applying pull requests #20, #22, #24
The pin map:
sdcard is initialized in the following way:
rc522 is initialized in the following way:
The above function calling block:
Log for initialization of sdcard followed by rc522
The text was updated successfully, but these errors were encountered: