From 49c2c71fa6cc988b1a7e27724e7df5477779b9d6 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Feb 2025 09:33:13 -0600 Subject: [PATCH 1/4] Ignore generated files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index a007fea..5a97b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ build/* +/doxygen +/html From 35a6298bb2798ecacfcde94de99eb9409e93a024 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Feb 2025 09:34:50 -0600 Subject: [PATCH 2/4] Add 640x480 and 720x400 modes And permit non-pixel-multiplied palette modes --- src/Adafruit_dvhstx.cpp | 8 ++++++++ src/Adafruit_dvhstx.h | 6 +++++- src/drivers/dvhstx/dvhstx.cpp | 8 ++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Adafruit_dvhstx.cpp b/src/Adafruit_dvhstx.cpp index 1730437..71c1c79 100644 --- a/src/Adafruit_dvhstx.cpp +++ b/src/Adafruit_dvhstx.cpp @@ -13,10 +13,14 @@ int16_t dvhstx_width(DVHSTXResolution r) { return 400; case DVHSTX_RESOLUTION_320x240: return 320; + case DVHSTX_RESOLUTION_640x480: + return 640; case DVHSTX_RESOLUTION_360x240: return 360; case DVHSTX_RESOLUTION_360x200: return 360; + case DVHSTX_RESOLUTION_720x400: + return 720; case DVHSTX_RESOLUTION_360x288: return 360; case DVHSTX_RESOLUTION_400x300: @@ -42,10 +46,14 @@ int16_t dvhstx_height(DVHSTXResolution r) { return 225; case DVHSTX_RESOLUTION_320x240: return 240; + case DVHSTX_RESOLUTION_640x480: + return 480; case DVHSTX_RESOLUTION_360x240: return 240; case DVHSTX_RESOLUTION_360x200: return 200; + case DVHSTX_RESOLUTION_720x400: + return 400; case DVHSTX_RESOLUTION_360x288: return 288; case DVHSTX_RESOLUTION_400x300: diff --git a/src/Adafruit_dvhstx.h b/src/Adafruit_dvhstx.h index 17ceedb..4c1442b 100644 --- a/src/Adafruit_dvhstx.h +++ b/src/Adafruit_dvhstx.h @@ -27,10 +27,14 @@ struct enum { DVHSTX_RESOLUTION_320x240, ///< well supported, aspect ratio 4:3, actual ///< resolution 640x480@60Hz + DVHSTX_RESOLUTION_640x480, ///< well supported, aspect ratio 4:3, actual + ///< resolution 640x480@60Hz DVHSTX_RESOLUTION_360x240, ///< well supported, aspect ratio 3:2, actual ///< resolution 720x480@60Hz DVHSTX_RESOLUTION_360x200, ///< well supported, aspect ratio 9:5, actual - ///< resolution 720x400@70Hz + ///< resolution 720x400@70Hz (very close to 16:9) + DVHSTX_RESOLUTION_720x400, ///< well supported, aspect ratio 9:5, actual + ///< resolution 720x400@70Hz (very close to 16:9) DVHSTX_RESOLUTION_360x288, ///< well supported, aspect ratio 5:4, actual ///< resolution 720x576@60Hz DVHSTX_RESOLUTION_400x300, ///< well supported, aspect ratio 4:3, actual diff --git a/src/drivers/dvhstx/dvhstx.cpp b/src/drivers/dvhstx/dvhstx.cpp index 9cadd0c..20fa07c 100644 --- a/src/drivers/dvhstx/dvhstx.cpp +++ b/src/drivers/dvhstx/dvhstx.cpp @@ -209,13 +209,17 @@ void __scratch_x("display") DVHSTX::gfx_dma_handler() { *dst_ptr++ = val; *dst_ptr++ = val; } - } - else { + } else if (h_repeat_shift == 1) { for (int i = 0; i < timing_mode->h_active_pixels; i += 2) { uint32_t val = display_palette[*src_ptr++]; *dst_ptr++ = val; *dst_ptr++ = val; } + } else { + for (int i = 0; i < timing_mode->h_active_pixels; i += 1) { + uint32_t val = display_palette[*src_ptr++]; + *dst_ptr++ = val; + } } } } From 1a37ef563bccb6b184c9c16836da632e178bc23f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Feb 2025 09:45:46 -0600 Subject: [PATCH 3/4] Make more interesting use of the palette mode --- examples/01palettetest/01palettetest.ino | 37 ++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/examples/01palettetest/01palettetest.ino b/examples/01palettetest/01palettetest.ino index c6204f7..11759dd 100644 --- a/examples/01palettetest/01palettetest.ino +++ b/examples/01palettetest/01palettetest.ino @@ -10,6 +10,25 @@ DVHSTX8 display(DVHSTX_PINOUT_DEFAULT, DVHSTX_RESOLUTION_640x360); // The order is: {CKP, D0P, D1P, D2P} DVHSTX8 display({12, 14, 16, 18}, // DVHSTX_RESOLUTION_640x360); +struct moving_point { + int x, y, dx, dy; + void step() { + x += dx; + if (x < 0) { x = 0; dx = random(3) + 1; } + if (x >= display.width()) { x = display.width() - 1; dx = -random(3) - 1; } + + y += dy; + if (y < 0) { y = 0; dy = random(3) + 1; } + if (y >= display.height()) { y = display.height() - 1; dy = -random(3) - 1; } + } +}; + +moving_point p1, p2; + +int random_with_sign(int n) { + return random(2) ? random(n-1)+1 : -random(n-1)-1; +} + void setup() { Serial.begin(115200); // while(!Serial); @@ -19,12 +38,20 @@ void setup() { digitalWrite(LED_BUILTIN, (millis() / 500) & 1); } Serial.println("display initialized"); + p1 = moving_point{random(display.width()), random(display.height()), random_with_sign(3), random_with_sign(3)}; + p2 = moving_point{random(display.width()), random(display.height()), random_with_sign(3), random_with_sign(3)}; } void loop() { - // Draw random lines - display.drawLine(random(display.width()), random(display.height()), - random(display.width()), random(display.height()), - random(65536)); - sleep_ms(1); + static int j; + display.drawLine(p1.x, p1.y, p2.x, p2.y, 1 + (j + 254) % 255); +Serial.printf("%d %d %d %d\r\n", p1.x, p1.y, p1.dx, p1.dy); + p1.step(); + p2.step(); + + for(int i=1; i<256; i++) { + display.setColor(i, ((i + j) % 255) * 0x010101); + } + j += 1; + delay(3); } From e21bf9a48401e0d80a17ed6aa3b28bd77eeb3843 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Feb 2025 11:20:03 -0600 Subject: [PATCH 4/4] clang-format --- src/Adafruit_dvhstx.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Adafruit_dvhstx.h b/src/Adafruit_dvhstx.h index 4c1442b..d3f4ab7 100644 --- a/src/Adafruit_dvhstx.h +++ b/src/Adafruit_dvhstx.h @@ -32,9 +32,11 @@ struct enum { DVHSTX_RESOLUTION_360x240, ///< well supported, aspect ratio 3:2, actual ///< resolution 720x480@60Hz DVHSTX_RESOLUTION_360x200, ///< well supported, aspect ratio 9:5, actual - ///< resolution 720x400@70Hz (very close to 16:9) + ///< resolution 720x400@70Hz (very close to + ///< 16:9) DVHSTX_RESOLUTION_720x400, ///< well supported, aspect ratio 9:5, actual - ///< resolution 720x400@70Hz (very close to 16:9) + ///< resolution 720x400@70Hz (very close to + ///< 16:9) DVHSTX_RESOLUTION_360x288, ///< well supported, aspect ratio 5:4, actual ///< resolution 720x576@60Hz DVHSTX_RESOLUTION_400x300, ///< well supported, aspect ratio 4:3, actual