Compare commits
5 commits
main
...
drivers_re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
350a5aa1d7 | ||
|
|
d5f93199c9 | ||
|
|
9d6c356c66 | ||
|
|
a3264fdf95 | ||
|
|
e0fda41105 |
10 changed files with 1759 additions and 1991 deletions
2
.github/workflows/githubci.yml
vendored
2
.github/workflows/githubci.yml
vendored
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
run: bash ci/actions_install.sh
|
||||
|
||||
- name: test platforms
|
||||
run: python3 ci/build_platform.py feather_rp2350 feather_rp2350_tinyusb metro_rp2350 metro_rp2350_tinyusb
|
||||
run: python3 ci/build_platform.py feather_rp2350 metro_rp2350
|
||||
|
||||
- name: clang
|
||||
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
|
||||
|
|
|
|||
|
|
@ -4,11 +4,15 @@
|
|||
|
||||
// If your board definition has PIN_CKP and related defines,
|
||||
// DVHSTX_PINOUT_DEFAULT is available
|
||||
DVHSTX16 display(DVHSTX_PINOUT_DEFAULT, DVHSTX_RESOLUTION_320x240);
|
||||
// If you get the message "error: 'DVHSTX_PINOUT_DEFAULTx' was not declared"
|
||||
// then you need to give the pins numbers explicitly, like the example below.
|
||||
// The order is: {CKP, D0P, D1P, D2P} DVHSTX16 display({12, 14, 16, 18},
|
||||
// DVHSTX_RESOLUTION_320x240);
|
||||
#ifdef PIN_CKP
|
||||
DVHSTX16 display(DVHSTX_PINOUT_DEFAULT, DVHSTX_RESOLUTION_320x240);
|
||||
#else
|
||||
DVHSTX16 display({14, 18, 16, 12}, DVHSTX_RESOLUTION_320x240);
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,15 @@
|
|||
|
||||
// If your board definition has PIN_CKP and related defines,
|
||||
// DVHSTX_PINOUT_DEFAULT is available
|
||||
DVHSTX8 display(DVHSTX_PINOUT_DEFAULT, DVHSTX_RESOLUTION_640x360);
|
||||
// If you get the message "error: 'DVHSTX_PINOUT_DEFAULTx' was not declared"
|
||||
// then you need to give the pins numbers explicitly, like the example below.
|
||||
// The order is: {CKP, D0P, D1P, D2P} DVHSTX8 display({12, 14, 16, 18},
|
||||
// DVHSTX_RESOLUTION_640x360);
|
||||
#ifdef PIN_CKP
|
||||
DVHSTX16 display(DVHSTX_PINOUT_DEFAULT, DVHSTX_RESOLUTION_320x240);
|
||||
#else
|
||||
DVHSTX16 display({14, 18, 16, 12}, DVHSTX_RESOLUTION_320x240);
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
|
|
|||
|
|
@ -4,12 +4,16 @@
|
|||
|
||||
// If your board definition has PIN_CKP and related defines,
|
||||
// DVHSTX_PINOUT_DEFAULT is available
|
||||
DVHSTXText3 display(DVHSTX_PINOUT_DEFAULT);
|
||||
// If you get the message "error: 'DVHSTX_PINOUT_DEFAULTx' was not declared"
|
||||
// then you need to give the pins numbers explicitly, like the example below.
|
||||
// The order is: {CKP, D0P, D1P, D2P}.
|
||||
//
|
||||
// DVHSTXText3 display({12, 14, 16, 18});
|
||||
#ifdef PIN_CKP
|
||||
DVHSTX16 display(DVHSTX_PINOUT_DEFAULT, DVHSTX_RESOLUTION_320x240);
|
||||
#else
|
||||
DVHSTX16 display({14, 18, 16, 12}, DVHSTX_RESOLUTION_320x240);
|
||||
#endif
|
||||
|
||||
const static TextColor colors[] = {
|
||||
TextColor::TEXT_BLACK, TextColor::TEXT_RED, TextColor::TEXT_GREEN,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -2,167 +2,156 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "hardware/gpio.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/gpio.h"
|
||||
|
||||
// DVI HSTX driver for use with Pimoroni PicoGraphics
|
||||
|
||||
namespace pimoroni {
|
||||
|
||||
struct DVHSTXPinout {
|
||||
uint8_t clk_p, rgb_p[3];
|
||||
};
|
||||
|
||||
typedef uint32_t RGB888;
|
||||
|
||||
// Digital Video using HSTX
|
||||
// Valid screen modes are:
|
||||
// Pixel doubled: 640x480 (60Hz), 720x480 (60Hz), 720x400 (70Hz), 720x576
|
||||
// (50Hz),
|
||||
// 800x600 (60Hz), 800x480 (60Hz), 800x450 (60Hz), 960x540
|
||||
// (60Hz), 1024x768 (60Hz)
|
||||
// Pixel doubled or quadrupled: 1280x720 (50Hz)
|
||||
//
|
||||
// Giving valid resolutions:
|
||||
// 320x180, 640x360 (well supported, square pixels on a 16:9 display)
|
||||
// 480x270, 400x225 (sometimes supported, square pixels on a 16:9 display)
|
||||
// 320x240, 360x240, 360x200, 360x288, 400x300, 512x384 (well supported, but
|
||||
// pixels aren't square) 400x240 (sometimes supported, pixels aren't square)
|
||||
//
|
||||
// Note that the double buffer is in RAM, so 640x360 uses almost all of the
|
||||
// available RAM.
|
||||
class DVHSTX {
|
||||
public:
|
||||
static constexpr int PALETTE_SIZE = 256;
|
||||
|
||||
enum Mode {
|
||||
MODE_PALETTE = 2,
|
||||
MODE_RGB565 = 1,
|
||||
MODE_RGB888 = 3,
|
||||
MODE_TEXT_MONO = 4,
|
||||
MODE_TEXT_RGB111 = 5,
|
||||
struct DVHSTXPinout {
|
||||
uint8_t clk_p, rgb_p[3];
|
||||
};
|
||||
|
||||
enum TextColour {
|
||||
TEXT_BLACK = 0,
|
||||
TEXT_RED,
|
||||
TEXT_GREEN,
|
||||
TEXT_BLUE,
|
||||
TEXT_YELLOW,
|
||||
TEXT_MAGENTA,
|
||||
TEXT_CYAN,
|
||||
TEXT_WHITE,
|
||||
typedef uint32_t RGB888;
|
||||
|
||||
BG_BLACK = 0,
|
||||
BG_RED = TEXT_RED << 3,
|
||||
BG_GREEN = TEXT_GREEN << 3,
|
||||
BG_BLUE = TEXT_BLUE << 3,
|
||||
BG_YELLOW = TEXT_YELLOW << 3,
|
||||
BG_MAGENTA = TEXT_MAGENTA << 3,
|
||||
BG_CYAN = TEXT_CYAN << 3,
|
||||
BG_WHITE = TEXT_WHITE << 3,
|
||||
// Digital Video using HSTX
|
||||
// Valid screen modes are:
|
||||
// Pixel doubled: 640x480 (60Hz), 720x480 (60Hz), 720x400 (70Hz), 720x576 (50Hz),
|
||||
// 800x600 (60Hz), 800x480 (60Hz), 800x450 (60Hz), 960x540 (60Hz), 1024x768 (60Hz)
|
||||
// Pixel doubled or quadrupled: 1280x720 (50Hz)
|
||||
//
|
||||
// Giving valid resolutions:
|
||||
// 320x180, 640x360 (well supported, square pixels on a 16:9 display)
|
||||
// 480x270, 400x225 (sometimes supported, square pixels on a 16:9 display)
|
||||
// 320x240, 360x240, 360x200, 360x288, 400x300, 512x384 (well supported, but pixels aren't square)
|
||||
// 400x240 (sometimes supported, pixels aren't square)
|
||||
//
|
||||
// Note that the double buffer is in RAM, so 640x360 uses almost all of the available RAM.
|
||||
class DVHSTX {
|
||||
public:
|
||||
static constexpr int PALETTE_SIZE = 256;
|
||||
|
||||
ATTR_NORMAL_INTEN = 0,
|
||||
ATTR_LOW_INTEN = 1 << 6,
|
||||
ATTR_V_LOW_INTEN = 1 << 7 | ATTR_LOW_INTEN,
|
||||
|
||||
enum Mode {
|
||||
MODE_PALETTE = 2,
|
||||
MODE_RGB565 = 1,
|
||||
MODE_RGB888 = 3,
|
||||
MODE_TEXT_MONO = 4,
|
||||
MODE_TEXT_RGB111 = 5,
|
||||
};
|
||||
|
||||
enum TextColour {
|
||||
TEXT_BLACK = 0,
|
||||
TEXT_RED,
|
||||
TEXT_GREEN,
|
||||
TEXT_BLUE,
|
||||
TEXT_YELLOW,
|
||||
TEXT_MAGENTA,
|
||||
TEXT_CYAN,
|
||||
TEXT_WHITE,
|
||||
|
||||
BG_BLACK = 0,
|
||||
BG_RED = TEXT_RED << 3,
|
||||
BG_GREEN = TEXT_GREEN << 3,
|
||||
BG_BLUE = TEXT_BLUE << 3,
|
||||
BG_YELLOW = TEXT_YELLOW << 3,
|
||||
BG_MAGENTA = TEXT_MAGENTA << 3,
|
||||
BG_CYAN = TEXT_CYAN << 3,
|
||||
BG_WHITE = TEXT_WHITE << 3,
|
||||
|
||||
ATTR_NORMAL_INTEN = 0,
|
||||
ATTR_LOW_INTEN = 1 << 6,
|
||||
ATTR_V_LOW_INTEN = 1 << 7 | ATTR_LOW_INTEN,
|
||||
};
|
||||
|
||||
//--------------------------------------------------
|
||||
// Variables
|
||||
//--------------------------------------------------
|
||||
protected:
|
||||
friend void vsync_callback();
|
||||
|
||||
uint16_t display_width = 320;
|
||||
uint16_t display_height = 180;
|
||||
uint16_t frame_width = 320;
|
||||
uint16_t frame_height = 180;
|
||||
uint8_t frame_bytes_per_pixel = 2;
|
||||
uint8_t h_repeat = 4;
|
||||
uint8_t v_repeat = 4;
|
||||
Mode mode = MODE_RGB565;
|
||||
|
||||
public:
|
||||
DVHSTX();
|
||||
|
||||
//--------------------------------------------------
|
||||
// Methods
|
||||
//--------------------------------------------------
|
||||
public:
|
||||
bool get_single_buffered() { return frame_buffer_display && frame_buffer_display == frame_buffer_back; }
|
||||
bool get_double_buffered() { return frame_buffer_display && frame_buffer_display != frame_buffer_back; }
|
||||
|
||||
template<class T>
|
||||
T *get_back_buffer() { return (T*)(frame_buffer_back); }
|
||||
template<class T>
|
||||
T *get_front_buffer() { return (T*)(frame_buffer_display); }
|
||||
|
||||
uint16_t get_width() const { return frame_width; }
|
||||
uint16_t get_height() const { return frame_height; }
|
||||
|
||||
RGB888* get_palette();
|
||||
|
||||
bool init(uint16_t width, uint16_t height, Mode mode, bool double_buffered, const DVHSTXPinout &pinout);
|
||||
void reset();
|
||||
|
||||
// Wait for vsync and then flip the buffers
|
||||
void flip_blocking();
|
||||
|
||||
// Flip immediately without waiting for vsync
|
||||
void flip_now();
|
||||
|
||||
void wait_for_vsync();
|
||||
|
||||
// flip_async queues a flip to happen next vsync but returns without blocking.
|
||||
// You should call wait_for_flip before doing any more reads or writes, defining sprites, etc.
|
||||
void flip_async();
|
||||
void wait_for_flip();
|
||||
|
||||
// DMA handlers, should not be called externally
|
||||
void gfx_dma_handler();
|
||||
void text_dma_handler();
|
||||
|
||||
void set_cursor(int x, int y) { cursor_x = x; cursor_y = y; }
|
||||
void cursor_off(void) { cursor_y = -1; }
|
||||
|
||||
private:
|
||||
RGB888 palette[PALETTE_SIZE];
|
||||
bool double_buffered;
|
||||
uint8_t* frame_buffer_display;
|
||||
uint8_t* frame_buffer_back;
|
||||
uint32_t* font_cache = nullptr;
|
||||
|
||||
void display_setup_clock();
|
||||
|
||||
// DMA scanline filling
|
||||
uint ch_num = 0;
|
||||
int line_num = -1;
|
||||
|
||||
volatile int v_scanline = 2;
|
||||
volatile bool flip_next;
|
||||
|
||||
bool inited = false;
|
||||
|
||||
uint32_t* line_buffers;
|
||||
const struct dvi_timing* timing_mode;
|
||||
int v_inactive_total;
|
||||
int v_total_active_lines;
|
||||
|
||||
uint h_repeat_shift;
|
||||
uint v_repeat_shift;
|
||||
int line_bytes_per_pixel;
|
||||
|
||||
uint32_t* display_palette = nullptr;
|
||||
|
||||
int cursor_x, cursor_y;
|
||||
};
|
||||
|
||||
//--------------------------------------------------
|
||||
// Variables
|
||||
//--------------------------------------------------
|
||||
protected:
|
||||
friend void vsync_callback();
|
||||
|
||||
uint16_t display_width = 320;
|
||||
uint16_t display_height = 180;
|
||||
uint16_t frame_width = 320;
|
||||
uint16_t frame_height = 180;
|
||||
uint8_t frame_bytes_per_pixel = 2;
|
||||
uint8_t h_repeat = 4;
|
||||
uint8_t v_repeat = 4;
|
||||
Mode mode = MODE_RGB565;
|
||||
|
||||
public:
|
||||
DVHSTX();
|
||||
|
||||
//--------------------------------------------------
|
||||
// Methods
|
||||
//--------------------------------------------------
|
||||
public:
|
||||
bool get_single_buffered() {
|
||||
return frame_buffer_display && frame_buffer_display == frame_buffer_back;
|
||||
}
|
||||
bool get_double_buffered() {
|
||||
return frame_buffer_display && frame_buffer_display != frame_buffer_back;
|
||||
}
|
||||
|
||||
template <class T> T *get_back_buffer() { return (T *)(frame_buffer_back); }
|
||||
template <class T> T *get_front_buffer() {
|
||||
return (T *)(frame_buffer_display);
|
||||
}
|
||||
|
||||
uint16_t get_width() const { return frame_width; }
|
||||
uint16_t get_height() const { return frame_height; }
|
||||
|
||||
RGB888 *get_palette();
|
||||
|
||||
bool init(uint16_t width, uint16_t height, Mode mode, bool double_buffered,
|
||||
const DVHSTXPinout &pinout);
|
||||
void reset();
|
||||
|
||||
// Wait for vsync and then flip the buffers
|
||||
void flip_blocking();
|
||||
|
||||
// Flip immediately without waiting for vsync
|
||||
void flip_now();
|
||||
|
||||
void wait_for_vsync();
|
||||
|
||||
// flip_async queues a flip to happen next vsync but returns without blocking.
|
||||
// You should call wait_for_flip before doing any more reads or writes,
|
||||
// defining sprites, etc.
|
||||
void flip_async();
|
||||
void wait_for_flip();
|
||||
|
||||
// DMA handlers, should not be called externally
|
||||
void gfx_dma_handler();
|
||||
void text_dma_handler();
|
||||
|
||||
void set_cursor(int x, int y) {
|
||||
cursor_x = x;
|
||||
cursor_y = y;
|
||||
}
|
||||
void cursor_off(void) { cursor_y = -1; }
|
||||
|
||||
private:
|
||||
RGB888 palette[PALETTE_SIZE];
|
||||
bool double_buffered;
|
||||
uint8_t *frame_buffer_display;
|
||||
uint8_t *frame_buffer_back;
|
||||
uint32_t *font_cache = nullptr;
|
||||
|
||||
void display_setup_clock();
|
||||
|
||||
// DMA scanline filling
|
||||
uint ch_num = 0;
|
||||
int line_num = -1;
|
||||
|
||||
volatile int v_scanline = 2;
|
||||
volatile bool flip_next;
|
||||
|
||||
bool inited = false;
|
||||
|
||||
uint32_t *line_buffers;
|
||||
const struct dvi_timing *timing_mode;
|
||||
int v_inactive_total;
|
||||
int v_total_active_lines;
|
||||
|
||||
uint h_repeat_shift;
|
||||
uint v_repeat_shift;
|
||||
int line_bytes_per_pixel;
|
||||
|
||||
uint32_t *display_palette = nullptr;
|
||||
|
||||
int cursor_x, cursor_y;
|
||||
};
|
||||
} // namespace pimoroni
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,239 +3,263 @@
|
|||
#include "dvi.hpp"
|
||||
|
||||
// VGA -- we do this mode properly, with a pretty comfortable clk_sys (252 MHz)
|
||||
const struct dvi_timing dvi_timing_640x480p_60hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 16,
|
||||
.h_sync_width = 96,
|
||||
.h_back_porch = 48,
|
||||
.h_active_pixels = 640,
|
||||
const struct dvi_timing dvi_timing_640x480p_60hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 16,
|
||||
.h_sync_width = 96,
|
||||
.h_back_porch = 48,
|
||||
.h_active_pixels = 640,
|
||||
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 10,
|
||||
.v_sync_width = 2,
|
||||
.v_back_porch = 33,
|
||||
.v_active_lines = 480,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 10,
|
||||
.v_sync_width = 2,
|
||||
.v_back_porch = 33,
|
||||
.v_active_lines = 480,
|
||||
|
||||
.bit_clk_khz = 252000};
|
||||
.bit_clk_khz = 252000
|
||||
};
|
||||
|
||||
// SVGA -- completely by-the-book but requires 400 MHz clk_sys
|
||||
const struct dvi_timing dvi_timing_800x600p_60hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 44,
|
||||
.h_sync_width = 128,
|
||||
.h_back_porch = 88,
|
||||
.h_active_pixels = 800,
|
||||
const struct dvi_timing dvi_timing_800x600p_60hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 44,
|
||||
.h_sync_width = 128,
|
||||
.h_back_porch = 88,
|
||||
.h_active_pixels = 800,
|
||||
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 1,
|
||||
.v_sync_width = 4,
|
||||
.v_back_porch = 23,
|
||||
.v_active_lines = 600,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 1,
|
||||
.v_sync_width = 4,
|
||||
.v_back_porch = 23,
|
||||
.v_active_lines = 600,
|
||||
|
||||
.bit_clk_khz = 400000};
|
||||
.bit_clk_khz = 400000
|
||||
};
|
||||
|
||||
// 720x480 - timings from dumping the EDID of my monitor
|
||||
const struct dvi_timing dvi_timing_720x480p_60hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 16,
|
||||
.h_sync_width = 62,
|
||||
.h_back_porch = 60,
|
||||
.h_active_pixels = 720,
|
||||
const struct dvi_timing dvi_timing_720x480p_60hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 16,
|
||||
.h_sync_width = 62,
|
||||
.h_back_porch = 60,
|
||||
.h_active_pixels = 720,
|
||||
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 9,
|
||||
.v_sync_width = 6,
|
||||
.v_back_porch = 30,
|
||||
.v_active_lines = 480,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 9,
|
||||
.v_sync_width = 6,
|
||||
.v_back_porch = 30,
|
||||
.v_active_lines = 480,
|
||||
|
||||
.bit_clk_khz = 270000};
|
||||
.bit_clk_khz = 270000
|
||||
};
|
||||
|
||||
// 720x576@50Hz - CEA timing
|
||||
const struct dvi_timing dvi_timing_720x576p_50hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 12,
|
||||
.h_sync_width = 64,
|
||||
.h_back_porch = 68,
|
||||
.h_active_pixels = 720,
|
||||
const struct dvi_timing dvi_timing_720x576p_50hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 12,
|
||||
.h_sync_width = 64,
|
||||
.h_back_porch = 68,
|
||||
.h_active_pixels = 720,
|
||||
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 5,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 39,
|
||||
.v_active_lines = 576,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 5,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 39,
|
||||
.v_active_lines = 576,
|
||||
|
||||
.bit_clk_khz = 270000};
|
||||
.bit_clk_khz = 270000
|
||||
};
|
||||
|
||||
// 720x400@70Hz - "IBM" timing
|
||||
const struct dvi_timing dvi_timing_720x400p_70hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 18,
|
||||
.h_sync_width = 108,
|
||||
.h_back_porch = 54,
|
||||
.h_active_pixels = 720,
|
||||
const struct dvi_timing dvi_timing_720x400p_70hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 18,
|
||||
.h_sync_width = 108,
|
||||
.h_back_porch = 54,
|
||||
.h_active_pixels = 720,
|
||||
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 13,
|
||||
.v_sync_width = 2,
|
||||
.v_back_porch = 34,
|
||||
.v_active_lines = 400,
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 13,
|
||||
.v_sync_width = 2,
|
||||
.v_back_porch = 34,
|
||||
.v_active_lines = 400,
|
||||
|
||||
.bit_clk_khz = 283200};
|
||||
.bit_clk_khz = 283200
|
||||
};
|
||||
|
||||
// 800x480p 60 Hz (note this doesn't seem to be a CEA mode, I just used the
|
||||
// output of `cvt 800 480 60`), 295 MHz bit clock
|
||||
const struct dvi_timing dvi_timing_800x480p_60hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 24,
|
||||
.h_sync_width = 72,
|
||||
.h_back_porch = 96,
|
||||
.h_active_pixels = 800,
|
||||
const struct dvi_timing dvi_timing_800x480p_60hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 24,
|
||||
.h_sync_width = 72,
|
||||
.h_back_porch = 96,
|
||||
.h_active_pixels = 800,
|
||||
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 10,
|
||||
.v_back_porch = 7,
|
||||
.v_active_lines = 480,
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 10,
|
||||
.v_back_porch = 7,
|
||||
.v_active_lines = 480,
|
||||
|
||||
.bit_clk_khz = 295200};
|
||||
.bit_clk_khz = 295200
|
||||
};
|
||||
|
||||
// 800x450p 60 Hz Similarly not a CEA mode, but is 16:9
|
||||
const struct dvi_timing dvi_timing_800x450p_60hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 24,
|
||||
.h_sync_width = 72,
|
||||
.h_back_porch = 96,
|
||||
.h_active_pixels = 800,
|
||||
const struct dvi_timing dvi_timing_800x450p_60hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 24,
|
||||
.h_sync_width = 72,
|
||||
.h_back_porch = 96,
|
||||
.h_active_pixels = 800,
|
||||
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 10,
|
||||
.v_active_lines = 450,
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 10,
|
||||
.v_active_lines = 450,
|
||||
|
||||
.bit_clk_khz = 278400};
|
||||
.bit_clk_khz = 278400
|
||||
};
|
||||
|
||||
// SVGA reduced blanking (355 MHz bit clock) -- valid CVT mode, less common
|
||||
// than fully-blanked SVGA, but doesn't require such a high system clock
|
||||
const struct dvi_timing dvi_timing_800x600p_reduced_60hz = {
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 48,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 80,
|
||||
.h_active_pixels = 800,
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 48,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 80,
|
||||
.h_active_pixels = 800,
|
||||
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 4,
|
||||
.v_back_porch = 11,
|
||||
.v_active_lines = 600,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 4,
|
||||
.v_back_porch = 11,
|
||||
.v_active_lines = 600,
|
||||
|
||||
.bit_clk_khz = 354000};
|
||||
.bit_clk_khz = 354000
|
||||
};
|
||||
|
||||
// Also known as qHD, bit uncommon, but it's a nice modest-resolution 16:9
|
||||
// aspect mode. Pixel clock 40.75 MHz for full CVT mode (no reduced blanking)
|
||||
const struct dvi_timing dvi_timing_960x540p_60hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 32,
|
||||
.h_sync_width = 96,
|
||||
.h_back_porch = 128,
|
||||
.h_active_pixels = 960,
|
||||
const struct dvi_timing dvi_timing_960x540p_60hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 32,
|
||||
.h_sync_width = 96,
|
||||
.h_back_porch = 128,
|
||||
.h_active_pixels = 960,
|
||||
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 14,
|
||||
.v_active_lines = 540,
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 14,
|
||||
.v_active_lines = 540,
|
||||
|
||||
.bit_clk_khz = 408000};
|
||||
.bit_clk_khz = 408000
|
||||
};
|
||||
|
||||
// Also known as qHD, bit uncommon, but it's a nice modest-resolution 16:9
|
||||
// aspect mode. Pixel clock 33.5 MHz for 50Hz CVT mode (no reduced blanking)
|
||||
const struct dvi_timing dvi_timing_960x540p_50hz = {.h_sync_polarity = false,
|
||||
.h_front_porch = 24,
|
||||
.h_sync_width = 96,
|
||||
.h_back_porch = 120,
|
||||
.h_active_pixels = 960,
|
||||
const struct dvi_timing dvi_timing_960x540p_50hz = {
|
||||
.h_sync_polarity = false,
|
||||
.h_front_porch = 24,
|
||||
.h_sync_width = 96,
|
||||
.h_back_porch = 120,
|
||||
.h_active_pixels = 960,
|
||||
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 11,
|
||||
.v_active_lines = 540,
|
||||
.v_sync_polarity = true,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 11,
|
||||
.v_active_lines = 540,
|
||||
|
||||
.bit_clk_khz = 336000};
|
||||
.bit_clk_khz = 336000
|
||||
};
|
||||
|
||||
// 1024x768, CVT-RB
|
||||
const struct dvi_timing dvi_timing_1024x768_rb_60hz = {.h_sync_polarity = true,
|
||||
.h_front_porch = 48,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 80,
|
||||
.h_active_pixels = 1024,
|
||||
const struct dvi_timing dvi_timing_1024x768_rb_60hz = {
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 48,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 80,
|
||||
.h_active_pixels = 1024,
|
||||
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 4,
|
||||
.v_back_porch = 15,
|
||||
.v_active_lines = 768,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 4,
|
||||
.v_back_porch = 15,
|
||||
.v_active_lines = 768,
|
||||
|
||||
.bit_clk_khz = 560000};
|
||||
.bit_clk_khz = 560000
|
||||
};
|
||||
|
||||
// 720p50, this is a standard HD mode, the CVT-RB variant
|
||||
// should be widely supported
|
||||
const struct dvi_timing dvi_timing_1280x720p_rb_50hz = {.h_sync_polarity = true,
|
||||
.h_front_porch = 48,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 80,
|
||||
.h_active_pixels = 1280,
|
||||
const struct dvi_timing dvi_timing_1280x720p_rb_50hz = {
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 48,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 80,
|
||||
.h_active_pixels = 1280,
|
||||
|
||||
.v_sync_polarity =
|
||||
false,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 9,
|
||||
.v_active_lines = 720,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 9,
|
||||
.v_active_lines = 720,
|
||||
|
||||
.bit_clk_khz = 528000};
|
||||
.bit_clk_khz = 528000
|
||||
};
|
||||
|
||||
// 720p60, this is the CVT-RB variant, again should be widely supported
|
||||
const struct dvi_timing dvi_timing_1280x720p_rb_60hz = {.h_sync_polarity = true,
|
||||
.h_front_porch = 48,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 80,
|
||||
.h_active_pixels = 1280,
|
||||
const struct dvi_timing dvi_timing_1280x720p_rb_60hz = {
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 48,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 80,
|
||||
.h_active_pixels = 1280,
|
||||
|
||||
.v_sync_polarity =
|
||||
false,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 13,
|
||||
.v_active_lines = 720,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 3,
|
||||
.v_sync_width = 5,
|
||||
.v_back_porch = 13,
|
||||
.v_active_lines = 720,
|
||||
|
||||
.bit_clk_khz = 640000};
|
||||
.bit_clk_khz = 640000
|
||||
};
|
||||
|
||||
// 1080p30 - not a normal mode but seems to work on a wide variety of hardware
|
||||
// Strictly speaking RB2 should have a clock speed matching the target frequency
|
||||
// more closely but it seems to work!
|
||||
// Strictly speaking RB2 should have a clock speed matching the target frequency more closely
|
||||
// but it seems to work!
|
||||
const struct dvi_timing dvi_timing_1920x1080p_rb2_30hz = {
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 8,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 40,
|
||||
.h_active_pixels = 1920,
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 8,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 40,
|
||||
.h_active_pixels = 1920,
|
||||
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 7,
|
||||
.v_sync_width = 8,
|
||||
.v_back_porch = 6,
|
||||
.v_active_lines = 1080,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 7,
|
||||
.v_sync_width = 8,
|
||||
.v_back_porch = 6,
|
||||
.v_active_lines = 1080,
|
||||
|
||||
.bit_clk_khz = 660000};
|
||||
.bit_clk_khz = 660000
|
||||
};
|
||||
|
||||
// 1440p24 YOLO - works on my Dell Ultrasharp, that most forgiving of monitors.
|
||||
// May require a little more than 1.3V
|
||||
// 1440p24 YOLO - works on my Dell Ultrasharp, that most forgiving of monitors. May require a little more than 1.3V
|
||||
const struct dvi_timing dvi_timing_2560x1440p_yolo_24hz = {
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 8,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 20,
|
||||
.h_active_pixels = 2560,
|
||||
.h_sync_polarity = true,
|
||||
.h_front_porch = 8,
|
||||
.h_sync_width = 32,
|
||||
.h_back_porch = 20,
|
||||
.h_active_pixels = 2560,
|
||||
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 2,
|
||||
.v_sync_width = 6,
|
||||
.v_back_porch = 2,
|
||||
.v_active_lines = 1440,
|
||||
.v_sync_polarity = false,
|
||||
.v_front_porch = 2,
|
||||
.v_sync_width = 6,
|
||||
.v_back_porch = 2,
|
||||
.v_active_lines = 1440,
|
||||
|
||||
.bit_clk_khz = 912000};
|
||||
.bit_clk_khz = 912000
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#define TMDS_CTRL_10 0x154u
|
||||
#define TMDS_CTRL_11 0x2abu
|
||||
|
||||
#define TMDS_BALANCED_LOW 0x307u
|
||||
#define TMDS_BALANCED_LOW 0x307u
|
||||
#define TMDS_BALANCED_HIGH 0x2f0u
|
||||
|
||||
#define TMDS_BLACK_A 0x100u
|
||||
|
|
@ -18,35 +18,31 @@
|
|||
#define SYNC_V0_H1 (TMDS_CTRL_01 | (TMDS_CTRL_00 << 10) | (TMDS_CTRL_00 << 20))
|
||||
#define SYNC_V1_H0 (TMDS_CTRL_10 | (TMDS_CTRL_00 << 10) | (TMDS_CTRL_00 << 20))
|
||||
#define SYNC_V1_H1 (TMDS_CTRL_11 | (TMDS_CTRL_00 << 10) | (TMDS_CTRL_00 << 20))
|
||||
#define MISSING_PIXEL \
|
||||
(TMDS_BALANCED_LOW | (TMDS_BALANCED_LOW << 10) | (TMDS_BALANCED_HIGH << 20))
|
||||
#define BLACK_PIXEL \
|
||||
(TMDS_BALANCED_LOW | (TMDS_BALANCED_LOW << 10) | (TMDS_BALANCED_LOW << 20))
|
||||
#define BLACK_PIXEL_A \
|
||||
(TMDS_BLACK_A | (TMDS_BLACK_A << 10) | (TMDS_BLACK_A << 20))
|
||||
#define BLACK_PIXEL_B \
|
||||
(TMDS_BLACK_B | (TMDS_BLACK_B << 10) | (TMDS_BLACK_B << 20))
|
||||
#define MISSING_PIXEL (TMDS_BALANCED_LOW | (TMDS_BALANCED_LOW << 10) | (TMDS_BALANCED_HIGH << 20))
|
||||
#define BLACK_PIXEL (TMDS_BALANCED_LOW | (TMDS_BALANCED_LOW << 10) | (TMDS_BALANCED_LOW << 20))
|
||||
#define BLACK_PIXEL_A (TMDS_BLACK_A | (TMDS_BLACK_A << 10) | (TMDS_BLACK_A << 20))
|
||||
#define BLACK_PIXEL_B (TMDS_BLACK_B | (TMDS_BLACK_B << 10) | (TMDS_BLACK_B << 20))
|
||||
|
||||
#define HSTX_CMD_RAW (0x0u << 12)
|
||||
#define HSTX_CMD_RAW_REPEAT (0x1u << 12)
|
||||
#define HSTX_CMD_TMDS (0x2u << 12)
|
||||
#define HSTX_CMD_RAW (0x0u << 12)
|
||||
#define HSTX_CMD_RAW_REPEAT (0x1u << 12)
|
||||
#define HSTX_CMD_TMDS (0x2u << 12)
|
||||
#define HSTX_CMD_TMDS_REPEAT (0x3u << 12)
|
||||
#define HSTX_CMD_NOP (0xfu << 12)
|
||||
#define HSTX_CMD_NOP (0xfu << 12)
|
||||
|
||||
struct dvi_timing {
|
||||
bool h_sync_polarity;
|
||||
int h_front_porch;
|
||||
int h_sync_width;
|
||||
int h_back_porch;
|
||||
int h_active_pixels;
|
||||
bool h_sync_polarity;
|
||||
int h_front_porch;
|
||||
int h_sync_width;
|
||||
int h_back_porch;
|
||||
int h_active_pixels;
|
||||
|
||||
bool v_sync_polarity;
|
||||
int v_front_porch;
|
||||
int v_sync_width;
|
||||
int v_back_porch;
|
||||
int v_active_lines;
|
||||
bool v_sync_polarity;
|
||||
int v_front_porch;
|
||||
int v_sync_width;
|
||||
int v_back_porch;
|
||||
int v_active_lines;
|
||||
|
||||
uint bit_clk_khz;
|
||||
uint bit_clk_khz;
|
||||
};
|
||||
|
||||
extern const struct dvi_timing dvi_timing_640x480p_60hz;
|
||||
|
|
|
|||
|
|
@ -10,31 +10,33 @@
|
|||
#include "pico/types.h"
|
||||
|
||||
typedef struct {
|
||||
uint16_t bitmap_index;
|
||||
uint16_t adv_w;
|
||||
int8_t box_w, box_h, ofs_x, ofs_y;
|
||||
uint16_t bitmap_index;
|
||||
uint16_t adv_w;
|
||||
int8_t box_w, box_h, ofs_x, ofs_y;
|
||||
} __attribute__((packed)) lv_font_fmt_txt_glyph_dsc_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t range_start, range_length, glyph_id_start, list_length;
|
||||
void *unicode_list, *glyph_id_ofs_list;
|
||||
enum { LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY } type;
|
||||
uint16_t range_start, range_length, glyph_id_start, list_length;
|
||||
void *unicode_list, *glyph_id_ofs_list;
|
||||
enum {
|
||||
LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
|
||||
} type;
|
||||
} lv_font_fmt_txt_cmap_t;
|
||||
|
||||
typedef struct {
|
||||
const uint8_t *glyph_bitmap;
|
||||
const lv_font_fmt_txt_glyph_dsc_t *glyph_dsc;
|
||||
const lv_font_fmt_txt_cmap_t *cmaps;
|
||||
uint8_t cmap_num, bpp, kern_scale, kern_classes;
|
||||
void *kern_dsc;
|
||||
const uint8_t *glyph_bitmap;
|
||||
const lv_font_fmt_txt_glyph_dsc_t *glyph_dsc;
|
||||
const lv_font_fmt_txt_cmap_t *cmaps;
|
||||
uint8_t cmap_num, bpp, kern_scale, kern_classes;
|
||||
void *kern_dsc;
|
||||
} lv_font_fmt_txt_dsc_t;
|
||||
|
||||
typedef struct {
|
||||
lv_font_fmt_txt_dsc_t *dsc;
|
||||
uint8_t line_height, base_line;
|
||||
lv_font_fmt_txt_dsc_t *dsc;
|
||||
uint8_t line_height, base_line;
|
||||
} lv_font_t;
|
||||
|
||||
#define FONT_HEIGHT 23
|
||||
extern const lv_font_t intel_one_mono;
|
||||
|
||||
#endif // SOFTWARE_FONT_H
|
||||
#endif //SOFTWARE_FONT_H
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue