/**************************************************************************** * include/contactless/mfrc522.h * * Copyright(C) 2016 Uniquix Ltda. All rights reserved. * Author: Alan Carvalho de Assis * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ #ifndef __INCLUDE_NUTTX_CONTACTLESS_MFRC522_H #define __INCLUDE_NUTTX_CONTACTLESS_MFRC522_H /**************************************************************************** * Included Files ****************************************************************************/ #include #include #include #include #include /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ #define MFRC522_MIFARE_ISO14443A (0x00) /**************************************************************************** * Public Types ****************************************************************************/ enum mfrc522_state_e { MFRC522_STATE_NOT_INIT, MFRC522_STATE_IDLE, MFRC522_STATE_CMD_SENT, MFRC522_STATE_DATA_READY, }; struct mfrc522_dev_s; struct picc_uid_s { uint8_t size; /* Number of bytes in the UID. 4, 7 or 10 */ uint8_t uid_data[10]; uint8_t sak; /* The SAK (Select Acknowledge) return by the PICC */ }; /**************************************************************************** * Public Functions ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" extern "C" { #else #define EXTERN extern #endif /**************************************************************************** * Name: mfrc522_register * * Description: * Register the MFRC522 character device as 'devpath' * * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/rfid0" * spi - An instance of the SPI interface to use to communicate with MFRC522 * config - Device persistent board data * * Returned Value: * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ int mfrc522_register(FAR const char *devpath, FAR struct spi_dev_s *spi); #undef EXTERN #ifdef __cplusplus } #endif #endif /* __INCLUDE_NUTTX_CONTACTLESS_MFRC522_H */