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);

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?