Firmware library for the X-NUCLEO-NFC01A1 Dynamic NFC Tag board.
Dependencies: M24SR
Dependents: NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more
Fork of X_NUCLEO_NFC01A1 by
XNucleoNFC01A1.h
00001 /** 00002 ****************************************************************************** 00003 * @file XNucleoNFC01A1.h 00004 * @author ST Central Labs 00005 * @version V1.1.0 00006 * @date 30 Set 2016 00007 * @brief Singleton class that controls all the electronics inside the 00008 * XNucleoNFC01A1 expansion board. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00033 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00034 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************** 00037 */ 00038 00039 #ifndef XNucleoNFC01A1_H_ 00040 #define XNucleoNFC01A1_H_ 00041 #include <stdint.h> 00042 00043 #include "mbed.h" 00044 00045 #include "M24SR.h" 00046 00047 /** 00048 * Singleton class that controls all the electronics inside the XNucleoNFC01A1 expansion board. 00049 */ 00050 class XNucleoNFC01A1 { 00051 00052 public: 00053 00054 private: 00055 /** 00056 * Pointer to the singleton instance, NULL if not allocated. 00057 */ 00058 static XNucleoNFC01A1 *mInstance; 00059 /** 00060 * I2C address of the M24SR chip. 00061 */ 00062 static const uint8_t M24SR_ADDR; 00063 00064 /** 00065 * Constructor 00066 * @param devI2C I2C channel used to communicate with the board. 00067 * @param eventCallback Function that will be called when the gpo pin status change. 00068 * @param gpoName Name of the gpio pin of the M24SR chip. 00069 * @param RFDisableName Pin that controls the rf antenna status. 00070 * @param led1Name Pin to control the led1 status. 00071 * @param led2Name Pin to control the led1 status. 00072 * @param led3Name Pin to control the led1 status. 00073 */ 00074 XNucleoNFC01A1(I2C &devI2C,M24SR::gpoEventCallback eventCallback, 00075 const PinName &gpoName, const PinName &RFDisableName, 00076 const PinName &led1Name, const PinName &led2Name, 00077 const PinName &led3Name): 00078 mM24SR(M24SR_ADDR,devI2C,eventCallback,gpoName,RFDisableName), 00079 mNfcLed1(led1Name),mNfcLed2(led2Name),mNfcLed3(led3Name){} 00080 00081 public: 00082 static const PinName DEFAULT_SDA_PIN; //!< Default pin used for the M24SR SDA signal. 00083 static const PinName DEFAULT_SDL_PIN; //!< Default pin used for the M24SR SDL signal. 00084 static const PinName DEFAULT_GPO_PIN; //!< Default pin used for the M24SR GPO signal. 00085 static const PinName DEFAULT_RF_DISABLE_PIN; //!< Default pin used for M24SR RF_DISABLE signal. 00086 static const PinName DEFAULT_LED1_PIN; //!< Default pin to control the led 1. 00087 static const PinName DEFAULT_LED2_PIN; //!< Default pin to control the led 2. 00088 static const PinName DEFAULT_LED3_PIN; //!< Default pin to control the led 3. 00089 00090 /** 00091 * Create or return an instance of XNucleoNFC01A1. 00092 * @param devI2C I2C channel used to communicate with the board. 00093 * @param eventCallback Function that will be called when the gpo pin status change. 00094 * @param gpoName Name of the gpio pin of the M24SR chip. 00095 * @param RFDisableName Pin that controls the rf antenna status. 00096 * @param led1Name Pin to control the led1 status. 00097 * @param led2Name Pin to control the led1 status. 00098 * @param led3Name Pin to control the led1 status. 00099 */ 00100 static XNucleoNFC01A1* instance(I2C &devI2C, 00101 M24SR::gpoEventCallback eventCallback=NULL, 00102 const PinName &gpoName = DEFAULT_GPO_PIN, 00103 const PinName &RFDisableName = DEFAULT_RF_DISABLE_PIN, 00104 const PinName &led1Name = DEFAULT_LED1_PIN, 00105 const PinName &led2Name = DEFAULT_LED2_PIN, 00106 const PinName &led3Name = DEFAULT_LED3_PIN); 00107 00108 /** 00109 * @return board led1. 00110 */ 00111 DigitalOut& get_led1 () { 00112 return mNfcLed1; 00113 } 00114 00115 /** 00116 * @return board led2. 00117 */ 00118 DigitalOut& get_led2 () { 00119 return mNfcLed2; 00120 } 00121 00122 /** 00123 * @return board led3. 00124 */ 00125 DigitalOut& get_led3 () { 00126 return mNfcLed3; 00127 } 00128 00129 /** 00130 * @return NFC Chip. 00131 */ 00132 M24SR& get_M24SR () { 00133 return mM24SR; 00134 } 00135 00136 virtual ~XNucleoNFC01A1() { 00137 } 00138 00139 private: 00140 00141 M24SR mM24SR; 00142 DigitalOut mNfcLed1; 00143 DigitalOut mNfcLed2; 00144 DigitalOut mNfcLed3; 00145 00146 }; 00147 00148 #endif /* XNucleoNFC01A1_H_ */
Generated on Tue Jul 12 2022 14:09:53 by 1.7.2