feat: added proper config for SPI config

This commit is contained in:
SWETRAK
2026-07-03 23:59:58 +02:00
parent a3cfa44d82
commit f7572e82ea
+11 -2
View File
@@ -1,6 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <Wire.h> #include <Wire.h>
#include <MFRC522.h> #include <MFRC522.h>
#include <SPI.h>
#define SDA_PIN 21 #define SDA_PIN 21
#define SCL_PIN 22 #define SCL_PIN 22
@@ -10,9 +11,13 @@
// Card reader pins // Card reader pins
#define READER_COUNT 6 #define READER_COUNT 6
#define RST_PIN 9 #define MISO_PIN 19
#define MOSI_PIN 23
#define SCK_PIN 18
#define SS_ONE_PIN 10 #define RST_PIN 27
#define SS_ONE_PIN 26
#define SS_TWO_PIN 5 #define SS_TWO_PIN 5
#define SS_THREE_PIN 4 #define SS_THREE_PIN 4
#define SS_FOUR_PIN 2 #define SS_FOUR_PIN 2
@@ -33,6 +38,7 @@ const byte READER_ADDRESSES[READER_COUNT] = {
0x04, 0x05, 0x06, 0x07, 0x08, 0x09}; 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};
// List of proper cards uuid's // List of proper cards uuid's
// TODO: Update this UUID's to the specific cards that will be used
const byte CORRECT_UIDS[READER_COUNT][4] = { const byte CORRECT_UIDS[READER_COUNT][4] = {
{0xDE, 0xAD, 0xBE, 0xEF}, // Reader 1 {0xDE, 0xAD, 0xBE, 0xEF}, // Reader 1
{0xCA, 0xFE, 0xBA, 0xBE}, // Reader 2 {0xCA, 0xFE, 0xBA, 0xBE}, // Reader 2
@@ -67,6 +73,9 @@ void setup()
Wire.onRequest(requestEvent); Wire.onRequest(requestEvent);
// Initialize SPI with specified pins
SPI.begin(SCK_PIN, MISO_PIN, MOSI_PIN, -1);
initializeReaders(); initializeReaders();
} }