Compare commits
No commits in common. "a438cb13d4f9f53fc9dc68a89f69968fba0b7290" and "73d80312aa8b963607d2b6b01105eca38bb38826" have entirely different histories.
a438cb13d4
...
73d80312aa
2 changed files with 9 additions and 18 deletions
|
@ -30,15 +30,7 @@ struct uidNode {
|
||||||
|
|
||||||
class RFID {
|
class RFID {
|
||||||
public:
|
public:
|
||||||
/***
|
RFID() : comData{}, sd(SD) {};
|
||||||
* Use the main SPI port and NFC chip select by default, but allow choosing
|
|
||||||
* an alternate chip select and/or SPI bus if needed to allow multiple
|
|
||||||
* RFID readers in parallel.
|
|
||||||
*/
|
|
||||||
explicit RFID(const uint8_t chipSelect = pin_NFC1_CS, SPIClass &spiBus = SPI) :
|
|
||||||
driverPin(chipSelect), driverSpi(driverPin, spiBus),
|
|
||||||
mfrc(driverSpi), comData{}, sd(SD) {};
|
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
/***
|
/***
|
||||||
* Check if any new tags are present or have left. Only one event is reported
|
* Check if any new tags are present or have left. Only one event is reported
|
||||||
|
@ -62,9 +54,9 @@ private:
|
||||||
uidNode* activeTags = nullptr;
|
uidNode* activeTags = nullptr;
|
||||||
uidNode* nextFreeTagSlot = activeTagsArray;
|
uidNode* nextFreeTagSlot = activeTagsArray;
|
||||||
|
|
||||||
MFRC522DriverPinSimple driverPin;
|
MFRC522DriverPinSimple driverPin{pin_NFC1_CS};
|
||||||
MFRC522DriverSPI driverSpi;
|
MFRC522DriverSPI driverSpi{driverPin};
|
||||||
MFRC522 mfrc;
|
MFRC522 mfrc{driverSpi};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Array used to read and write blocks to the tags. Blocks are 16 bytes but
|
* Array used to read and write blocks to the tags. Blocks are 16 bytes but
|
||||||
|
|
|
@ -68,13 +68,12 @@ __attribute__((noreturn)) int main() {
|
||||||
|
|
||||||
tagEvent = rfid.checkTags();
|
tagEvent = rfid.checkTags();
|
||||||
if (tagEvent) {
|
if (tagEvent) {
|
||||||
|
tagEvent = 4;
|
||||||
Com::sendFigUpdate(tagEvent);
|
Com::sendFigUpdate(tagEvent);
|
||||||
/* Currently, we only play effects when placing a new figurine. */
|
/* Start the audio first because of the possible WAV parsing delay. */
|
||||||
if (!isIdGone(tagEvent)) {
|
|
||||||
/* Start the audio first as WAV parsing might delay playback. */
|
|
||||||
speaker.playNewSound(tagEvent);
|
speaker.playNewSound(tagEvent);
|
||||||
lcd.startNewAnim(tagEvent);
|
lcd.startNewAnim(tagEvent);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Drop delay, WFE+timer interrupt(s) ? */
|
/* TODO: Drop delay, WFE+timer interrupt(s) ? */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue