2026-10-05 21:00:42 +02:00
|
|
|
// Test sketch: bring up the EL512.256-H and draw a test pattern with Adafruit GFX.
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
#include <EL512.h>
|
|
|
|
|
|
|
|
|
|
#include "pins.h"
|
|
|
|
|
|
|
|
|
|
static EL512Panel panel({
|
|
|
|
|
el512pins::VCLK,
|
|
|
|
|
el512pins::VID,
|
|
|
|
|
el512pins::TVID,
|
|
|
|
|
el512pins::HS,
|
|
|
|
|
el512pins::VS,
|
|
|
|
|
el512pins::ENABLE,
|
|
|
|
|
el512pins::LOWPWR_N,
|
|
|
|
|
});
|
|
|
|
|
static EL512_GFX display(panel);
|
|
|
|
|
|
|
|
|
|
static void drawTestPattern() {
|
|
|
|
|
display.fillScreen(0);
|
|
|
|
|
display.drawRect(0, 0, display.width(), display.height(), 1);
|
|
|
|
|
display.drawLine(0, 0, display.width() - 1, display.height() - 1, 1);
|
|
|
|
|
display.drawLine(display.width() - 1, 0, 0, display.height() - 1, 1);
|
|
|
|
|
|
|
|
|
|
// Checkerboard strip to check VID/TVID column ordering.
|
|
|
|
|
for (int16_t y = 8; y < 24; y++)
|
|
|
|
|
for (int16_t x = 8; x < 136; x++)
|
|
|
|
|
if ((x ^ y) & 1) display.drawPixel(x, y, 1);
|
|
|
|
|
|
|
|
|
|
display.fillCircle(display.width() / 2, display.height() / 2, 40, 1);
|
|
|
|
|
display.setTextColor(1);
|
|
|
|
|
display.setTextSize(2);
|
|
|
|
|
display.setCursor(8, 32);
|
|
|
|
|
display.print("EL512.256-H");
|
|
|
|
|
display.setTextSize(1);
|
|
|
|
|
display.setCursor(8, 56);
|
|
|
|
|
display.printf("%ux%u %.1f Hz", EL512Panel::WIDTH, EL512Panel::HEIGHT,
|
|
|
|
|
EL512Panel::refreshHz());
|
|
|
|
|
display.display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
Serial.println("EL512.256-H test");
|
|
|
|
|
|
|
|
|
|
if (!display.begin()) {
|
|
|
|
|
Serial.println("panel init failed (out of DMA memory?)");
|
|
|
|
|
while (true) delay(1000);
|
|
|
|
|
}
|
|
|
|
|
drawTestPattern();
|
|
|
|
|
Serial.printf("free heap: %u\n", ESP.getFreeHeap());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|
static uint32_t last = 0;
|
2026-10-05 21:17:29 +02:00
|
|
|
static uint32_t seconds = 0;
|
2026-10-05 21:00:42 +02:00
|
|
|
if (millis() - last >= 1000) {
|
|
|
|
|
last = millis();
|
|
|
|
|
display.fillRect(8, 72, 120, 8, 0);
|
|
|
|
|
display.setCursor(8, 72);
|
2026-10-05 21:17:29 +02:00
|
|
|
display.printf("uptime %lus", (unsigned long)seconds++);
|
2026-10-05 21:00:42 +02:00
|
|
|
display.display();
|
|
|
|
|
}
|
|
|
|
|
}
|