RFID: functional tag reading
Add a new class to handle the RFID module and associated data in order to track active tags. Update main with RFID initialization and a minimal usage to check it is working as expected.
This commit is contained in:
parent
07654829ed
commit
ec2c71b0be
3 changed files with 219 additions and 4 deletions
16
src/main.cpp
16
src/main.cpp
|
@ -1,11 +1,9 @@
|
|||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
|
||||
#include <MFRC522v2.h>
|
||||
|
||||
#include "Pinout.h"
|
||||
|
||||
#include "RFID.h"
|
||||
|
||||
__attribute__((noreturn)) int main() {
|
||||
pinMode(pin_DBG_LED_1, OUTPUT);
|
||||
pinMode(pin_DBG_LED_2, OUTPUT);
|
||||
|
@ -41,9 +39,19 @@ __attribute__((noreturn)) int main() {
|
|||
Serial.println("# System is powered up, running set-up.");
|
||||
|
||||
/* TODO: Setups once module structure is up. */
|
||||
RFID rfid;
|
||||
digitalWrite(pin_NFC1_RST, HIGH);
|
||||
rfid.init();
|
||||
|
||||
/* Main loop */
|
||||
while (true) {
|
||||
int8_t tagID;
|
||||
|
||||
tagID = rfid.checkTags();
|
||||
if (tagID) {
|
||||
Serial.printf("Check tag result : %d\n", tagID);
|
||||
}
|
||||
|
||||
delay(100);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue