Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pn512_cmd.h Source File

pn512_cmd.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2013-2018, ARM Limited, All Rights Reserved
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00006  * not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00013  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 /**
00018  * \file pn512_cmd.h
00019  * \copyright Copyright (c) ARM Ltd 2013
00020  * \author Donatien Garnier
00021  */
00022 
00023 #ifndef PN512_CMD_H_
00024 #define PN512_CMD_H_
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 #include "stack/nfc_common.h"
00031 #include "pn512.h"
00032 
00033 #define PN512_CMD_IDLE        0x00 //No action, cancels current command execution
00034 #define PN512_CMD_MEM         0x01 //Stores 25 bytes into the internal buffer
00035 #define PN512_CMD_CONFIG      0x01 //Configures the PN512 for FeliCa, MIFARE and NFCIP-1 communication
00036 #define PN512_CMD_RNDIDG      0x02 //Generates a 10-byte random ID number
00037 #define PN512_CMD_CRC         0x03 //Activates the CRC coprocessor or performs a self test
00038 #define PN512_CMD_TRANSMIT    0x04 //Transmits data from the FIFO buffer
00039 #define PN512_CMD_NOCHANGE    0x07 //No command change
00040 #define PN512_CMD_RECEIVE     0x08 //Activates the receiver circuits
00041 #define PN512_CMD_TRANSCEIVE  0x0C //Transmits data from FIFO buffer to antenna and automatically activates the receiver after transmission
00042 #define PN512_CMD_AUTOCOLL    0x0D //Handles FeliCa polling (Card Operation mode only) and MIFARE anticollision (Card Operation mode only)
00043 #define PN512_CMD_MFAUTH      0x0E //Performs the MIFARE standard authentication as a reader
00044 #define PN512_CMD_SOFTRST     0x0F //Resets the PN512
00045 
00046 #define PN512_CMD_REG_MASK    0x0F
00047 
00048 void pn512_cmd_init(pn512_t *pPN512);
00049 
00050 //Fifo read / write
00051 
00052 void pn512_fifo_write(pn512_t *pPN512, ac_buffer_t *pData);
00053 void pn512_fifo_read(pn512_t *pPN512, ac_buffer_builder_t *pData);
00054 
00055 //Fifo clear
00056 void pn512_fifo_clear(pn512_t *pPN512);
00057 
00058 //Fifo bytes read
00059 size_t pn512_fifo_space(pn512_t *pPN512);
00060 size_t pn512_fifo_length(pn512_t *pPN512);
00061 
00062 //Execute command
00063 void pn512_cmd_exec(pn512_t *pPN512, uint8_t cmd);
00064 
00065 //Wait for command completion
00066 nfc_err_t pn512_cmd_wait_idle(pn512_t *pPN512, int timeout);
00067 
00068 //Read executed command
00069 uint8_t pn512_cmd_get(pn512_t *pPN512);
00070 
00071 
00072 #ifdef __cplusplus
00073 }
00074 #endif
00075 
00076 #endif /* PN512_CMD_H_ */