After testing out the MCP23017 attached to the T3.6 while the T3.5 was accessing it, I decided to attach a MCP23S17 (SPI) variant to the Teensy 3.2 node on the network.
Here's the loop code on the T3.5 to talk to the T3.2 SPI bus:
Code:
delay(1000); // wait 1 seconds for next loop
node112.SPI.setMOSI(11);
node112.SPI.setMISO(12);
node112.SPI.setSCK(14);
node112.SPI.setCS(15);
node112.pinMode(15, OUTPUT);
node112.SPI.begin();
uint8_t chipselect = 15;
node112.SPI.beginTransaction(4000000, MSBFIRST, SPI_MODE0);
node112.digitalWrite(chipselect, LOW); // Configure hardware enabled addressing for all chips on given chipselect.
node112.SPI.transfer(0x40); // Write command to init all chips.
node112.SPI.transfer(0x0A); // Write IOCONA register
node112.SPI.transfer(0x18); // DISSLW & HAEN on, other bits off.
node112.digitalWrite(chipselect, HIGH);
node112.SPI.endTransaction();
node112.SPI.beginTransaction(4000000, MSBFIRST, SPI_MODE0);
node112.digitalWrite(chipselect, LOW); // Configure hardware enabled addressing for all chips on given chipselect.
node112.SPI.transfer(0x4E); // Write command to init all chips.
node112.SPI.transfer(0x0A); // Write IOCONA register
node112.SPI.transfer(0x18); // DISSLW & HAEN on, other bits off.
node112.digitalWrite(chipselect, HIGH);
node112.SPI.endTransaction();
node112.SPI.beginTransaction(4000000, MSBFIRST, SPI_MODE0);
node112.digitalWrite(chipselect, LOW);
node112.SPI.transfer(0x41 | ((0x20 & 0b111) << 1)); // Read command for addressed chip.
node112.SPI.transfer(0x12);
byte data = node112.SPI.transfer(0xFF);
node112.digitalWrite(chipselect, HIGH);
node112.SPI.endTransaction();
Serial.print("SPI DATA: ----------------------------------->> ");
Serial.println(data);
output on the T3.5 from accessing the T3.2 SPI bus:
Code:
SPI DATA: ----------------------------------->> 128
This pin (8th on bank1) is tied to VCC and correctly shows values when sweeping accross the pins.
I also added touchRead support for supported teensies:
Code:
Serial.print("TOUCHREAD ################################ "); Serial.println(node123.touchRead(23));
Output from T3.5 accessing T3.6 touch pin 23:
Code:
TOUCHREAD ################################ 1020