I am wondering if it makes any sense and/or is there a good way to
use general purpose i/o’s for multi-use within a application.
For example, I need a lot of dio’s and also need a lot of spi chip select.
I know I cannot do the following (tried it but get an exception):
GT.Socket socket = GT.Socket.GetSocket(6, false, null, null); m_pin = socket.CpuPins; // note - trying to use the same pin for 2 different things. m_SPI_Cfg = new SPI.Configuration( m_pin, // chip select false, // set low when accessing the chip 0, 0, true, // clock signal will be set to high while the device is idle true, // data is sampled on the SPI clock falling edge 1000, SPI.SPI_module.SPI2); m_dio = new OutputPort(m_pin, false); //get exception here
now, wondering would it make sense to configure for spi as shown above, then
whenever I want to use it as an i/o and not spi, just turn on or off the i/o by reconfiguring?
m_SPI_Cfg = new SPI.Configuration(
later in the application, need to turn on the i/o so -> reconfig
I’m sure this seems a little crazy, however, I will need 20 di/o’s and 20 spi channels and
will not be able to do this (40 i/o’s not avail on spider) unless I get creative…
Also, might look at multiplexing with 3 i/o’s for spi to get 24 channels, but not sure yet.
So, does anyone have an idea and do you see a problem with reconfiguring the spi channel everytime I need to turn on or off a dig. i/o?