I have a class that implements a software spi routine. Several of the hardware devices have their own classes and they use the spi class.
spi class has a begin routine that initializes the hardware pins.
Do I simply create a new instance in each of the device classes for the spi and also for each call the spi.begin so it assigns those pins to the instance?
So in say Memory class
SoftwareSpi memSpi;
memSpi.begin(MOSIPIN,MISOPIN,SCKPIN,MEMCSPIN);
and in RTC class
SoftwareSpi rtcSpi;
rtcSpi.begin(MOSIPIN, MISOPIN, SCKPIN, RTCCSPIN);
OR can I set up the SoftwareSpi to act like Serial that can be accessed from multiple files.
Then in main process I do SoftwareSpi.begin(MOSIPIN,MISOPIN,SCKPIN,MEMCSPIN);
Thanks