The software needs tag data to be able to send programming requests, so
go through the active tags and extract the data in the new Com structs.
programTag() handles tag wakeup and selection, so might fail if the
requested tag is on another reader. This allows chaining them together
and not keeping track of which tag which reader sees.
Add an assert in case the communication buffer would get too small to
send all active tags as the protocol does not define a multi-message
response.
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.
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.
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.