cancel
Showing results for 
Search instead for 
Did you mean: 

How do I write strings with NFCTAG_WriteData

Schuyler
Senior

I'm using FP-SNS-SMARTAG1, but I can't write strings correctly with code, and I can't write anything, what should I do?

 while (1)
  {
    /* Wake Up due to RTC timer */
    if(WakeUpTimerInterrupt) {
      WakeUpTimerInterrupt =0;
      WakeUpTimerCallBack();
    }
    
    /* There are a RF activity */
    if(RFActivity) {
      RFActivity = 0;
      DetectRFActivity();
    }
        SmarTag_LED_GREEN_On();

          /* Init SmarTag sensor */
            //InitSmarTagSensor();
          //MEMS_Sensors_ReadData();    
     char str[] = "Hello, NFC!";  // String variable instead of string literal
  const uint16_t address = 0x00;
  const uint16_t size = strlen(str) + 1;  // Include null terminator

  // Call the NFC07A1_NFCTAG_WriteData function
    SMARTAG1_NFCTAG_WriteData(SMARTAG1_NFCTAG_INSTANCE, (uint8_t *)str, address, size);


  if(!WakeUpTimerIsSet) {
    /* task executed, now can set next wakeup timer */
    if(HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0, RTC_WAKEUPCLOCK_CK_SPRE_16BITS)!= HAL_OK) {
      Error_Handler();
    }
    
    WakeUpTimerIsSet= 1;
  }
  
#ifndef SMARTAG_ENABLE_DEBUG
    /* -> Stop mode */
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
#else /* SMARTAG_ENABLE_DEBUG */
      /* Wait Next event */
    __WFI();
#endif /* SMARTAG_ENABLE_DEBUG */
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
0 REPLIES 0