Example application for the STMicroelectronics X-NUCLEO-NFC05A1

Dependencies:   RFAL ST25R3911 BSP05

X-NUCLEO-NFC05A1 NFC Card Reader Expansion Board Firmware Package

Introduction

This firmware package includes Components Device Drivers, Board Support Package and example applications for STMicroelectronics X-NUCLEO-NFC05A1 NFC Card Reader Expansion Board based on the ST25R3911B.

Example Application

This program gives the user the possibility to read the URI information written on the expansion board. The LEDs will blink for few seconds to indicate that the board is initializing. As soon as it finishes, the device is ready to communicate with external NFC devices. LED6 will blink until an NFC device is close to it and ready to read the URI value.

Tested Platforms

This firmware has been tested on STM32 NUCLEO-F401RE

source/x_nucleo_nfc05.cpp

Committer:
DiegoOstuni
Date:
2019-11-14
Revision:
3:9a152c93d7a2
Parent:
1:86504e1ac6b1

File content as of revision 3:9a152c93d7a2:

#include "x_nucleo_nfc05.h"



/**
 * @brief Constructor of the NFC05A1 class
 * @param spiChannel: SPI Channel
 * @param led_1: Digital Led
 */
X_Nucleo_NFC05::X_Nucleo_NFC05(SPI *spiChannel, DigitalOut *led_1)
{

    mspiChannel = spiChannel;
    mled_1 = led_1;
}

/**
  * @brief  This function initialize the device
  * @param  spiChannel : SPI Channel
  * @retval void
  */

void X_Nucleo_NFC05::begin(SPI *mspiChannel) {

}


/**
  * @brief  This function light on selected Led
  * @param  led : Led to be lit on
  * @retval None
  */
void X_Nucleo_NFC05::ledOn(DigitalOut* led) {
    led -> write(1);
}

/**
  * @brief  This function light off selected Led
  * @param  led : Led to be lit off
  * @retval None
  */

void X_Nucleo_NFC05::ledOff(DigitalOut* led) {
    *led = 0;
}

// WHAT OTHER FUNCTION WE WANT? WRITE URI AND READ URI? WHAT ELSE?

void spiInitMain(SPI_HandleTypeDef hspi1, SPI_InitTypeDef Init){

      hspi1.Instance = SPI1;
      hspi1.Init.Mode = SPI_MODE_MASTER;
      hspi1.Init.Direction = SPI_DIRECTION_2LINES;
      hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
      hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
      hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;
      hspi1.Init.NSS = SPI_NSS_SOFT;
      hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
      hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
      hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
      hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
    /*  if (HAL_SPI_Init(&hspi1) != HAL_OK) {
        Error_Handler();
      }
*/
}