SPI_CS mapping on a Swan

I’m trying to port an I2C device to work with the Blues Swan, instead of an Arduino. All the wiring have a correspondent match, except the SPI_CS line, which I believe works by digitally activating/deactivating the peripheral. Should I simply choose a digital i/o line on the Swan and use it for the same purpose? If so, should the numerical value used on my code as below be the same as the digital line?

Ex: using D10 as CS

#define SPI_CS 10
pinMode(SPI_CS, OUTPUT);
digitalWrite(SPI_CS, HIGH);

Hi @paulohm!

Yes, you are correct. :+1:

The only thing I can think to watch out for is that some older libraries use the CS (or SS) pin. In that case you would want to change your example above to be:

#ifdef CS
#undef CS
#endif

#define CS 10
pinMode(CS, OUTPUT);
digitalWrite(CS, HIGH);
1 Like

Nice! for the record, I managed to make an Arducam SPI camera work with the Swan.

3 Likes

Hey, is it possible to share more information on this?

@paulohm Are you willing to share an example project for the Arducam? I have a 3MP Arducam Mega that i’ve been fumbling with after switching from an ESP32 to the swan.

Hey, I made the Arducam Mini 2MP Plus – OV2640 SPI Camera Module work with the swan, but you can only take photos and save them to an SD card. using the Arducam library in Arduino ide. I’m now working on compressing and sending to notehub. I can share what I have so far, but over the weekend.