QTPY SAMD21 SPI slave

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
starrvey
 
Posts: 18
Joined: Sat Aug 27, 2022 9:18 pm

QTPY SAMD21 SPI slave

Post by starrvey »

Hi- I have a question about editing a SERCOM for the QTPY-M0. I want to re-define the existing SPI port to be a slave so the QTPY becomes a slave controller for the OLED display. The existing assignment seems to be SERCOM2. I installed the SerconSPISlave library but the library does not define Sercom2. So: do I edit, say, Sercom1 to add the new Sercom , modify the handler and
a)save it back to the .cpp file ?
b) save the new definition as a new .cpp file and add to the workspace ?
c) copy the definition and handler into the sketch ?
d) something else? Does it matter??
thanks-harvey

User avatar
starrvey
 
Posts: 18
Joined: Sat Aug 27, 2022 9:18 pm

Re: QTPY SAMD21 SPI slave

Post by starrvey »

Another basic question: The SercomSPISlave library assigns Sercom2 (PIO_SERCOM_ALT) to the existing SPI port though SERCOM0 (PIO_SERCOM) seems useable as well according to the SAMD21 datasheet. Regardless which Sercom definitions I use the class definition isn't seen I have SercomSPISlave.h/.cpp in the sketch folder as I keep getting this error:
C:\Users\Public\Documents\Adafruit Feather-Arduino\Gotar-OLED_adapter-with_slave\Gotar-OLED_adapter-with_slave.ino:391:18: error: expected unqualified-id before '.' token
391 | Sercom0SPISlave.SercomInit(SPISlave.MOSI_Pins::PA10, SPISlave.SCK_Pins::PA08, SPISlave.SS_Pins::PA01, SPISlave.MISO_Pins::PA09);
Sercom0SPISlave isn't seen though the definition is in the .h file. And when I add the same definitions into the main sketch file I get a duplicate definition error. The syntax looks ok. I'm a newbie to Arduino and can't spot what I"m doing wrong.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”