interrupt handling
readerComm.h
- Committer:
- soumi_ghsoh
- Date:
- 2015-04-10
- Revision:
- 11:d5e8f47880f1
- Parent:
- 10:98a58968dc7d
- Child:
- 13:16a5b43ac874
File content as of revision 11:d5e8f47880f1:
// Prototypes //void SpiInit1(void); // SPI 250 Khz void SpiInit(void); // SPI 1Mhz void trf797xDirectCommand(uint8_t *buffer); // send direct command to trf7970a void trf797xWriteSingle(uint8_t *buffer, uint8_t length); // write to trf7970a register void trf797xReadSingle(uint8_t *buffer, uint8_t number); // read trf7970a register void trf797xReadContinuous(uint8_t *buffer, uint8_t length); // read continuous bytes from trf7970a void trf797xRawWrite(uint8_t *buffer, uint8_t length); // raw write to trf7970a FIFO void PowerUpNFC(void); // powerup trf7970a void PowerUpNFC2(void); void PowerDownNFC(void); // powerdown trf7970a void NFCInit(void); // initialize trf7970 iso control =0x02, chip status control=0x20, modulator=0x21 void RegisterReInitNFC(void); // reinitialize nfc status registers void RegistersReadNFC(void); // read nfc status registers void InventoryReqNFC(void); // inventory request to trf7970a void MemReadReqNFC(void); // memory read request to trf7970a void ReadNFC(void); // read teag ID/Single Read void FindNFC(uint8_t *irqStatus); // read irq from trf7970a. void handlerNFC(void); // trf7970 irq handler void StandByNFC(void); void SleepNFC(void); bool PollNFC(void); //uint8_t pwr_mode ; // Booleans #define DESELECT 1 #define SELECT 0 #define ADDRESS 0 #define COMMAND 1 #define WRITE 0 #define READ 1 //led #define LED_ON 0 #define LED_OFF 1 #define FALSE 0 #define TRUE 1 // Direct commands for trf797x #define IDLE 0x00 #define SOFT_INIT 0x03 #define INITIAL_RF_COLLISION 0x04 #define RESPONSE_RF_COLLISION_N 0x05 #define RESPONSE_RF_COLLISION_0 0x06 #define RESET 0x0F #define TRANSMIT_NO_CRC 0x10 #define TRANSMIT_CRC 0x11 #define DELAY_TRANSMIT_NO_CRC 0x12 #define DELAY_TRANSMIT_CRC 0x13 #define TRANSMIT_NEXT_SLOT 0x14 #define CLOSE_SLOT_SEQUENCE 0x15 #define STOP_DECODERS 0x16 #define RUN_DECODERS 0x17 #define CHECK_INTERNAL_RF 0x18 #define CHECK_EXTERNAL_RF 0x19 #define ADJUST_GAIN 0x1A // Registers for trf797x #define CHIP_STATUS_CONTROL 0x00 #define ISO_CONTROL 0x01 #define ISO_14443B_OPTIONS 0x02 #define ISO_14443A_OPTIONS 0x03 #define TX_TIMER_EPC_HIGH 0x04 #define TX_TIMER_EPC_LOW 0x05 #define TX_PULSE_LENGTH_CONTROL 0x06 #define RX_NO_RESPONSE_WAIT_TIME 0x07 #define RX_WAIT_TIME 0x08 #define MODULATOR_CONTROL 0x09 #define RX_SPECIAL_SETTINGS 0x0A #define REGULATOR_CONTROL 0x0B #define IRQ_STATUS 0x0C #define IRQ_MASK 0x0D #define COLLISION_POSITION 0x0E #define RSSI_LEVELS 0x0F #define SPECIAL_FUNCTION_1 0x10 #define SPECIAL_FUNCTION_2 0x11 #define RAM_0 0x12 #define RAM_1 0x13 #define FIFO_IRQ_LEVELS_ADJ 0x14 #define RESERVED 0x15 #define NFC_LOW_DETECTION 0x16 #define NFCID 0x17 #define NFC_TARGET_LEVEL 0x18 #define NFC_TARGET_PROTOCOL 0x19 #define TEST_SETTINGS_1 0x1A #define TEST_SETTINGS_2 0x1B #define FIFO_COUNTER 0x1C #define TX_LENGTH_BYTE_1 0x1D #define TX_LENGTH_BYTE_2 0x1E #define FIFO 0x1F // BITs #define BIT0 0x01 // 0b00000001 #define BIT1 0x02 // 0b00000010 #define BIT2 0x40 // 0b00000100 #define BIT3 0x08 // 0b00001000 #define BIT4 0x10 // 0b00010000 #define BIT5 0x20 // 0b00100000 #define BIT6 0x40 // 0b01000000 #define BIT7 0x80 // 0b10000000 // Misc #define SIXTEEN_SLOTS 0x06 #define ONE_SLOT 0x26