miguelbalboa / rfid

Arduino RFID Library for MFRC522
The Unlicense
2.74k stars 1.43k forks source link

MFRC522.h:22:26: error: 'SPI_CLOCK_DIV4' was not declared in this scope #544

Closed maximus1127 closed 3 years ago

maximus1127 commented 3 years ago

Step 1: Describe your environment

Step 2: Describe the problem

When loading the library and selecting an example sketch, I'm getting the error of "MFRC522.h:22:26: error: 'SPI_CLOCK_DIV4' was not declared in this scope". Everything is completely stock, the library was downloaded and imported straight into the editor, the example was selected without editing any code or anything. I can't even upload it to the nano as the compile failed with this error. I have also downgraded my IDE to version 1.6.x as the main page of the library states it's compatible with that version and I still get the same error.

Steps to reproduce:

  1. Import library
  2. Select example sketch "read NUID"
  3. compile and wait for pretty red text
Rotzbua commented 3 years ago

SPI_CLOCK_DIV4 should be defined by the board. What version and board implementation do you use for the Nano 33 BLE Sense ? Look it up at the board manager in the arduino ide. Thanks

maximus1127 commented 3 years ago

image

I'm using the "Arduino Nano 33 BLE" board

Rotzbua commented 3 years ago

Solution

Set compiler flag to overwrite with your values according to your board: MFRC522_SPICLOCK

Simple Workaround

Longterm Solution

Would be to add the constants as compatibility to the board library. https://github.com/arduino/ArduinoCore-mbed

Rotzbua commented 3 years ago

Solved by 34086ad99a86ff381dc3c4fd2454a6b7b8c3b78d