chyba kompilace SPI

Odpovědět
Uživatelský avatar
Diego
Příspěvky: 166
Registrován: 23 črc 2017, 09:43
Reputation: 0
Kontaktovat uživatele:

chyba kompilace SPI

Příspěvek od Diego » 17 říj 2022, 04:35

Ahoj všem, zkoušim napsat program pro Arduino RP2040 ale překladač mi hází chybu hned jak přidam knihovnu pro SPI.

#include "SPI.h"

void setup() {
// put your setup code here, to run once:
}

void loop() {
// put your main code here, to run repeatedly:
}

Kód: Vybrat vše

In file included from /home/diego/Arduino/sketch_oct17a/sketch_oct17a.ino:1:0:
/home/diego/Arduino/libraries/SPI/SPI.h: In static member function 'static byte SPIClass::transfer(byte)':
/home/diego/Arduino/libraries/SPI/SPI.h:56:3: error: 'SPDR' was not declared in this scope
   SPDR = _data;
   ^~~~
/home/diego/Arduino/libraries/SPI/SPI.h:56:3: note: suggested alternative: 'SPI'
   SPDR = _data;
   ^~~~
   SPI
/home/diego/Arduino/libraries/SPI/SPI.h:57:12: error: 'SPSR' was not declared in this scope
   while (!(SPSR & _BV(SPIF)))
            ^~~~
/home/diego/Arduino/libraries/SPI/SPI.h:57:12: note: suggested alternative: 'SPI'
   while (!(SPSR & _BV(SPIF)))
            ^~~~
            SPI
/home/diego/Arduino/libraries/SPI/SPI.h:57:23: error: 'SPIF' was not declared in this scope
   while (!(SPSR & _BV(SPIF)))
                       ^~~~
/home/diego/Arduino/libraries/SPI/SPI.h:57:23: note: suggested alternative: 'SPI'
   while (!(SPSR & _BV(SPIF)))
                       ^~~~
                       SPI
/home/diego/Arduino/libraries/SPI/SPI.h:57:19: error: '_BV' was not declared in this scope
   while (!(SPSR & _BV(SPIF)))
                   ^~~
/home/diego/Arduino/libraries/SPI/SPI.h:57:19: note: suggested alternative: '_B'
   while (!(SPSR & _BV(SPIF)))
                   ^~~
                   _B
/home/diego/Arduino/libraries/SPI/SPI.h: In static member function 'static void SPIClass::attachInterrupt()':
/home/diego/Arduino/libraries/SPI/SPI.h:63:3: error: 'SPCR' was not declared in this scope
   SPCR |= _BV(SPIE);
   ^~~~
/home/diego/Arduino/libraries/SPI/SPI.h:63:3: note: suggested alternative: 'SPI'
   SPCR |= _BV(SPIE);
   ^~~~
   SPI
/home/diego/Arduino/libraries/SPI/SPI.h:63:15: error: 'SPIE' was not declared in this scope
   SPCR |= _BV(SPIE);
               ^~~~
/home/diego/Arduino/libraries/SPI/SPI.h:63:15: note: suggested alternative: 'SPI'
   SPCR |= _BV(SPIE);
               ^~~~
               SPI
/home/diego/Arduino/libraries/SPI/SPI.h:63:11: error: '_BV' was not declared in this scope
   SPCR |= _BV(SPIE);
           ^~~
/home/diego/Arduino/libraries/SPI/SPI.h:63:11: note: suggested alternative: '_B'
   SPCR |= _BV(SPIE);
           ^~~
           _B
/home/diego/Arduino/libraries/SPI/SPI.h: In static member function 'static void SPIClass::detachInterrupt()':
/home/diego/Arduino/libraries/SPI/SPI.h:67:3: error: 'SPCR' was not declared in this scope
   SPCR &= ~_BV(SPIE);
   ^~~~
/home/diego/Arduino/libraries/SPI/SPI.h:67:3: note: suggested alternative: 'SPI'
   SPCR &= ~_BV(SPIE);
   ^~~~
   SPI
/home/diego/Arduino/libraries/SPI/SPI.h:67:16: error: 'SPIE' was not declared in this scope
   SPCR &= ~_BV(SPIE);
                ^~~~
/home/diego/Arduino/libraries/SPI/SPI.h:67:16: note: suggested alternative: 'SPI'
   SPCR &= ~_BV(SPIE);
                ^~~~
                SPI
/home/diego/Arduino/libraries/SPI/SPI.h:67:12: error: '_BV' was not declared in this scope
   SPCR &= ~_BV(SPIE);
            ^~~
/home/diego/Arduino/libraries/SPI/SPI.h:67:12: note: suggested alternative: '_B'
   SPCR &= ~_BV(SPIE);
            ^~~
            _B
Multiple libraries were found for "SPI.h"
  Used: /home/diego/Arduino/libraries/SPI
  Not used: /home/diego/.arduino15/packages/arduino/hardware/mbed_nano/3.3.0/libraries/SPI
exit status 1

Compilation error: exit status 1
Když zvolim jinou arduino desku tak bez problému.

Poradí někdo?
Dík
https://arze.cz - ARduino Zapojení Elektronika

Uživatelský avatar
kiRRow
Příspěvky: 1152
Registrován: 07 kvě 2019, 07:03
Reputation: 0
Bydliště: Opava

Re: chyba kompilace SPI

Příspěvek od kiRRow » 17 říj 2022, 16:17

Aktualizovat a nebo pohledat jinačí knihovnu. Vypadá, že ta kterou máš není kompatibilní s deskou na kterou ji chceš zkompilovat.

peterple
Příspěvky: 156
Registrován: 22 zář 2021, 20:20
Reputation: 0

Re: chyba kompilace SPI

Příspěvek od peterple » 17 říj 2022, 19:08

Akualizácia nepomôže. Tato knižnica je napísaná natvrdo na AVR MCU. Ty potrebuješ buď univerzálnu, alebo na Raspberry Pi.

Uživatelský avatar
Diego
Příspěvky: 166
Registrován: 23 črc 2017, 09:43
Reputation: 0
Kontaktovat uživatele:

Re: chyba kompilace SPI

Příspěvek od Diego » 18 říj 2022, 04:35

Tak už to funguje, dík za nasměrování ;)
https://arze.cz - ARduino Zapojení Elektronika

Odpovědět

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 17 hostů