Jump to content
  • 0

Compiling error using analogShield library


yzhu

Question

Posted

Hi digilentinc forum! 

I added analogShield library following the instruction in Analog Shield Manual 02 - First Time Setup R03.pdf. However, I got an error message when trying to compile the passthrough example. I tried and failed to compile with both 1.5.x ver. and 1.6.x Arduino IDE. The error message seems to refer to objects inside analogShield.cpp file, which I never modified. 

Any suggestion on how to fix this bug is appreciated. 

Here is the error message:

Arduino: 1.6.9 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:831:11: warning: extra tokens at end of #else directive [enabled by default]
    #else  (__AVR__)
           ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp: In member function 'unsigned int analogShield::read(int, bool)':
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:314:21: error: 'SPI_MODE_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE3;
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:314:38: error: 'SPI_MODE3' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE3;
                                      ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:315:21: error: 'SPI_CLOCK_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:315:40: error: 'SPI_CLOCK_DIV2' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                                        ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:316:21: error: 'SPI_2XCLOCK_MASK' was not declared in this scope
     SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((SPI_CLOCK_DIV2 >> 2) & SPI_2XCLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp: In member function 'int analogShield::signedRead(int, bool)':
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:453:21: error: 'SPI_MODE_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE3;
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:453:38: error: 'SPI_MODE3' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE3;
                                      ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:454:21: error: 'SPI_CLOCK_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:454:40: error: 'SPI_CLOCK_DIV2' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                                        ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:455:21: error: 'SPI_2XCLOCK_MASK' was not declared in this scope
     SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((SPI_CLOCK_DIV2 >> 2) & SPI_2XCLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp: In member function 'void analogShield::write(int, unsigned int)':
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:730:21: error: 'SPI_MODE_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE1;
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:730:38: error: 'SPI_MODE1' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE1;
                                      ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:731:21: error: 'SPI_CLOCK_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:731:40: error: 'SPI_CLOCK_DIV2' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                                        ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:732:21: error: 'SPI_2XCLOCK_MASK' was not declared in this scope
     SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((SPI_CLOCK_DIV2 >> 2) & SPI_2XCLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp: In member function 'void analogShield::write(unsigned int, unsigned int, bool)':
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:833:21: error: 'SPI_MODE_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE1;
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:833:38: error: 'SPI_MODE1' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE1;
                                      ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:834:21: error: 'SPI_CLOCK_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:834:40: error: 'SPI_CLOCK_DIV2' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                                        ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:835:21: error: 'SPI_2XCLOCK_MASK' was not declared in this scope
     SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((SPI_CLOCK_DIV2 >> 2) & SPI_2XCLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp: In member function 'void analogShield::write(unsigned int, unsigned int, unsigned int, bool)':
/Users/yz536/Documents/Arduino/libraries/analogShield/analogShield.cpp:882:21: error: 'SPI_MODE_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE1;
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:882:38: error: 'SPI_MODE1' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE1;
                                      ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:883:21: error: 'SPI_CLOCK_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:883:40: error: 'SPI_CLOCK_DIV2' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                                        ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:884:21: error: 'SPI_2XCLOCK_MASK' was not declared in this scope
     SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((SPI_CLOCK_DIV2 >> 2) & SPI_2XCLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp: In member function 'void analogShield::write(unsigned int, unsigned int, unsigned int, unsigned int, bool)':
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:937:21: error: 'SPI_MODE_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE1;
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:937:38: error: 'SPI_MODE1' was not declared in this scope
     SPCR = (SPCR & ~SPI_MODE_MASK) | SPI_MODE1;
                                      ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:938:21: error: 'SPI_CLOCK_MASK' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                     ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:938:40: error: 'SPI_CLOCK_DIV2' was not declared in this scope
     SPCR = (SPCR & ~SPI_CLOCK_MASK) | (SPI_CLOCK_DIV2 & SPI_CLOCK_MASK);
                                        ^
/Users/.../Documents/Arduino/libraries/analogShield/analogShield.cpp:939:21: error: 'SPI_2XCLOCK_MASK' was not declared in this scope
     SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((SPI_CLOCK_DIV2 >> 2) & SPI_2XCLOCK_MASK);
                     ^
exit status 1
Error compiling for board Arduino/Genuino Uno.

 

2 answers to this question

Recommended Posts

Posted

Hi yzhu,

So I went and added the most recent Analog Shield library (available from GitHub here) as well as a couple of older versions of the library on both MPIDE and Arduino IDE 1.6.x as was able to successfully compile the various examples without any complaints from the compiler. Are you using the most recent version of the Analog Shield library? 

Thanks,
JColvin

Posted

Hi JColvin,

Indeed I was using a different library; I managed to compile in 1.6.x using the one you suggested. 

Thanks very much.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...