Make it possible to derive from DVDisplay if you want to do fancy things with the frame header

dv_stick
Mike Bell 2023-06-22 23:17:43 +01:00 zatwierdzone przez Phil Howard
rodzic a6bd626334
commit 3bc215074c
2 zmienionych plików z 17 dodań i 9 usunięć

Wyświetl plik

@ -333,7 +333,7 @@ namespace pimoroni {
read(point_to_address_palette(p), l, data); read(point_to_address_palette(p), l, data);
} }
void DVDisplay::write_header() void DVDisplay::write_header_preamble()
{ {
uint32_t buf[8]; uint32_t buf[8];
uint32_t full_width = width * h_repeat; uint32_t full_width = width * h_repeat;
@ -346,7 +346,13 @@ namespace pimoroni {
buf[6] = 0x00000001; buf[6] = 0x00000001;
ram.write(0, buf, 7 * 4); ram.write(0, buf, 7 * 4);
ram.wait_for_finish_blocking(); ram.wait_for_finish_blocking();
}
void DVDisplay::write_header()
{
write_header_preamble();
uint32_t buf[8];
uint addr = 4 * 7; uint addr = 4 * 7;
uint line_type = 0x80000000u + ((uint)mode << 28); uint line_type = 0x80000000u + ((uint)mode << 28);
printf("Write header, line type %08x\n", line_type); printf("Write header, line type %08x\n", line_type);

Wyświetl plik

@ -28,7 +28,7 @@ namespace pimoroni {
//-------------------------------------------------- //--------------------------------------------------
// Variables // Variables
//-------------------------------------------------- //--------------------------------------------------
private: protected:
// Ram accessed through the APS6404 driver // Ram accessed through the APS6404 driver
APS6404 ram; APS6404 ram;
@ -158,11 +158,18 @@ namespace pimoroni {
// The supplied buffer must be at least 128 bytes long // The supplied buffer must be at least 128 bytes long
void get_edid(uint8_t* edid); void get_edid(uint8_t* edid);
private: protected:
uint8_t palette[PALETTE_SIZE * 3] alignas(4); uint8_t palette[PALETTE_SIZE * 3] alignas(4);
bool rewrite_header = false; bool rewrite_header = false;
static constexpr int PIXEL_BUFFER_LEN_IN_WORDS = 16; virtual void write_palette();
virtual void write_header();
void write_header_preamble();
void i2c_modify_bit(uint8_t reg, uint bit, bool enable);
private:
static constexpr int PIXEL_BUFFER_LEN_IN_WORDS = 32;
uint32_t pixel_buffer[PIXEL_BUFFER_LEN_IN_WORDS]; uint32_t pixel_buffer[PIXEL_BUFFER_LEN_IN_WORDS];
Point pixel_buffer_location; Point pixel_buffer_location;
int32_t pixel_buffer_x; int32_t pixel_buffer_x;
@ -173,11 +180,6 @@ namespace pimoroni {
void read(uint32_t address, size_t len, uint8_t *data); void read(uint32_t address, size_t len, uint8_t *data);
void write(uint32_t address, size_t len, const RGB888 colour); void write(uint32_t address, size_t len, const RGB888 colour);
void write_palette();
void write_header();
void i2c_modify_bit(uint8_t reg, uint bit, bool enable);
uint32_t point_to_address(const Point &p) { uint32_t point_to_address(const Point &p) {
return base_address + ((p.y * (uint32_t)width * 3) + p.x) * 2; return base_address + ((p.y * (uint32_t)width * 3) + p.x) * 2;
} }