Use of multiple SPI Channels and global instantiation
RogerClark Fri Jun 05, 2015 11:39 am
I was looking at the VS1003 lib and thought it would be good to try to playback and MP3 from the SD card, but rather than running both the SD and the VS1003 MP3 player on the same SPI, I thought I’d change the VS1003 lib so that I can add an extra argument to the constructor for the SPI device / Class instance, which is defaulted to SPI
However, I ram into 2 issues
I’m not keen on the style of code here, either,… run with me on this one.
First add an argument for the _spi and default it to SPI
VS1003( uint8_t _cs_pin, uint8_t _dcs_pin, uint8_t _dreq_pin, uint8_t _reset_pin, SPIClass _spi = SPI);
then set the member my_SPI with this in the constructor.
VS1003::VS1003( uint8_t _cs_pin, uint8_t _dcs_pin, uint8_t _dreq_pin, uint8_t _reset_pin, SPIClass _spiChan):
cs_pin(_cs_pin), dcs_pin(_dcs_pin), dreq_pin(_dreq_pin), reset_pin(_reset_pin), my_SPI(_spiChan)
{
}
