Marzogh / SPIMemory

Arduino library for Flash Memory Chips (SPI based only). Formerly SPIFlash
http://spimemory.readthedocs.io/en/latest/
GNU General Public License v3.0
438 stars 138 forks source link

Bug report - Common instruction IDs will redef. other libraries define macros. #196

Open khswong opened 4 years ago

khswong commented 4 years ago
Any bug report raised here MUST be submitted according to this template or it will be flagged with 'Not enough information'. No action will be taken till all the prerequisite information is provided. If no information is provided for over a month after the 'Not enough information' label is applied, the issue will be closed.

Pre-bug report checklist:

Do this checklist before filing an bug report:


Bug Report

Describe the bug

Not sure what the proper way of fixing this is, but ID is a common identifier and defines.h will interfere with different driver naming. Also, it's already def'd as MANID and isn't used anywhere.

This is line 90 in defines.h

#define ID            0x90

To Reproduce

#include <ICM_20948.h>
#include <SPIMemory.h> 
void setup(){}
void loop(){}

Compiler output:

/.../SPIMemory/src/defines.h:90:23: error: expected unqualified-id before numeric constant
 #define ID            0x90
                       ^
/.../SparkFun_ICM-20x48_ArduinoLibrary/src/util/ICM_20948_REGISTERS.h:672:10: note: in expansion of macro 'ID'
  uint8_t ID       : 7

Software environment (please complete the following information):

Additional context

Again, not sure what the best practices of #define macro naming conventions are. Possibly prepend the identifiers in your defines with SPIMEMORY_XX etc.? Or locally scope it somehow, or put it inside an enum with the same prefix?


DO NOT DELETE OR EDIT anything below this

Note 1: Make sure to add all the information needed to understand the bug so that someone can help. If any essential information is missing we'll add the 'Needs more information' label and close the issue until there is enough information.

Note 2: For support questions (for example, tutorials on how to use the library), please use the Arduino Forums. This repository's issues are reserved for feature requests and bug reports.


GitHub issue state GitHub issue title GitHub issue author GitHub issue label GitHub issue comments GitHub issue age GitHub issue last update