From f7572e82ea281fbdb32b41537d5393550dbf536d Mon Sep 17 00:00:00 2001 From: SWETRAK Date: Fri, 3 Jul 2026 23:59:58 +0200 Subject: [PATCH] feat: added proper config for SPI config --- APL_Slave_1/src/main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/APL_Slave_1/src/main.cpp b/APL_Slave_1/src/main.cpp index cadbf52..0183c1e 100644 --- a/APL_Slave_1/src/main.cpp +++ b/APL_Slave_1/src/main.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #define SDA_PIN 21 #define SCL_PIN 22 @@ -10,9 +11,13 @@ // Card reader pins #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_THREE_PIN 4 #define SS_FOUR_PIN 2 @@ -33,6 +38,7 @@ const byte READER_ADDRESSES[READER_COUNT] = { 0x04, 0x05, 0x06, 0x07, 0x08, 0x09}; // 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] = { {0xDE, 0xAD, 0xBE, 0xEF}, // Reader 1 {0xCA, 0xFE, 0xBA, 0xBE}, // Reader 2 @@ -67,6 +73,9 @@ void setup() Wire.onRequest(requestEvent); + // Initialize SPI with specified pins + SPI.begin(SCK_PIN, MISO_PIN, MOSI_PIN, -1); + initializeReaders(); }