Demo app program flow – ThingMagic Mercury xPRESS Platform v1.7 User Manual
Page 27

RFID Sensor Application
A D I V I S I O N O F T R I M B L E
Using the Sample Application
27
RFID reader task
Keyboard output task
EPC formatter function
Custom drivers: Bluetooth module
These functional utilities interact with each other as shown in the diagram below:
Demo App Program Flow
Execution starts at xpressReader/app_demo/main.c, which launches 2 tasks:
RfidReader and KBWedge.
Task RfidReader runs task_rfid, which controls the reader.
Task KBWedge runs task_wedge, which controls the UI (keyboard output,
pushbutton inputs).
The workflow begins when the user presses the read trigger button
pin_edge_handler fires on the falling edge of the button press, having previously
been set up by wedge_configure_buttons, which was called in task_wedge’s
initialization.
pin_edge_handler reads the current state of the read trigger button and sets the
global activateTagReads accordingly.
task_rfid monitors activateTagReads. When it becomes true, it enters readTags.
readTags operates the RFID reader then calls reportTags to retrieve the tag
reads.
reportTags fetches each tag read, formats it, then adds it to epcQueue
task_wedge constantly runs wedge_ui_process, which executes the state machine
that generates USB HID keyboard output. This has to be written as a state machine
because the USB host polls for one HID message at a time, and each HID message
corresponds to a single keypress (or release.) Note that only low-speed USB
connections do not poll automatically, so task_wedge’s inner loop only needs to run
in that case. For faster USB modes, the USB driver calls wedge_ui_process
directly.