AppNearMe µNFC stack for the NXP PN532 chip License: You can use the stack free of charge to prototype with mbed; if you want to use the stack with your commercial product, get in touch!
Dependents: IOT_sensor_nfc AppNearMe_MuNFC_PN532_Test p2p_nfc_test NFCMoodLamp ... more
License
You can use the stack free of charge to prototype with mbed; if you want to use the stack with your commercial product, get in touch!
PN532/munfc/drv/pn512/pn512_cmd.h@10:2af578c635cd, 2012-11-07 (annotated)
- Committer:
- AppNearMe
- Date:
- Wed Nov 07 18:18:52 2012 +0000
- Revision:
- 10:2af578c635cd
Updated library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AppNearMe | 10:2af578c635cd | 1 | /* |
AppNearMe | 10:2af578c635cd | 2 | pn512_cmd.h |
AppNearMe | 10:2af578c635cd | 3 | Copyright (c) Donatien Garnier 2012 |
AppNearMe | 10:2af578c635cd | 4 | donatien.garnier@appnearme.com |
AppNearMe | 10:2af578c635cd | 5 | http://www.appnearme.com/ |
AppNearMe | 10:2af578c635cd | 6 | */ |
AppNearMe | 10:2af578c635cd | 7 | |
AppNearMe | 10:2af578c635cd | 8 | #ifndef PN512_CMD_H_ |
AppNearMe | 10:2af578c635cd | 9 | #define PN512_CMD_H_ |
AppNearMe | 10:2af578c635cd | 10 | |
AppNearMe | 10:2af578c635cd | 11 | #ifdef __cplusplus |
AppNearMe | 10:2af578c635cd | 12 | extern "C" { |
AppNearMe | 10:2af578c635cd | 13 | #endif |
AppNearMe | 10:2af578c635cd | 14 | |
AppNearMe | 10:2af578c635cd | 15 | #include "core/fwk.h" |
AppNearMe | 10:2af578c635cd | 16 | |
AppNearMe | 10:2af578c635cd | 17 | #define PN512_CMD_IDLE 0x00 //No action, cancels current command execution |
AppNearMe | 10:2af578c635cd | 18 | #define PN512_CMD_MEM 0x01 //Stores 25 bytes into the internal buffer |
AppNearMe | 10:2af578c635cd | 19 | #define PN512_CMD_CONFIG 0x01 //Configures the PN512 for FeliCa, MIFARE and NFCIP-1 communication |
AppNearMe | 10:2af578c635cd | 20 | #define PN512_CMD_RNDIDG 0x02 //Generates a 10-byte random ID number |
AppNearMe | 10:2af578c635cd | 21 | #define PN512_CMD_CRC 0x03 //Activates the CRC coprocessor or performs a self test |
AppNearMe | 10:2af578c635cd | 22 | #define PN512_CMD_TRANSMIT 0x04 //Transmits data from the FIFO buffer |
AppNearMe | 10:2af578c635cd | 23 | #define PN512_CMD_NOCHANGE 0x07 //No command change |
AppNearMe | 10:2af578c635cd | 24 | #define PN512_CMD_RECEIVE 0x08 //Activates the receiver circuits |
AppNearMe | 10:2af578c635cd | 25 | #define PN512_CMD_TRANSCEIVE 0x0C //Transmits data from FIFO buffer to antenna and automatically activates the receiver after transmission |
AppNearMe | 10:2af578c635cd | 26 | #define PN512_CMD_AUTOCOLL 0x0D //Handles FeliCa polling (Card Operation mode only) and MIFARE anticollision (Card Operation mode only) |
AppNearMe | 10:2af578c635cd | 27 | #define PN512_CMD_MFAUTH 0x0E //Performs the MIFARE standard authentication as a reader |
AppNearMe | 10:2af578c635cd | 28 | #define PN512_CMD_SOFTRST 0x0F //Resets the PN512 |
AppNearMe | 10:2af578c635cd | 29 | |
AppNearMe | 10:2af578c635cd | 30 | #define PN512_CMD_REG_MASK 0x0F |
AppNearMe | 10:2af578c635cd | 31 | |
AppNearMe | 10:2af578c635cd | 32 | void pn512_cmd_init(void); |
AppNearMe | 10:2af578c635cd | 33 | |
AppNearMe | 10:2af578c635cd | 34 | //Fifo read / write |
AppNearMe | 10:2af578c635cd | 35 | size_t pn512_fifo_write(uint8_t* buf, size_t len); |
AppNearMe | 10:2af578c635cd | 36 | size_t pn512_fifo_read(uint8_t* buf, size_t len); |
AppNearMe | 10:2af578c635cd | 37 | |
AppNearMe | 10:2af578c635cd | 38 | //Fifo clear |
AppNearMe | 10:2af578c635cd | 39 | void pn512_fifo_clear(void); |
AppNearMe | 10:2af578c635cd | 40 | |
AppNearMe | 10:2af578c635cd | 41 | //Fifo bytes read |
AppNearMe | 10:2af578c635cd | 42 | size_t pn512_fifo_space(void); |
AppNearMe | 10:2af578c635cd | 43 | size_t pn512_fifo_length(void); |
AppNearMe | 10:2af578c635cd | 44 | |
AppNearMe | 10:2af578c635cd | 45 | //Execute command |
AppNearMe | 10:2af578c635cd | 46 | void pn512_cmd_exec(uint8_t cmd); |
AppNearMe | 10:2af578c635cd | 47 | |
AppNearMe | 10:2af578c635cd | 48 | //Read executed command |
AppNearMe | 10:2af578c635cd | 49 | uint8_t pn512_cmd_get(void); |
AppNearMe | 10:2af578c635cd | 50 | |
AppNearMe | 10:2af578c635cd | 51 | //Sets xmit last byte bits |
AppNearMe | 10:2af578c635cd | 52 | void pn512_tx_set_last_byte_size(size_t bits); |
AppNearMe | 10:2af578c635cd | 53 | |
AppNearMe | 10:2af578c635cd | 54 | //Gets rcv last byte bits |
AppNearMe | 10:2af578c635cd | 55 | size_t pn512_rx_get_last_byte_size(void); |
AppNearMe | 10:2af578c635cd | 56 | |
AppNearMe | 10:2af578c635cd | 57 | #define PN512_TRANSCEIVE_TX 1 |
AppNearMe | 10:2af578c635cd | 58 | #define PN512_TRANSCEIVE_RX 2 |
AppNearMe | 10:2af578c635cd | 59 | //Start transceive |
AppNearMe | 10:2af578c635cd | 60 | int pn512_transceive(int option); |
AppNearMe | 10:2af578c635cd | 61 | |
AppNearMe | 10:2af578c635cd | 62 | int pn512_target_anticollision(void); |
AppNearMe | 10:2af578c635cd | 63 | |
AppNearMe | 10:2af578c635cd | 64 | #ifdef __cplusplus |
AppNearMe | 10:2af578c635cd | 65 | } |
AppNearMe | 10:2af578c635cd | 66 | #endif |
AppNearMe | 10:2af578c635cd | 67 | |
AppNearMe | 10:2af578c635cd | 68 | #endif /* PN512_CMD_H_ */ |