Arduino在'*'之前预期')'

时间:2014-04-27 22:47:53

标签: c arduino

我试图在模块中分离我的旧工作代码,但我总是遇到这个错误。

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

这是第24行: void read_card(boolean *success,uint8_t *uid,uint8_t *uidLength);

不确定代码中有什么问题...

在我的标题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 

也许这是某个地方的错误:

#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);
}

1 个答案:

答案 0 :(得分:1)

也许这会有所帮助?

#ifndef _nfc_read_h_
  #define _nfc_read_h_

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

添加以下行:

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

以上几行将确保定义正确的类型。

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

#endif