Programme pour communiquer avec le RFID

Dependencies:   mbed

Fork of CRIC_RFID by Anthony Goncalves

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.hpp Source File

main.hpp

00001 #ifndef MAIN_HPP
00002 #define MAIN_HPP
00003 
00004 /*****************************************************
00005 ------------------------ MAIN ------------------------
00006 *****************************************************/
00007 //Prototypes des fonctions
00008 void flashingLED();
00009 
00010 #define READ_MODE   0x01
00011 #define WRITE_MODE  0x00
00012 
00013 /*****************************************************
00014 ------------------------ MAIN ------------------------
00015 *****************************************************/
00016 
00017 /*****************************************************
00018 ------------------------ RFID ------------------------
00019 *****************************************************/
00020 #define HEADER      0xFF
00021 #define RESERVED    0x00
00022 
00023 #define ANTENNA_SWITCH_OFF  0x00
00024 #define ANTENNA_SWITCH_ON   0x01
00025 
00026 
00027 
00028 //COMMAND
00029 #define RESET           0x80
00030 #define FIRMWARE        0x81
00031 #define SEEK_FOR_TAG    0x82
00032 #define SELECT_TAG      0x83
00033 #define AUTHENTICATE    0x85
00034 #define READ_BLOCK      0x86
00035 #define WRITE_BLOCK     0x89
00036 #define ANTENNA_POWER   0x90
00037 #define SET_BAUD_RATE   0x94
00038 
00039 //STATE
00040 #define SET_RESET           0x00
00041 #define SET_ANTENNA_POWER   0x01
00042 #define READ_TAG            0x02
00043 
00044 #define SEEK                0x80
00045 #define AUTHENTI            0x81
00046 #define READ                0x82
00047 #define WRITE               0x83
00048 
00049 //Structures
00050 struct DataTrame{
00051     char header;
00052     char reserved;
00053     char length;
00054     char command;
00055     char data[25]; 
00056     char csum;
00057 };
00058 
00059 struct InfosTag{
00060     char tagType;
00061     char serialNumber[7];
00062 };
00063 
00064 struct DonneesTag{
00065     char typeTrajet;
00066     char direction;
00067     char distance;
00068     char position;
00069 };
00070 
00071 //Prototypes des fonctions
00072 void RFID_Module();
00073 void TxFrame(unsigned char command, unsigned char lengthData, unsigned char *data);
00074 unsigned int RxFrame(unsigned char *dataRx);
00075 void RxFrameInterrupt();
00076 unsigned char calcCSUM(unsigned char lengthData, unsigned char command, unsigned char *valData);
00077 
00078 /*****************************************************
00079 ------------------------ RFID ------------------------
00080 *****************************************************/
00081 #endif