Skip to content

Modifications for using with Zephyr #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mjs513
Copy link

@mjs513 mjs513 commented Aug 4, 2025

Modifications made so can be used with the GigaDisplay whether using Zephyr or mbed.

The changes made for zephyr imply that Arduino_h7_portenta is no longer needed to run the display and gfx as well as the camera - does not support UVC.

In addition as mentioned here

certain sketches will not work in the GigaDisplay library since they have not been implemented in the core:

  1. lvgl - not implemented
  2. display camera - although I can modify that one to just use the GC2145. Multiple cameras are no longer supported > like they were in mbed
  3. microphone - not implemented yet

Not sure if everyone prefers if they are deleted or just left as place holders?

@KurtE and I have been using the library since we created it.

Readme will probably have to be updated at some point. Would consider this first release

@CLAassistant
Copy link

CLAassistant commented Aug 4, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

github-actions bot commented Aug 4, 2025

Memory usage change @ af959eb

Board flash % RAM for global variables %
arduino:mbed_giga:giga 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/backlight/SimpleBacklight
flash
% examples/backlight/SimpleBacklight
RAM for global variables
% examples/basic/ArduinoLogoDrawing
flash
% examples/basic/ArduinoLogoDrawing
RAM for global variables
% examples/basic/SimpleText
flash
% examples/basic/SimpleText
RAM for global variables
% examples/camera/display_camera
flash
% examples/camera/display_camera
RAM for global variables
% examples/gfx/geometrical-shapes
flash
% examples/gfx/geometrical-shapes
RAM for global variables
% examples/gfx/hello-world
flash
% examples/gfx/hello-world
RAM for global variables
% examples/gfx/touch-switch
flash
% examples/gfx/touch-switch
RAM for global variables
% examples/imu/accelerometer
flash
% examples/imu/accelerometer
RAM for global variables
% examples/imu/gyroscope
flash
% examples/imu/gyroscope
RAM for global variables
% examples/lvgl/bar_lvgl
flash
% examples/lvgl/bar_lvgl
RAM for global variables
% examples/lvgl/button_lvgl
flash
% examples/lvgl/button_lvgl
RAM for global variables
% examples/lvgl/check_radio_lvgl
flash
% examples/lvgl/check_radio_lvgl
RAM for global variables
% examples/lvgl/image_lvgl
flash
% examples/lvgl/image_lvgl
RAM for global variables
% examples/lvgl/imu_orientation
flash
% examples/lvgl/imu_orientation
RAM for global variables
% examples/lvgl/slider_lvgl
flash
% examples/lvgl/slider_lvgl
RAM for global variables
% examples/microphone/PDMSerialPlotter
flash
% examples/microphone/PDMSerialPlotter
RAM for global variables
% examples/rgb/SimpleRGB
flash
% examples/rgb/SimpleRGB
RAM for global variables
% examples/rgb/blink
flash
% examples/rgb/blink
RAM for global variables
%
arduino:mbed_giga:giga 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/backlight/SimpleBacklight<br>flash,%,examples/backlight/SimpleBacklight<br>RAM for global variables,%,examples/basic/ArduinoLogoDrawing<br>flash,%,examples/basic/ArduinoLogoDrawing<br>RAM for global variables,%,examples/basic/SimpleText<br>flash,%,examples/basic/SimpleText<br>RAM for global variables,%,examples/camera/display_camera<br>flash,%,examples/camera/display_camera<br>RAM for global variables,%,examples/gfx/geometrical-shapes<br>flash,%,examples/gfx/geometrical-shapes<br>RAM for global variables,%,examples/gfx/hello-world<br>flash,%,examples/gfx/hello-world<br>RAM for global variables,%,examples/gfx/touch-switch<br>flash,%,examples/gfx/touch-switch<br>RAM for global variables,%,examples/imu/accelerometer<br>flash,%,examples/imu/accelerometer<br>RAM for global variables,%,examples/imu/gyroscope<br>flash,%,examples/imu/gyroscope<br>RAM for global variables,%,examples/lvgl/bar_lvgl<br>flash,%,examples/lvgl/bar_lvgl<br>RAM for global variables,%,examples/lvgl/button_lvgl<br>flash,%,examples/lvgl/button_lvgl<br>RAM for global variables,%,examples/lvgl/check_radio_lvgl<br>flash,%,examples/lvgl/check_radio_lvgl<br>RAM for global variables,%,examples/lvgl/image_lvgl<br>flash,%,examples/lvgl/image_lvgl<br>RAM for global variables,%,examples/lvgl/imu_orientation<br>flash,%,examples/lvgl/imu_orientation<br>RAM for global variables,%,examples/lvgl/slider_lvgl<br>flash,%,examples/lvgl/slider_lvgl<br>RAM for global variables,%,examples/microphone/PDMSerialPlotter<br>flash,%,examples/microphone/PDMSerialPlotter<br>RAM for global variables,%,examples/rgb/SimpleRGB<br>flash,%,examples/rgb/SimpleRGB<br>RAM for global variables,%,examples/rgb/blink<br>flash,%,examples/rgb/blink<br>RAM for global variables,%
arduino:mbed_giga:giga,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

Copy link

github-actions bot commented Aug 4, 2025

Memory usage change @ e05eb4e

Board flash % RAM for global variables %
arduino:mbed_giga:giga 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/backlight/SimpleBacklight
flash
% examples/backlight/SimpleBacklight
RAM for global variables
% examples/basic/ArduinoLogoDrawing
flash
% examples/basic/ArduinoLogoDrawing
RAM for global variables
% examples/basic/SimpleText
flash
% examples/basic/SimpleText
RAM for global variables
% examples/camera/display_camera
flash
% examples/camera/display_camera
RAM for global variables
% examples/gfx/geometrical-shapes
flash
% examples/gfx/geometrical-shapes
RAM for global variables
% examples/gfx/hello-world
flash
% examples/gfx/hello-world
RAM for global variables
% examples/gfx/touch-switch
flash
% examples/gfx/touch-switch
RAM for global variables
% examples/imu/accelerometer
flash
% examples/imu/accelerometer
RAM for global variables
% examples/imu/gyroscope
flash
% examples/imu/gyroscope
RAM for global variables
% examples/lvgl/bar_lvgl
flash
% examples/lvgl/bar_lvgl
RAM for global variables
% examples/lvgl/button_lvgl
flash
% examples/lvgl/button_lvgl
RAM for global variables
% examples/lvgl/check_radio_lvgl
flash
% examples/lvgl/check_radio_lvgl
RAM for global variables
% examples/lvgl/image_lvgl
flash
% examples/lvgl/image_lvgl
RAM for global variables
% examples/lvgl/imu_orientation
flash
% examples/lvgl/imu_orientation
RAM for global variables
% examples/lvgl/slider_lvgl
flash
% examples/lvgl/slider_lvgl
RAM for global variables
% examples/microphone/PDMSerialPlotter
flash
% examples/microphone/PDMSerialPlotter
RAM for global variables
% examples/rgb/SimpleRGB
flash
% examples/rgb/SimpleRGB
RAM for global variables
% examples/rgb/blink
flash
% examples/rgb/blink
RAM for global variables
%
arduino:mbed_giga:giga 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/backlight/SimpleBacklight<br>flash,%,examples/backlight/SimpleBacklight<br>RAM for global variables,%,examples/basic/ArduinoLogoDrawing<br>flash,%,examples/basic/ArduinoLogoDrawing<br>RAM for global variables,%,examples/basic/SimpleText<br>flash,%,examples/basic/SimpleText<br>RAM for global variables,%,examples/camera/display_camera<br>flash,%,examples/camera/display_camera<br>RAM for global variables,%,examples/gfx/geometrical-shapes<br>flash,%,examples/gfx/geometrical-shapes<br>RAM for global variables,%,examples/gfx/hello-world<br>flash,%,examples/gfx/hello-world<br>RAM for global variables,%,examples/gfx/touch-switch<br>flash,%,examples/gfx/touch-switch<br>RAM for global variables,%,examples/imu/accelerometer<br>flash,%,examples/imu/accelerometer<br>RAM for global variables,%,examples/imu/gyroscope<br>flash,%,examples/imu/gyroscope<br>RAM for global variables,%,examples/lvgl/bar_lvgl<br>flash,%,examples/lvgl/bar_lvgl<br>RAM for global variables,%,examples/lvgl/button_lvgl<br>flash,%,examples/lvgl/button_lvgl<br>RAM for global variables,%,examples/lvgl/check_radio_lvgl<br>flash,%,examples/lvgl/check_radio_lvgl<br>RAM for global variables,%,examples/lvgl/image_lvgl<br>flash,%,examples/lvgl/image_lvgl<br>RAM for global variables,%,examples/lvgl/imu_orientation<br>flash,%,examples/lvgl/imu_orientation<br>RAM for global variables,%,examples/lvgl/slider_lvgl<br>flash,%,examples/lvgl/slider_lvgl<br>RAM for global variables,%,examples/microphone/PDMSerialPlotter<br>flash,%,examples/microphone/PDMSerialPlotter<br>RAM for global variables,%,examples/rgb/SimpleRGB<br>flash,%,examples/rgb/SimpleRGB<br>RAM for global variables,%,examples/rgb/blink<br>flash,%,examples/rgb/blink<br>RAM for global variables,%
arduino:mbed_giga:giga,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

@pennam
Copy link

pennam commented Aug 5, 2025

@mjs513 I was testing this PR with the 0.3.2 core pre-release and found out that display_set_pixel_format is failing. Seems to me that in not an API of the display driver

@mjs513
Copy link
Author

mjs513 commented Aug 5, 2025

@pennam

Yeah - unfortunately they are not using the st7701 display driver. They are using this driver.

When I first started this had the same concern then found that it was different. What sketch are you trying to run?

Mike

Update:
You might want to read through the whole thread : arduino/ArduinoCore-zephyr#92 since it kind of mentions this issue at the begining of the issue and where I found its not using the expected driver.

PS as a reminder arduino_H7_video does not work currently with zephyr

@mjs513
Copy link
Author

mjs513 commented Aug 5, 2025

Here is a good example that should work:

#include "Arduino_GigaDisplay_GFX.h"

GigaDisplay_GFX tft;

unsigned long testFillScreen();
unsigned long testText();
unsigned long testLines(uint16_t color);
unsigned long testFastLines(uint16_t color1, uint16_t color2);
unsigned long testRects(uint16_t color);
unsigned long testFilledRects(uint16_t color1, uint16_t color2);
unsigned long testFilledCircles(uint8_t radius, uint16_t color);
unsigned long testCircles(uint8_t radius, uint16_t color);
unsigned long testTriangles();
unsigned long testFilledTriangles();
unsigned long testRoundRects();
unsigned long testFilledRoundRects();


void setup() {
  while(!Serial && millis()< 5000){}
  Serial.begin(9600);
  Serial.println("Zephyr Giga Display Test!");

  tft.begin();

  Serial.println(F("Benchmark                Time (microseconds)"));
  delay(10);
  Serial.print(F("Screen fill              "));
  Serial.println(testFillScreen());
  delay(500);

  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(3000);

  Serial.print(F("Lines                    "));
  Serial.println(testLines(RGB565_CYAN));
  delay(500);

  Serial.print(F("Horiz/Vert Lines         "));
  Serial.println(testFastLines(RGB565_RED, RGB565_BLUE));
  delay(500);

  Serial.print(F("Rectangles (outline)     "));
  Serial.println(testRects(RGB565_GREEN));
  delay(500);

  Serial.print(F("Rectangles (filled)      "));
  Serial.println(testFilledRects(RGB565_YELLOW, RGB565_MAGENTA));
  delay(500);

  Serial.print(F("Circles (filled)         "));
  Serial.println(testFilledCircles(10, RGB565_MAGENTA));

  Serial.print(F("Circles (outline)        "));
  Serial.println(testCircles(10, RGB565_WHITE));
  delay(500);

  Serial.print(F("Triangles (outline)      "));
  Serial.println(testTriangles());
  delay(500);

  Serial.print(F("Triangles (filled)       "));
  Serial.println(testFilledTriangles());
  delay(500);

  Serial.print(F("Rounded rects (outline)  "));
  Serial.println(testRoundRects());
  delay(500);

  Serial.print(F("Rounded rects (filled)   "));
  Serial.println(testFilledRoundRects());
  delay(500);

  Serial.println(F("Done!"));
}

void loop(void) {
  for (uint8_t rotation = 0; rotation < 4; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(1000);
  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(RGB565_BLACK);
  yield();
  tft.fillScreen(RGB565_RED);
  yield();
  tft.fillScreen(RGB565_GREEN);
  yield();
  tft.fillScreen(RGB565_BLUE);
  yield();
  tft.fillScreen(RGB565_BLACK);
  yield();
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(RGB565_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.startBuffering();
  tft.setTextColor(RGB565_WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(RGB565_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(RGB565_RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(RGB565_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  tft.endBuffering();
  return micros() - start;
}

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(RGB565_BLACK);
  yield();

  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  tft.startBuffering();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  tft.endBuffering();

  x2    = w - 1;
  tft.startBuffering();
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  tft.endBuffering();
  t     = micros() - start; // fillScreen doesn't count against timing
  yield();
  tft.fillScreen(RGB565_BLACK);


  yield();

  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  tft.startBuffering();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  tft.endBuffering();
  x2    = 0;
  tft.startBuffering();
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;
  tft.endBuffering();

  yield();
  tft.fillScreen(RGB565_BLACK);
  yield();

  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  tft.startBuffering();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  tft.endBuffering();
  x2    = w - 1;
  tft.startBuffering();
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  tft.endBuffering();
  t    += micros() - start;

  yield();
  tft.fillScreen(RGB565_BLACK);
  yield();

  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  tft.startBuffering();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  tft.startBuffering();
  x2    = 0;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  tft.endBuffering();
  yield();
  return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int           x, y, w = tft.width(), h = tft.height();

  tft.fillScreen(RGB565_BLACK);
  start = micros();
  tft.startBuffering();
  for (y = 0; y < h; y += 5) tft.drawFastHLine(0, y, w, color1);
  for (x = 0; x < w; x += 5) tft.drawFastVLine(x, 0, h, color2);
  tft.endBuffering();
  return micros() - start;
}

unsigned long testRects(uint16_t color) {
  unsigned long start;
  int           n, i, i2,
                cx = tft.width()  / 2,
                cy = tft.height() / 2;

  tft.fillScreen(RGB565_BLACK);
  n     = min(tft.width(), tft.height());
  start = micros();
  tft.startBuffering();
  for (i = 2; i < n; i += 6) {
    i2 = i / 2;
    tft.drawRect(cx - i2, cy - i2, i, i, color);
  }
  tft.endBuffering();

  return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int           n, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(RGB565_BLACK);
  n = min(tft.width(), tft.height());
  tft.startBuffering();
  for (i = n; i > 0; i -= 6) {
    i2    = i / 2;
    start = micros();
    tft.fillRect(cx - i2, cy - i2, i, i, color1);
    t    += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx - i2, cy - i2, i, i, color2);
    yield();
  }
  tft.endBuffering();

  return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

  tft.fillScreen(RGB565_BLACK);
  start = micros();
  tft.startBuffering();
  for (x = radius; x < w; x += r2) {
    for (y = radius; y < h; y += r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }
  tft.endBuffering();

  return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int           x, y, r2 = radius * 2,
                      w = tft.width()  + radius,
                      h = tft.height() + radius;

  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  tft.startBuffering();
  for (x = 0; x < w; x += r2) {
    for (y = 0; y < h; y += r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }
  tft.endBuffering();
  return micros() - start;
}

unsigned long testTriangles() {
  unsigned long start;
  int           n, i, cx = tft.width()  / 2 - 1,
                      cy = tft.height() / 2 - 1;

  tft.fillScreen(RGB565_BLACK);
  n     = min(cx, cy);
  start = micros();
  tft.startBuffering();
  for (i = 0; i < n; i += 5) {
    tft.drawTriangle(
      cx    , cy - i, // peak
      cx - i, cy + i, // bottom left
      cx + i, cy + i, // bottom right
      tft.color565(i, i, i));
  }
  tft.endBuffering();

  return micros() - start;
}

unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int           i, cx = tft.width()  / 2 - 1,
                   cy = tft.height() / 2 - 1;

  tft.fillScreen(RGB565_BLACK);
  start = micros();
  tft.startBuffering();
  for (i = min(cx, cy); i > 10; i -= 5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
                     tft.color565(0, i * 10, i * 10));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
                     tft.color565(i * 10, i * 10, 0));
    yield();
  }
  tft.endBuffering();
  return t;
}

unsigned long testRoundRects() {
  unsigned long start;
  int           w, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(RGB565_BLACK);
  w     = min(tft.width(), tft.height());
  start = micros();
  tft.startBuffering();
  for (i = 0; i < w; i += 6) {
    i2 = i / 2;
    tft.drawRoundRect(cx - i2, cy - i2, i, i, i / 8, tft.color565(i, 0, 0));
  }
  tft.endBuffering();
  return micros() - start;
}

unsigned long testFilledRoundRects() {
  unsigned long start;
  int           i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(RGB565_BLACK);
  start = micros();
  tft.startBuffering();
  for (i = min(tft.width(), tft.height()); i > 20; i -= 6) {
    i2 = i / 2;
    tft.fillRoundRect(cx - i2, cy - i2, i, i, i / 8, tft.color565(0, i, 0));
    yield();
  }
  tft.endBuffering();

  return micros() - start;
}

Sorry in the middle of something else .. havent synched up with the pre-release version yet. Probably later today.

@pennam
Copy link

pennam commented Aug 5, 2025

Thanks for the info, i may have fount the issue, now (zephyr release 4.2) the driver is using PIXEL_FORMAT_BGR_565 to set LTDC_PIXEL_FORMAT_RGB565

zephyrproject-rtos/zephyr#92483

https://github.com/zephyrproject-rtos/zephyr/blob/772fbfe9ccec546644993019d713e82d2969ddf4/drivers/display/display_stm32_ltdc.c#L113

@mjs513
Copy link
Author

mjs513 commented Aug 5, 2025

Thanks for the info, i may have fount the issue, now the driver is using PIXEL_FORMAT_BGR_565 to set LTDC_PIXEL_FORMAT_RGB565

Ok thats a change - thanks for the update. Right now in the gigsdisplay.h file I have:

bool begin(DisplayPixelFormat pixformat = DISPLAY_RGB565);

and this so it may still work:

enum DisplayPixelFormat {
    DISPLAY_RGB565,    /**< RGB565 format (16-bit). */
    DISPLAY_RGB888    /**< RGB888 format (16-bit). */
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants