Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MFRC522 support for customizable SPI pins #18711

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tasmota/my_user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@
// #define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module
// #define USE_DISPLAY_SSD1331 // [DisplayModel 14] Enable SSD1331 module
// #define USE_RC522 // Add support for MFRC522 13.56Mhz Rfid reader (+6k code)
// #define RC522_USE_CONFIGURED_SPI_PINS // Use the SPI 1 interface as configured via the template for communication with RC522
// #define USE_RC522_DATA_FUNCTION // Add support for reading data block content (+0k4 code)
// #define USE_RC522_TYPE_INFORMATION // Add support for showing card type (+0k4 code)
// #define USE_MCP2515 // Add support for can bus using MCP2515 (+7k code)
Expand Down
4 changes: 4 additions & 0 deletions tasmota/tasmota_xsns_sensor/xsns_80_mfrc522.ino
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ void RC522ScanForTag(void) {
void RC522Init(void) {
if (PinUsed(GPIO_RC522_CS) && PinUsed(GPIO_RC522_RST) && TasmotaGlobal.spi_enabled) {
Mfrc522 = new MFRC522(Pin(GPIO_RC522_CS), Pin(GPIO_RC522_RST));
#ifdef RC522_USE_CONFIGURED_SPI_PINS
SPI.begin(Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI));
#else
SPI.begin();
#endif
Mfrc522->PCD_Init();
// if (Mfrc522->PCD_PerformSelfTest()) { // Saves 0k5 code
uint8_t v = Mfrc522->PCD_ReadRegister(Mfrc522->VersionReg);
Expand Down