Example application for the STMicroelectronics X-NUCLEO-NFC05A1

Dependencies:   RFAL ST25R3911 BSP05

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers x_nucleo_nfc05.cpp Source File

x_nucleo_nfc05.cpp

00001 #include "x_nucleo_nfc05.h"
00002 
00003 
00004 
00005 /**
00006  * @brief Constructor of the NFC05A1 class
00007  * @param spiChannel: SPI Channel
00008  * @param led_1: Digital Led
00009  */
00010 X_Nucleo_NFC05::X_Nucleo_NFC05(SPI *spiChannel, DigitalOut *led_1)
00011 {
00012 
00013     mspiChannel = spiChannel;
00014     mled_1 = led_1;
00015 }
00016 
00017 /**
00018   * @brief  This function initialize the device
00019   * @param  spiChannel : SPI Channel
00020   * @retval void
00021   */
00022 
00023 void X_Nucleo_NFC05::begin(SPI *mspiChannel) {
00024 
00025 }
00026 
00027 
00028 /**
00029   * @brief  This function light on selected Led
00030   * @param  led : Led to be lit on
00031   * @retval None
00032   */
00033 void X_Nucleo_NFC05::ledOn(DigitalOut* led) {
00034     led -> write(1);
00035 }
00036 
00037 /**
00038   * @brief  This function light off selected Led
00039   * @param  led : Led to be lit off
00040   * @retval None
00041   */
00042 
00043 void X_Nucleo_NFC05::ledOff(DigitalOut* led) {
00044     *led = 0;
00045 }
00046 
00047 // WHAT OTHER FUNCTION WE WANT? WRITE URI AND READ URI? WHAT ELSE?
00048 
00049 void spiInitMain(SPI_HandleTypeDef hspi1, SPI_InitTypeDef Init){
00050 
00051       hspi1.Instance = SPI1;
00052       hspi1.Init.Mode = SPI_MODE_MASTER;
00053       hspi1.Init.Direction = SPI_DIRECTION_2LINES;
00054       hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
00055       hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
00056       hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;
00057       hspi1.Init.NSS = SPI_NSS_SOFT;
00058       hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
00059       hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
00060       hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
00061       hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
00062     /*  if (HAL_SPI_Init(&hspi1) != HAL_OK) {
00063         Error_Handler();
00064       }
00065 */
00066 }
00067