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 ST Expansion SW Team

X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board Firmware Package

Introduction

This firmware package includes Components Device Drivers, Board Support Package and example applications for STMicroelectronics X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board based on M24SR.

Firmware Library

Class X_NUCLEO_NFC01A1 is intended to represent the Dynamic NFC Tag Expansion Board with the same name.
It provides an API to access to the M24SR component and to the three onboard LEDs.
It is intentionally implemented as a singleton because only one X_NUCLEO_NFC01A1 at a time might be deployed in a HW component stack.
The library also provides an implementation of the NDEF library API for M24SR, providing an simple way to read/write NDEF formatted messages from/to the M24SR dynamic NFC tag.

Example applications

1. Hello World
2. Asynchronous Hello World

X_NUCLEO_NFC01A1.cpp

Committer:
giovannivisentini
Date:
2015-12-03
Revision:
0:969a2be49f41
Child:
1:15d4a123ef6b

File content as of revision 0:969a2be49f41:

/*
 * X_NUCLEO_NFC01A1.cpp
 *
 *  Created on: Nov 5, 2015
 *      Author: giovanni visentini
 */

#include <X_NUCLEO_NFC01A1.h>

const uint8_t  X_NUCLEO_NFC01A1::M24SR_ADDR=0xAC;
const PinName  X_NUCLEO_NFC01A1::DEFAULT_SDA_PIN=D14;
const PinName  X_NUCLEO_NFC01A1::DEFAULT_SDL_PIN=D15;



const PinName X_NUCLEO_NFC01A1::GPO_PIN=D12;
const PinName X_NUCLEO_NFC01A1::RF_DISABLE_PIN=D11;
const PinName X_NUCLEO_NFC01A1::LED1_PIN=D5;
const PinName X_NUCLEO_NFC01A1::LED2_PIN=D4;
const PinName X_NUCLEO_NFC01A1::LED3_PIN=D2;

X_NUCLEO_NFC01A1 *X_NUCLEO_NFC01A1::mInstance = NULL;

X_NUCLEO_NFC01A1* X_NUCLEO_NFC01A1::Instance(I2C &devI2C) {
	if (mInstance == NULL) { // the first time
		mInstance = new X_NUCLEO_NFC01A1(devI2C);
		if (mInstance != NULL) { //allocation ok
			const int status = mInstance->mM24SR.Init(NULL);
			if (status != NFC_SUCCESS) { //initialization failed
				delete mInstance;
				error(
						"Failed to init X_NUCLEO_NFC01A1 expansion board!\r\nError:0x%X\r\n",
						status);
			} //if init
		} //if instance !=NULL
	} //if instance
	return mInstance;
}