I’m using three devices on the same SPI bus (SPI1). Do I need to call the device-specific begin() function each time I call a different device?
Here’s an example to illustrate my question (using only two of the devices):
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, -1);
tft.begin();
tft.fillScreen(ILI9341_BLACK);
ts.begin();
while (ts.bufferEmpty()) { // Wait in this while loop until touched
// "Waiting..."
}
TS_Point p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width()); // Scale from ~0->4000 to tft.width using the calibration #'s
p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
tft.begin();
tft.setCursor(0, 12); // Set tft cursor
tft.setTextColor(ILI9341_WHITE); // Set text color
tft.setTextSize(5); // Set text size
tft.print(p.x); // Print p.x on TFT
tft.print(p.y); // Print p.x on TFT
When I had the code running on Arduino, I didn’t need to do this…but for some reason, when I ported over to Photon I do.
One hypothesis is that each device is running on a different clock speed, so calling begin() sets the correct clock speed.
Another hypothesis is that it’s simply setting the CS for the correct device when I call begin()…but why wasn’t it doing that on Arduino?
Thanks for any help, in advance!