In order to set the ID to the tag, we need to be able to write blocks.
Implement writeBlock() similarly to readBlock() to allow that.
Make sure to clean the communication buffer and handle failure states,
this will become more important for dual RFID readers as will allow
'chaining' calls and cover both readers without keeping track of
what reader sees what tag.
Only allow to write a byte for now, we don't need more.
Add a constant for the ID block used and replace it.
Clean up some comments and clarify expectations.
readBlock() did not properly halt tags after errors and the else
clause was superfluous. Properly handle error status.
Move currentActiveTags to be static and initialize it.
This allows for keeping track of max/current tags accross multiple instances.
Remove the overide of the tag value used for testing.
We don't plan yet on playing effects when a tag leaves, so avoid
playing the effects twice and only do so when arriving.
The board has a second SPI bus wired up for communication with two RFID readers
if needed.
However, the code only provided a constructor with no arguments, preventing
the use of a second instance on the different bus.
Update the constructor and the definitions to allow changing the chip select
and SPI bus used when creating an RFID reader.
Platformio supports multiple environments and sharing a global configuration.
Make use of this to easily allow switching between the production build, with HID,
and the development build, with serial.
Update the README with information on how to build those environments.
Introduce the Speaker class to play audio from the SD card when detecting
tags.
The only audio supported is WAV.
Audio playback is handled via interrupts, so it might try to read from the
SD card at the same time as the LCD class is trying to read new frames.
Update the LCD animation code to temporarily disable audio interrupts while
reading from the SD card.
sendComment cannot send more than 62 bytes, as limited by the HID report.
Sending more is prevented by vsnprintf, but change the function signature
to make it explicit that the array passed to it should be at most 62 bytes.
Add support for the LCD and using it for displaying animations.
Animations are automatically played if available for the ID of the
detected tag.
The code should support adding other kind of animations, for tags being
removed or for other UI interactions for example.
The next commit implements the LCD and animation support. To enable an easy
way to create animations for it, add details in the README regarding the way
the SD card is used and how the files need to be formatted.
Create the Utils directory and add a Rust project to do the bit flipping and
a script that automates all the steps described in the README.
Add a README for Utils explaining how to use them.
Implement a set of functions to create messages following the protocols
defined in the README for communication.
Handle HID, which is used to communicate with the interactive application.
Update README with details on the message structures.
Previously, the return value when a tag was gone was the negative ID.
However, this isn't the most effective to process later as a negative
number uses two's complement, changing all lower bits in addition
to the sign bit.
Change this to just set the sign bit instead. This still produces
a negative number, which is what we want to check to konw if the tag
is new or went away, but maintains the lower bits so the ID can be
retrieved with a simple bit-wise and.
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.
pinMode most of what could be useful in the main and put modules
LOW to minimize power draw before the regulator is ON.
Add the skeleton for the setup, main loop and battery level checking.