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.cpp
00001 /** 00002 ****************************************************************************** 00003 * @file XNucleoNFC01A1.h 00004 * @author ST Central Labs 00005 * @date 30 Set 2016 00006 * @brief Singleton class that controls all the electronics inside the 00007 * XNucleoNFC01A1 expansion board 00008 ****************************************************************************** 00009 * 00010 * COPYRIGHT(c) 2015 STMicroelectronics 00011 * 00012 * Redistribution and use in source and binary forms, with or without modification, 00013 * are permitted provided that the following conditions are met: 00014 * 1. Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00020 * may be used to endorse or promote products derived from this software 00021 * without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00024 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00025 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00026 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00027 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00028 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00029 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00030 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00031 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 ****************************************************************************** 00035 */ 00036 00037 #include <XNucleoNFC01A1.h> 00038 00039 const uint8_t XNucleoNFC01A1::M24SR_ADDR=0xAC; 00040 const PinName XNucleoNFC01A1::DEFAULT_SDA_PIN=D14; 00041 const PinName XNucleoNFC01A1::DEFAULT_SDL_PIN=D15; 00042 00043 00044 const PinName XNucleoNFC01A1::DEFAULT_GPO_PIN=D12; 00045 const PinName XNucleoNFC01A1::DEFAULT_RF_DISABLE_PIN=D11; 00046 const PinName XNucleoNFC01A1::DEFAULT_LED1_PIN=D5; 00047 const PinName XNucleoNFC01A1::DEFAULT_LED2_PIN=D4; 00048 const PinName XNucleoNFC01A1::DEFAULT_LED3_PIN=D2; 00049 00050 XNucleoNFC01A1* XNucleoNFC01A1::mInstance; 00051 00052 XNucleoNFC01A1* XNucleoNFC01A1::instance(I2C &devI2C, 00053 M24SR::gpoEventCallback gpoEventCallback, 00054 const PinName &gpoName, 00055 const PinName &RFDisableName, const PinName &led1Name, 00056 const PinName &led2Name, const PinName &led3Name) { 00057 if (mInstance == NULL) { // the first time 00058 mInstance = new XNucleoNFC01A1(devI2C,gpoEventCallback,gpoName, 00059 RFDisableName,led1Name,led2Name,led3Name); 00060 if (mInstance != NULL) { //allocation ok 00061 const int status = mInstance->mM24SR.init(NULL); 00062 if (status != NFC_SUCCESS) { //initialization failed 00063 delete mInstance; 00064 error( 00065 "Failed to init XNucleoNFC01A1 expansion board!\r\nError:0x%X\r\n", 00066 status); 00067 } //if init 00068 } //if instance !=NULL 00069 } //if instance 00070 return mInstance; 00071 }
Generated on Tue Jul 12 2022 14:09:53 by 1.7.2