0

SPI Library
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

SPI Library

by fabriziosilvetti on Mon Feb 23, 2015 7:41 am

Good morning, I purchase some Music Maker "MP3 Shield", but I have problems programming Arduino UNO for their use.
I'm using Arduino UNO + Adafruit Music Maker "MP3 Shield" with Arduino 1.6.0 IDE.
Charging the Adafruit Example Sketch the compiler return me this error message:

------------------------------------------------------------------------------------------------------------
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:27:8: error: 'SPISettings' does not name a type
static SPISettings settings;
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp: In member function 'void Sd2Card::chipSelectHigh()':
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:167:9: error: 'class SPIClass' has no member named 'endTransaction'
SPI.endTransaction();
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp: In member function 'void Sd2Card::chipSelectLow()':
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:176:9: error: 'class SPIClass' has no member named 'beginTransaction'
SPI.beginTransaction(settings);
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:176:26: error: 'settings' was not declared in this scope
SPI.beginTransaction(settings);
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp: In member function 'uint8_t Sd2Card::init(uint8_t, uint8_t)':
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:269:3: error: 'settings' was not declared in this scope
settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:269:53: error: 'SPISettings' was not declared in this scope
settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:275:7: error: 'class SPIClass' has no member named 'beginTransaction'
SPI.beginTransaction(settings);
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:279:7: error: 'class SPIClass' has no member named 'endTransaction'
SPI.endTransaction();
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp: In member function 'uint8_t Sd2Card::setSckRate(uint8_t)':
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:518:14: error: 'settings' was not declared in this scope
case 0: settings = SPISettings(25000000, MSBFIRST, SPI_MODE0); break;
^
C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:518:66: error: 'SPISettings' was not declared in this scope
case 0: settings = SPISettings(25000000, MSBFIRST, SPI_MODE0); break;
^
Errore durante la compilazione
------------------------------------------------------------------------------------------------------------

the sketch is:

------------------------------------------------------------------------------------------------------------
Code: Select all | TOGGLE FULL SIZE
/***************************************************
  This is an example for the Adafruit VS1053 Codec Breakout
  Designed specifically to work with the Adafruit VS1053 Codec Breakout
  ----> https://www.adafruit.com/products/1381
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!
  Written by Limor Fried/Ladyada for Adafruit Industries. 
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>

// define the pins used
//#define CLK 13       // SPI Clock, shared with SD card
//#define MISO 12      // Input data, from VS1053/SD card
//#define MOSI 11      // Output data, to VS1053/SD card
// Connect CLK, MISO and MOSI to hardware SPI pins.
// See http://arduino.cc/en/Reference/SPI "Connections"

// These are the pins used for the breakout example
#define BREAKOUT_RESET  9      // VS1053 reset pin (output)
#define BREAKOUT_CS     10     // VS1053 chip select pin (output)
#define BREAKOUT_DCS    8      // VS1053 Data/command select pin (output)
// These are the pins used for the music maker shield
#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
#define SHIELD_CS     7      // VS1053 chip select pin (output)
#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)

// These are common pins between breakout and shield
#define CARDCS 4     // Card chip select pin
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  // create breakout-example object!
  //Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);
  // create shield-example object!
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
 
void setup() {
  Serial.begin(9600);
  Serial.println("Adafruit VS1053 Simple Test");

  if (! musicPlayer.begin()) { // initialise the music player
     Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
     while (1);
  }
  Serial.println(F("VS1053 found"));
 
  SD.begin(CARDCS);    // initialise the SD card
 
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20,20);

  // Timer interrupts are not suggested, better to use DREQ interrupt!
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
  // audio playing
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
 
  // Play one file, don't return until complete
  Serial.println(F("Playing track 001"));
  musicPlayer.playFullFile("track001.mp3");
  // Play another file in the background, REQUIRES interrupts!
  Serial.println(F("Playing track 002"));
  musicPlayer.startPlayingFile("track002.mp3");
}

void loop() {
  // File is playing in the background
  if (musicPlayer.stopped()) {
    Serial.println("Done playing music");
    while (1);
  }
  if (Serial.available()) {
    char c = Serial.read();
   
    // if we get an 's' on the serial console, stop!
    if (c == 's') {
      musicPlayer.stopPlaying();
    }
   
    // if we get an 'p' on the serial console, pause/unpause!
    if (c == 'p') {
      if (! musicPlayer.paused()) {
        Serial.println("Paused");
        musicPlayer.pausePlaying(true);
      } else {
        Serial.println("Resumed");
        musicPlayer.pausePlaying(false);
      }
    }
  }

  delay(100);
}

------------------------------------------------------------------------------------------------------------

Can I have your help???
Last edited by adafruit_support_bill on Mon Feb 23, 2015 8:25 am, edited 1 time in total.
Reason: Please use the '</>' button when posting code. Paste your code between the [code] tags.

fabriziosilvetti
 
Posts: 2
Joined: Sat Feb 21, 2015 4:36 pm

Re: SPI Library

by adafruit_support_bill on Mon Feb 23, 2015 8:27 am

[Moved to the Arduino Shields forum]
error: 'SPISettings' does not name a type

This error means that the compiler was not able to find the library in the expected location. Please make sure that the library is installed according to these instructions: https://learn.adafruit.com/adafruit-all ... -libraries

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: SPI Library

by fabriziosilvetti on Mon Feb 23, 2015 10:49 am

It's all right!!! Thanks
Problem solved..

fabriziosilvetti
 
Posts: 2
Joined: Sat Feb 21, 2015 4:36 pm

Re: SPI Library

by 4711engel on Sun Jul 14, 2019 3:31 pm

Hallo,
ich habe folgendes Problem beim Kompilieren eines sketches.
Fehlermeldung:

In file included from InternetClock_ILI9341.ino:18:0:
C:\Users\uengel\Documents\Arduino\libraries\SPI/SPI.h:1378:8: error: 'SPIClass' does not name a type
extern SPIClass SPI;
^
In file included from InternetClock_ILI9341.ino:19:0:
C:\Users\uengel\Documents\Arduino\libraries\TFT_ILI9341_ESP/TFT_ILI9341_ESP.h:496:13: error: 'SPIClass' does not name a type
SPIClass *_SPI;
^

Ich verwende IDE 1.6.5 und den sketch aus dem Tutorial:
http://embedded-lab.com/blog/tutorial-8 ... nt-2458495

Da ich Anfänger bin, habe ich bis jetzt keine Erklärung für den SPI-Fehler.
Kannst Du helfen?

Danke
Ulli
Attachments
InternetClock_ILI9341.zip
(770.78 KiB) Downloaded 6 times

4711engel
 
Posts: 44
Joined: Sat Mar 28, 2015 3:33 pm

Please be positive and constructive with your questions and comments.