Question

I was trying to seperate my old working code in modules but I got always this error.

"nfc_read.h:24: error: expected ')' before '*' token"

this is line 24: void read_card(boolean *success,uint8_t *uid,uint8_t *uidLength);

not sure what is wrong in the code...

In my header nfc_read.h:

#ifndef _nfc_read_h_
  #define _nfc_read_h_

//Libarys
#include <Wire.h>
#include <Adafruit_NFCShield_I2C.h>


void setup_adafruit(int mode);  
void read_card(boolean *success,uint8_t *uid,uint8_t *uidLength);//<--here is the error

#endif 

Maybe here is the mistake somewhere:

#include "nfc_read.h"

#define IRQ   (2)  // IRQ = Interrupt request uint8 (input)
#define RESET (3)  // Not connected by default on the NFC Shield uint8 (output)

void setup_adafruit(int mode)
{
  Adafruit_NFCShield_I2C nfc(IRQ, RESET); //Funktionspointer....Pins konfigurieren IRQ => input ,RESET => output

  Serial.println("Welcome this application will read your UID of your ISO14443A-Card"); //Willkommens Text

  nfc.begin(); 

  uint32_t versiondata = nfc.getFirmwareVersion(); 

  if (! versiondata) {
    Serial.print("Didn't find Arduino board");
    while (1); // halt
  }

  nfc.setPassiveActivationRetries(0xFF);

  // configure board to read RFID tags
  nfc.SAMConfig();

  Serial.println("Waiting for an ISO14443A card");  
}

void read_card(boolean *success,uint8_t *uid,uint8_t *uidLength)
{
  *success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);
}
Was it helpful?

Solution

Perhaps this will help?

#ifndef _nfc_read_h_
  #define _nfc_read_h_

//Libarys
#include <Wire.h>
#include <Adafruit_NFCShield_I2C.h>

Add the following lines:

#include <stdint.h>
#ifndef boolean
    #define boolean int
#endif

The above lines will ensure that the proper types are defined.

void setup_adafruit(int mode);  
void read_card(boolean *success,uint8_t *uid,uint8_t *uidLength);//<--here is the error

#endif 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top