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

Files at this revision

API Documentation at this revision

Comitter:
giovannivisentini
Date:
Tue Jan 19 10:24:53 2016 +0000
Parent:
16:b0d62f4b185a
Child:
18:10def2fefa8a
Commit message:
protect the global variable enabling/disabling the interrupts + avoid to read the gpo when the interrupt is fired

Changed in this revision

m24sr/m24sr_class.cpp Show annotated file Show diff for this revision Revisions of this file
m24sr/m24sr_class.h Show annotated file Show diff for this revision Revisions of this file
--- a/m24sr/m24sr_class.cpp	Tue Jan 19 08:08:00 2016 +0000
+++ b/m24sr/m24sr_class.cpp	Tue Jan 19 10:24:53 2016 +0000
@@ -1169,17 +1169,16 @@
 		M24SR_IO_GPO_ReadPin(&PinState);
 
 		if (PinState == GPIO_PIN_SET) {
-			//prepare and set the inpterrupt
-			interruptIsFired = false;
+		
+			answerReadyInterrupt.disable_irq();
+				interruptIsFired = false;
 			answerReadyInterrupt.enable_irq();
-			while (PinState == GPIO_PIN_SET ){
+			
+			while (!interruptIsFired ){
 				__WFE();
-				//if we weake up for our interrupt, update the gpo state
-				if(interruptIsFired)
-					M24SR_IO_GPO_ReadPin(&PinState);
 			}//while
 			//disable the interrupt
-			answerReadyInterrupt.disable_irq();
+
 		}//if
 
 		return NFC_SUCCESS;
--- a/m24sr/m24sr_class.h	Tue Jan 19 08:08:00 2016 +0000
+++ b/m24sr/m24sr_class.h	Tue Jan 19 10:24:53 2016 +0000
@@ -90,7 +90,7 @@
 		uDIDbyte = 0;
 		RFDisablePin = 0;
 		GPOPin.mode(PullNone);
-		answerReadyInterrupt.disable_irq();
+		answerReadyInterrupt.enable_irq();
 		answerReadyInterrupt.fall(this,
 				&M24SR::M24SR_AnswerReadyInterruptCallback);
 		answerReadyInterrupt.mode(PullUp);
@@ -413,7 +413,9 @@
 	 * Callback triggers when a command is completed.
 	 */
 	void M24SR_AnswerReadyInterruptCallback() {
-		interruptIsFired = true;
+		answerReadyInterrupt.disable_irq();
+			interruptIsFired = true;
+		answerReadyInterrupt.enable_irq();
 	}
 
 	/*** Component's Instance Variables ***/