kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Ability to read EDID
rodzic
31b480d138
commit
4ed1d61336
|
@ -96,6 +96,10 @@ namespace pimoroni {
|
||||||
return i2c.reg_read_uint8(I2C_ADDR, I2C_REG_GPIO_HI);
|
return i2c.reg_read_uint8(I2C_ADDR, I2C_REG_GPIO_HI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DVDisplay::get_edid(uint8_t* edid) {
|
||||||
|
i2c.read_bytes(I2C_ADDR, I2C_REG_EDID, edid, 128);
|
||||||
|
}
|
||||||
|
|
||||||
void DVDisplay::write(uint32_t address, size_t len, const uint16_t colour)
|
void DVDisplay::write(uint32_t address, size_t len, const uint16_t colour)
|
||||||
{
|
{
|
||||||
uint32_t val = colour | ((uint32_t)colour << 16);
|
uint32_t val = colour | ((uint32_t)colour << 16);
|
||||||
|
@ -132,6 +136,20 @@ namespace pimoroni {
|
||||||
write(pointToAddress(p), l, colour);
|
write(pointToAddress(p), l, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DVDisplay::write_pixel_span(const Point &p, uint l, uint16_t *data)
|
||||||
|
{
|
||||||
|
uint32_t offset = 0;
|
||||||
|
if (((uintptr_t)data & 0x2) != 0) {
|
||||||
|
uint32_t val = *data++;
|
||||||
|
ram.write(pointToAddress(p), &val, 2);
|
||||||
|
--l;
|
||||||
|
offset = 2;
|
||||||
|
}
|
||||||
|
if (l > 0) {
|
||||||
|
ram.write(pointToAddress(p) + offset, (uint32_t*)data, l << 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DVDisplay::read_pixel_span(const Point &p, uint l, uint16_t *data)
|
void DVDisplay::read_pixel_span(const Point &p, uint l, uint16_t *data)
|
||||||
{
|
{
|
||||||
read(pointToAddress(p), l, data);
|
read(pointToAddress(p), l, data);
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace pimoroni {
|
||||||
static constexpr uint I2C_REG_START = 0xF9;
|
static constexpr uint I2C_REG_START = 0xF9;
|
||||||
static constexpr uint I2C_REG_GPIO = 0xC0;
|
static constexpr uint I2C_REG_GPIO = 0xC0;
|
||||||
static constexpr uint I2C_REG_GPIO_HI = 0xC8;
|
static constexpr uint I2C_REG_GPIO_HI = 0xC8;
|
||||||
|
static constexpr uint I2C_REG_EDID = 0xED;
|
||||||
|
|
||||||
static constexpr uint32_t base_address = 0x10000;
|
static constexpr uint32_t base_address = 0x10000;
|
||||||
uint16_t width = 0;
|
uint16_t width = 0;
|
||||||
|
@ -96,6 +97,7 @@ namespace pimoroni {
|
||||||
|
|
||||||
void write_pixel(const Point &p, uint16_t colour) override;
|
void write_pixel(const Point &p, uint16_t colour) override;
|
||||||
void write_pixel_span(const Point &p, uint l, uint16_t colour) override;
|
void write_pixel_span(const Point &p, uint l, uint16_t colour) override;
|
||||||
|
void write_pixel_span(const Point &p, uint l, uint16_t *data);
|
||||||
void read_pixel_span(const Point &p, uint l, uint16_t *data) override;
|
void read_pixel_span(const Point &p, uint l, uint16_t *data) override;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
@ -107,6 +109,9 @@ namespace pimoroni {
|
||||||
bool is_button_b_pressed() { return (get_driver_gpio() & 0x1) != 0x1; }
|
bool is_button_b_pressed() { return (get_driver_gpio() & 0x1) != 0x1; }
|
||||||
bool is_button_c_pressed() { return (get_driver_gpio() & 0x2) != 0x2; }
|
bool is_button_c_pressed() { return (get_driver_gpio() & 0x2) != 0x2; }
|
||||||
|
|
||||||
|
// The supplied buffer must be at least 128 bytes long
|
||||||
|
void get_edid(uint8_t* edid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr int PIXEL_BUFFER_LEN_IN_WORDS = 16;
|
static constexpr int PIXEL_BUFFER_LEN_IN_WORDS = 16;
|
||||||
uint32_t pixel_buffer[PIXEL_BUFFER_LEN_IN_WORDS];
|
uint32_t pixel_buffer[PIXEL_BUFFER_LEN_IN_WORDS];
|
||||||
|
|
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
Ładowanie…
Reference in New Issue