FlexIO and SPI and SSD1306 - testing...
I had not yet done any testing using Flex IO pin the unit 2:...
Also I had not updated my SSD1306 test library to allow the Async updates on the Flex SPI, yet...
So I decided to hack up the Multiple display test program as I have a few more of the displays sitting around from the T3.5/6 beta days...
So hooked up a third display this one was a 64 pixel high one...
Then hacked up the animation test, to work with all three displays and try to have them run reasonably independent of each other and update using DMA SPI...
That is the function looks like:
Code:
typedef struct {
int8_t x;
int8_t y;
int8_t deltaY;
} star_positions;
void testanimate(const uint8_t *bitmap, uint8_t w, uint8_t h) {
int8_t f;
star_positions icons[NUMFLAKES][ NUM_DISPLAYS];
uint32_t loop_count[NUM_DISPLAYS];
uint8_t iDisplay;
for (iDisplay = 0; iDisplay < NUM_DISPLAYS; iDisplay++) {
SSD1306_FlexIO *pdisp = display_list[iDisplay];
// Initialize 'snowflake' positions
Serial.printf("Display %d\n", iDisplay);
for (f = 0; f < NUMFLAKES; f++) {
icons[f][iDisplay].x = random(1 - LOGO_WIDTH, pdisp->width());
icons[f][iDisplay].y = -LOGO_HEIGHT;
icons[f][iDisplay].deltaY = random(1, 6);
Serial.print(F("x: "));
Serial.print(icons[f][iDisplay].x, DEC);
Serial.print(F(" y: "));
Serial.print(icons[f][iDisplay].y, DEC);
Serial.print(F(" dy: "));
Serial.println(icons[f][iDisplay].deltaY, DEC);
}
loop_count[iDisplay] = 0;
pdisp->setTextSize(2); // Normal 1:1 pixel scale
pdisp->setTextColor(WHITE); // Draw white text
}
// Main loop
for (;;) { // Loop forever...
for (iDisplay = 0; iDisplay < NUM_DISPLAYS; iDisplay++) {
SSD1306_FlexIO *pdisp = display_list[iDisplay];
if (!pdisp->displayAsyncActive()) {
pdisp->clearDisplay();
// Draw each snowflake:
for (f = 0; f < NUMFLAKES; f++) {
pdisp->drawBitmap(icons[f][iDisplay].x, icons[f][iDisplay].y, bitmap, w, h, WHITE);
}
loop_count[iDisplay]++;
pdisp->setCursor(0, 0); // Start at top-left corner
pdisp->print(loop_count[iDisplay], DEC);
pdisp->displayAsync(); // Show the display buffer on the screen
// Then update coordinates of each flake...
for (f = 0; f < NUMFLAKES; f++) {
icons[f][iDisplay].y += icons[f][iDisplay].deltaY;
// If snowflake is off the bottom of the screen...
if (icons[f][iDisplay].y >= pdisp->height()) {
// Reinitialize to a random position, just off the top
icons[f][iDisplay].x = random(1 - LOGO_WIDTH, pdisp->width());
icons[f][iDisplay].y = -LOGO_HEIGHT;
icons[f][iDisplay].deltaY = random(1, 6);
}
}
}
}
}
}
All three displays have been running pretty well:

After maybe half an hour the larger 3rd display has hung... I think it is still updating, but the controller got confused. I remember similar things happened with the earlier tests as well. Probably flaky display/too long of wires...
Edit: In case anyone is interested, I had to pull out my older Saleae Logic 16, to trace all three SPI conversations. Not nearly as fast as the Pro, but does come in handy for things like this