Mistake on this page?
Report an issue in GitHub or email us
pn512_cmd.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2018, ARM Limited, All Rights Reserved
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may
6  * not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 /**
18  * \file pn512_cmd.h
19  * \copyright Copyright (c) ARM Ltd 2013
20  * \author Donatien Garnier
21  */
22 
23 #ifndef PN512_CMD_H_
24 #define PN512_CMD_H_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include "stack/nfc_common.h"
31 #include "pn512.h"
32 
33 #define PN512_CMD_IDLE 0x00 //No action, cancels current command execution
34 #define PN512_CMD_MEM 0x01 //Stores 25 bytes into the internal buffer
35 #define PN512_CMD_CONFIG 0x01 //Configures the PN512 for FeliCa, MIFARE and NFCIP-1 communication
36 #define PN512_CMD_RNDIDG 0x02 //Generates a 10-byte random ID number
37 #define PN512_CMD_CRC 0x03 //Activates the CRC coprocessor or performs a self test
38 #define PN512_CMD_TRANSMIT 0x04 //Transmits data from the FIFO buffer
39 #define PN512_CMD_NOCHANGE 0x07 //No command change
40 #define PN512_CMD_RECEIVE 0x08 //Activates the receiver circuits
41 #define PN512_CMD_TRANSCEIVE 0x0C //Transmits data from FIFO buffer to antenna and automatically activates the receiver after transmission
42 #define PN512_CMD_AUTOCOLL 0x0D //Handles FeliCa polling (Card Operation mode only) and MIFARE anticollision (Card Operation mode only)
43 #define PN512_CMD_MFAUTH 0x0E //Performs the MIFARE standard authentication as a reader
44 #define PN512_CMD_SOFTRST 0x0F //Resets the PN512
45 
46 #define PN512_CMD_REG_MASK 0x0F
47 
48 void pn512_cmd_init(pn512_t *pPN512);
49 
50 //Fifo read / write
51 
52 void pn512_fifo_write(pn512_t *pPN512, ac_buffer_t *pData);
53 void pn512_fifo_read(pn512_t *pPN512, ac_buffer_builder_t *pData);
54 
55 //Fifo clear
56 void pn512_fifo_clear(pn512_t *pPN512);
57 
58 //Fifo bytes read
59 size_t pn512_fifo_space(pn512_t *pPN512);
60 size_t pn512_fifo_length(pn512_t *pPN512);
61 
62 //Execute command
63 void pn512_cmd_exec(pn512_t *pPN512, uint8_t cmd);
64 
65 //Wait for command completion
66 nfc_err_t pn512_cmd_wait_idle(pn512_t *pPN512, int timeout);
67 
68 //Read executed command
69 uint8_t pn512_cmd_get(pn512_t *pPN512);
70 
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif /* PN512_CMD_H_ */
Definition: pn512.h:53
int nfc_err_t
Type for NFC errors.
Definition: nfc_errors.h:59
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.