The driver is implemented as a single thread so you just need to make sure functions are always called from a single thread (it is not designed to be thread safe). All RFID operations are carried out using a non stalling state machine approach.
void rfid_process (void)
This function should be called regularly as part of your applications main loop.
void rfid_read_tag (void)
Call this function to start the read tag process
BYTE rfid_get_read_tag_result (void)
Call this function to check for the end of the read tag process. It returns 0 if still reading, 1 if completed. Bit 7 will be set if the read failed.
After a sucessful read the ASCII tag ID will be in rfid_data_nibbles[0] | rfid_data_nibbles[9]
void rfid_sampling_rising_edge (WORD us_since_last_rising_edge)
Call with us_since_last_rising_edge = The time in uS since the last edge interrupt. You application interrupt hander must create this value from an available microcontroller timer. The maximum time between interrupts will be approximately 1024uS, so your timer calculation only needs to deal with time values of up to say 1280uS (to give a reasonable margin of worst case tollerance).
Call with the timer value captured as close as possible to the rising edge occuring (reduce latency as much as possible).
This fucntion will ignore the value for the first 2 calls allowing for initial timer error.
void rfid_force_initialise (void)
In typical use this function is not requried as the driver will automatically initialise the HTRC110 IC on powerup. However if you are using this driver with multiple HTRC110 devices (for instance by switching the SCLK, DIN and DOUT lines by using one or more 74HC4053 IC’s) then this function can be called during your applications initialisation after selecting each HTRC110. To read each HTRC110 call rfid_read_tag() and wait for rfid_get_read_tag_result() to return a completed result before switching to the next HTRC.


