1
0
Fork 0
Commit graph

14 commits

Author SHA1 Message Date
3ee09f284a RFID: Change the checkTag fail return
Previously, checkTag() returned 0 when it failed or when there was no changes.
This is fine if we are only expecting already programmed tags, but as tags
arrive new with blocks zeroed out, which conflicts with the 0 return value.

Introduce a new constant to RFID for the return error, -1, and use it
instead of 0 everywhere.
Update comments and README to highlight this new reserved ID.
2024-03-07 23:05:14 +00:00
38e4982aac RFID: Implement tag programming
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.
2024-01-06 00:36:19 +00:00
b5b5268b79 Com: Implement tag programming
Define the protocol allowing the software to track tags
and program them, in the README.

The data structure is shared between a programming command and an
information message, so create a new struct for it and an array
to keep track of it and expose to the rest of the program.
The goal is to keep the protocol core and message construction
entirely inside Com, so this intermediary buffer allows exposing
it outside while hiding the protocol details.

This means that we are starting to receive data from the software,
so implement generic functions to check and receive data as well
as receiveMessage() which parses the message and handles them.
2024-01-06 00:32:19 +00:00
324cf50653 RFID: Implement writing to blocks
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.
2024-01-06 00:25:46 +00:00
73ceeb493c RFID: Clean up and generalize
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.
2024-01-06 00:15:48 +00:00
aaa2b6553c RFID: Update definitions to allow a second reader
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.
2023-12-17 21:39:09 +00:00
a7c2856ef6 Speaker: Introduce audio playback
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.
2023-10-22 21:19:29 +01:00
caff96922e Com: Make the comment length explicit
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.
2023-10-22 21:16:49 +01:00
69909851c2 LCD: Introduce LCD display and animations
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.
2023-10-21 22:01:10 +01:00
6c5a670366 IDs: Introduce ID handling functions and data
IDs will be needed by multiple subsystems, so introduce the needed
variables and handling functions.
2023-10-21 18:23:43 +01:00
da837ffbb4 RFID: Update comment refering to -ID
When a tag leaves, we don't negate the ID which would be
implied by writing -ID.
Clarify that we set the sign bit instead.
2023-10-16 22:16:47 +01:00
bedd1f4f95 Com: Implement proper communications
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.
2023-09-24 18:04:27 +01:00
ec2c71b0be 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.
2023-09-10 20:28:27 +01:00
09ebef0615 Add pinout
Pinout was autogenerated from KiCad and adapted for readability
2023-09-09 18:19:57 +01:00