![]() |
STM8L libraries for CR95HF 1.0
|
This file contains all the functions in order to send commands to a contactless tag respecting/performing iso15693 standards. Note that command dealing with multiple blocks (write read get status) utilize internal eeprom of the MCU whereas other commands use flash program memory. More...
#include "iso15693_command.h"
Functions | |
u8 | ISO15693_Inventory (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 Tag_AFI, const u8 MaskLength, const u8 *Mask, u8 *Inventory_16_slots_Nb_UID_Retrieved) |
This function sends, through the CR95HF, to a contactless tag, an inventory command and fills the Tag structure if some contactless tag answers. Note that if there are 16 slots it's recommend to set the CR95HF into WAIT302µs parameter with the protocol select command. Indeed, if the CR95HF is in Wait SOF mode it will waits up to 20ms before returning that there is no tag in the field whereas by waiting ionly 302 µs it allows to the application to know more rapidly that there is no tag and to send an EOF to switch to the next slot. | |
u8 | ISO15693_Stay_Quiet (const u8 Request_flags, const u8 *Tag_UID) |
This function sends, through the CR95HF, a stay quiet command to a unique contactless tag designated by its UID. | |
u8 | ISO15693_Read_Single_Block (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID, const u8 Block_number) |
This function sends, through the CR95HF, a read single block command to the contactless tag in the field or to an unique contactless tag designated by its UID. | |
u8 | ISO15693_Write_Single_Block (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID, const u8 Block_number, const u8 Block_Length, const u8 *Data) |
This function sends, through the CR95HF, a write single block command to the contactless tag in the field or to an unique contactless tag designated by its UID. | |
u8 | ISO15693_Lock_Block (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID, const u8 Block_number) |
This function sends, through the CR95HF, a lock block command to the contactless tag in the field or to an unique contactless tag designated by its UID. | |
u8 | ISO15693_Read_Multiple_Block (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID, const u8 First_Block_number, const u8 Number_of_Blocks) |
This function sends, through the CR95HF, a read multiple block command to the contactless tag in the field or to an unique contactless tag designated by its UID. Note that data received are stored into the internal EEPROM of the MCU. | |
u8 | ISO15693_Select (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID) |
This function sends, through the CR95HF, a select command to the unique contactless tag designated by its UID. | |
u8 | ISO15693_Reset_to_Ready (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID) |
This function sends, through the CR95HF, a reset to ready state command to a contactless tag . This command could be used in two different case: | |
u8 | ISO15693_Write_AFI (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID, const u8 Tag_AFI) |
This function sends, through the CR95HF, a write AFI command to the contacless tag in the field or to an unique contactless tag designated by its UID. | |
u8 | ISO15693_Lock_AFI (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID) |
This function sends, through the CR95HF, a Lock AFI command to the contacless tag in the field or to an unique contactless tag designated by its UID. | |
u8 | ISO15693_Write_DSFID (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID, const u8 Tag_DSFID) |
This function sends, through the CR95HF, a write DSFID command to the contacless tag in the field or to an unique contactless tag designated by its UID. | |
u8 | ISO15693_Lock_DSFID (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID) |
This function sends, through the CR95HF, a Lock DSFID command to the contacless tag in the field or to an unique contactless tag designated by its UID. | |
u8 | ISO15693_Get_System_Info (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID) |
This function sends, through the CR95HF, an get System Information commandto the contacless tag in the field or to an unique contactless tag designated by its UID. | |
u8 | ISO15693_Get_Multiple_Blocks_Security_Status (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 *Tag_UID, const u8 First_Block_number, const u8 Number_of_Blocks) |
This function sends, through the CR95HF, a get multiple blocks security status command to the contactless tag in the field or to an unique contactless tag designated by its UID. note that data are stored into the eeprom. | |
u8 | ISO15693_Custom_Commands (ISO15693_Tag *MyTag, const u8 Request_flags, const u8 Custom, u8 IC_Mfg_Code, const u8 Parameters_Length, const u8 *Parameters) |
This function sends, through the CR95HF, a custom command to the contactless tag in the field or to an unique contactless tag designated by its UID.. User should add in parameters all the data needed. Command size is limited to MAX_DATASENT_LENGTH. | |
void | ISO15693_Add_Request_Flags_Command_code_to_command (CR95HF_CommandSending *Cmd, u8 *Cptr_ToIncrement, const u8 Request_flags, const u8 Command_Code) |
This function add the UID into the command's data and increments the counter of data if the command is addressed. | |
void | ISO15693_Add_Mask_to_command (CR95HF_CommandSending *Cmd, u8 *Cptr_ToIncrement, const u8 MaskLength, const u8 *Mask) |
This function add the Mask into the command's data and increments the counter of data. | |
void | ISO15693_Add_UID_to_command (CR95HF_CommandSending *Cmd, u8 *Cptr_ToIncrement, u8 *Tag_UID, u8 Request_flags) |
This function add the UID into the command's data and increments the counter of data if the command is addressed. | |
u8 | ISO15693_Is_ResponseFlags_noError_Detected (const u8 ISO15693_Response_flags) |
This function checks if the response flag is set or not. If set the contactless tag encountered an error while performing the command. | |
u8 | ISO15693_Is_Request_Flags_ok (const u8 Request_flags, const u8 ISO15693_cmd_code) |
This function performs several checks to verify that the request flag is not wrong. This is not a garantee that the request flags is right (depends on the contactless tag and on some commands' particularities). | |
u8 | ISO15693_Is_Collision_Flag_Set (CR95HF_ResponseReceiving *Response) |
This function checks if the check collision flag added by the CR95HF is set or not. If it is, that means that the CRC95HF has detected an collision between two contactless tag answers. | |
u8 | ISO15693_Is_CRC_Flag_Set (CR95HF_ResponseReceiving *Response) |
This function checks if the check CRC flag added by the CR95HF is set or not. If it is, that means that the CRC95HF has detected an error during the reception. | |
u8 | ISO15693_Is_CorrectCRC16_Check (CR95HF_ResponseReceiving *Response) |
This function checks the check CRC flag and the residue of the received command. If there is any problem: mismatch or error, the function returns error value. | |
u8 | ISO15693_Is_TagConstructor_STM (const ISO15693_Tag *MyTag) |
This function returns TRUE_CODE if the contactless tag has been manufactured by STMicroelectronics, the UID of the contactless tag must be known. | |
u8 | ISO15693_Is_Memory_programming_function (const u8 ISO15693_cmd_code) |
This function returns if the contactless tag performs a memory programming by processing the command. ( write, lock) | |
u8 | ISO15693_Is_DSFID_Present_Infoflag (const u8 Information_flags) |
This function returns if the DSFID is present within the contactless tag answer to a get system info command. | |
u8 | ISO15693_Is_AFI_Present_Infoflag (const u8 Information_flags) |
This function returns if the AFI is present within the contactless tag answer to a get system info command. | |
u8 | ISO15693_Is_MemSize_Present_Infoflag (const u8 Information_flags) |
This function returns if the Memsize is present within the contactless tag answer to a get system info command. | |
u8 | ISO15693_Is_ICRef_Present_Infoflag (const u8 Information_flags) |
This function returns if the ICREF is present within the contactless tag answer to a get system info command. | |
u8 | ISO15693_Get_Subcarrier_Flag (const u8 Request_flags) |
This function returns the subcarrier flag determining if the contactless tag's response is made with one or two subcarriers. | |
u8 | ISO15693_Get_DataRate_Flag (const u8 Request_flags) |
This function returns the datarate flag determining if the contactless tag's response is made in high or low datarate. | |
u8 | ISO15693_Get_Inventory_Flag (const u8 Request_flags) |
This function returns the inventory flag to determine if the ccontactless should run the anticollision sequence (inventory command). | |
u8 | ISO15693_Get_ProtocolExtension_Flag (const u8 Request_flags) |
This function returns the protocol extension flag. | |
u8 | ISO15693_Get_Select_Flag (const u8 Request_flags) |
This function returns the select flag to determine if the command is destineted to the contactless tag in selected mode. Note that a check is made to ensure that the inventory flag is reset. | |
u8 | ISO15693_Get_Address_Flag (const u8 Request_flags) |
This function returns the address flag to determine if the command is addressed to the contactless tag designted by its UID. Note that a check is made to ensure that the inventory flag is reset. | |
u8 | ISO15693_Get_AFI_Flag (const u8 Request_flags) |
This function returns the AFI flag to determine if the AFI is present within the command (inventory). Note that a check is made to ensure that the inventory flag is set. | |
u8 | ISO15693_Get_Slots_Flag (const u8 RequestFlags) |
This function returns the number of slots flag (1 or 16) that the contactless tag has to answer an inventory command. Note that a check is made to ensure that the inventory flag is set. | |
u8 | ISO15693_Get_Option_Flag (const u8 Request_flags) |
This function returns the option flag. Note: this function assumes that the option flag has the same meaning whatever the inventory flag value. | |
u8 | ISO15693_Get_RFU_Flag (const u8 Request_flags) |
This function returns RFU flag. The function may need to be tailored when RFU will be defined. Note: this function assumes the RFU flag is the same whatever the inventory flag. | |
u8 | ISO15693_Get_SubCarrier_parameter_CR95HF (const CR95HF_Protocol_Config *Protocol_Settings) |
This function returns if the protocol in use is set with dual Subcarrier or single subcarrier. | |
u8 | ISO15693_Get_Modulation_parameter_CR95HF (const CR95HF_Protocol_Config *Protocol_Settings) |
this function returns if the protocol in use is set with 10 percent modulation or 100 percent modultaion | |
u8 | ISO15693_Get_Delay_parameter_CR95HF (const CR95HF_Protocol_Config *Protocol_Settings) |
this function returns if the protocol in use is set with wait Start of frame or respect 312 micro seconds delay for response slots | |
u8 | ISO15693_Get_DataRate_parameter_CR95HF (const CR95HF_Protocol_Config *Protocol_Settings) |
this function returns if the protocol in use is set with wait Start of frame or respect 312 micro seconds delay for response slots | |
u8 | ISO15693_Get_NumberofByte_MemSize_using_ICREF (const u8 ICRef) |
This functions returns the number of byte used to describe the memory size of the contactless tag (STMicroelectronics manufactured tag) | |
u8 | ISO15693_Get_Size_of_Block_using_ICRef (const u8 ICRef) |
This functions returns the size of a block using the UID of the Tag ( STMicroelectronics' manufactured contactless tag). | |
u8 | ISO15693_Get_Size_of_Block_using_MemSize (const ISO15693_Tag *MyTag) |
This functions returns the size of a block using the MemSize field of the tag structure a get system info command should have been performed before calling this function. | |
u16 | ISO15693_Get_MemSize_kbits (const u8 *MemSize, const u8 Number_of_Bytes_MemSize) |
This function returns the memory size of the contactless tag in a whole number of kilo bits .Note that the size max handled will be 256kbits. | |
u32 | ISO15693_Get_MemSize_bits (u8 *MemSize, u8 Number_of_Bytes_MemSize) |
This function returns the memory size of the contactless tag in bits. This function should be called if the size of the memory is not an interger number of kilo bits. | |
u8 | ISO15693_Get_UID_from_EEPROM (u8 *UID_Tag, u8 UID_number) |
This function retrieves the UID stored into the EEPROM by the inventory 16 slots commands. | |
int16_t | ISO15693_CRC16 (const u8 *DataIn, const u8 NbByte) |
This function computes the CRC16 as defined by CRC ISO/IEC 13239. | |
u8 | ISO15693_IsCorrectCRC16Residue (const u8 *DataIn, const u8 Length) |
this function computes the CRC16 residue as defined by CRC ISO/IEC 13239 | |
int16_t | ISO15693_CRC16_EEPROM (const u8 NbByte) |
This function computes the CRC16 as defined by CRC ISO/IEC 13239 using data stored into the internal EEPROM of the MCU. | |
u8 | ISO15693_IsCorrectCRC16Residue_EEPROM (const u8 Length) |
This function computes the CRC16 residue as defined by CRC ISO/IEC 13239 using data stored into the internal EEPROM of the MCU. | |
u8 | ISO15693_Send_Receive_Inventory_cmd (ISO15693_Tag *MyTag, CR95HF_ResponseReceiving *Response, CR95HF_CommandSending *Cmd, u8 Request_flags, u8 *status_cr95hf, u8 *Inventory_16_slots_Nb_UID_Retrieved) |
This function sends a inventory command for conctactless tag.The function checks the type of inventory : 1 or 16 slots and calls the right fucntion to send the command and to manage answers received. | |
u8 | ISO15693_Send_Receive_Single_Block_Memory_Programming_cmd (CR95HF_ResponseReceiving *Response, CR95HF_CommandSending *Cmd, const u8 Request_flags) |
This function sends to the contactless tag through the CR95HF a Single block (read, write, lock) memory programming command and receive the answer. As the contactless tag takes longer to perform that kind of the command, depending on the option flag and on the protocol parameters set the function handles the command sending and the contactless tag answer reception. | |
u8 | ISO15693_Receive_Multiple_Blocks_cmd (CR95HF_ResponseReceiving *Response) |
This function receives, trough the CR95HF, the response of the contactless tag to a readMultiple block command (read). Note that data received from the contactless tag are stored into the internal eeprom of the MCU. (the whole contactless tag frame. | |
u8 | ISO156693_Fill_in_TagStructure_Inventory_cmd (ISO15693_Tag *MyTag, CR95HF_ResponseReceiving *Response, const u8 CR95HF_command_status) |
The purpose of this function is to split the response to an inventory command into different identifiable fields gathered within the structure. | |
u8 | ISO156693_Fill_in_TagStructure_Read_Single_Block_cmd (ISO15693_Tag *MyTag, CR95HF_ResponseReceiving *Response, const u8 CR95HF_command_status, const u8 Request_flags) |
the purpose of this function is to split the response to a read single block command into different identifiable fields gathered within the structure | |
u8 | ISO156693_Fill_in_TagStructure_Read_Multiple_Blocks_cmd (ISO15693_Tag *MyTag, CR95HF_ResponseReceiving *Response, const u8 CR95HF_command_status, const u8 Number_of_Blocks) |
The purpose of this function is to split the response to a read mutliple blocks into different identifiable fields gathered within the structure. | |
u8 | ISO156693_Fill_in_TagStructure_Get_Multiple_Block_Status_cmd (ISO15693_Tag *MyTag, CR95HF_ResponseReceiving *Response, const u8 CR95HF_command_status, const u8 Number_of_Blocks) |
The purpose of this function is to split the response to a get multiple block security status command into different identifiable fields gathered within the structure. | |
void | ISO15693_Fill_in_Tag_Structure_ErrorFlag_set (ISO15693_Tag *MyTag, CR95HF_ResponseReceiving *Response) |
The purpose of the function is to fill the contactless Tag structure when the errorFlag is set in the contactless tag response. | |
u8 | ISO15693_Read_Answer_Format_Response_Flags (ISO15693_Tag *MyTag, CR95HF_ResponseReceiving *Response, const u8 Status_cr95hf) |
The purpose of the function is to read the response of the contactless tag when the response expected is only response flags, if error flag is set the function calls the ISO15693_Fill_in_Tag_Structure_ErrorFlag_set function. | |
u8 | ISO156693_Check_Data_Received_Start_Process (ISO15693_Tag *MyTag, const CR95HF_ResponseReceiving *Response, u8 *Cursor_in_response_data) |
This function checks if the data are sound (CRC ok) and filled in basic data common for all response : copy the whole data, write response_flag and data_length into the structure. | |
void | ISO15693_Retrieve_UID (ISO15693_Tag *MyTag, CR95HF_ResponseReceiving *Response, u8 *Cursor_in_response_data) |
The function fills the contactless Tag structure with the UID (Inventory and Get system info command). | |
void | ISO15693_Retrieve_ICRef (ISO15693_Tag *MyTag) |
The function fills the contactless Tag structure with the ICRef using the UID (Get system info command). Only available for contactless tag manufactured by STMicroelectronics. | |
Variables | |
CR95HF_Protocol_Config | Protocol_Settings |
u8 | SPI_or_UART_Communication |
CR95HF_CommandSending | Cmd |
CR95HF_ResponseReceiving | Response |
This file contains all the functions in order to send commands to a contactless tag respecting/performing iso15693 standards. Note that command dealing with multiple blocks (write read get status) utilize internal eeprom of the MCU whereas other commands use flash program memory.
THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
Common Stucture used to transmit data within commands
Protocol and parameters related used
Common Stucture used to receive data within commands
Communication Interface used