kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Galactic Unicorn: Add support for P4 and P8 pen modes.
rodzic
ad5e4cc10e
commit
5f3f14e5ce
|
@ -576,6 +576,25 @@ namespace pimoroni {
|
|||
set_pixel(x, y, r, g, b);
|
||||
}
|
||||
}
|
||||
else if(graphics->pen_type == PicoGraphics::PEN_P8 || graphics->pen_type == PicoGraphics::PEN_P4) {
|
||||
int offset = 0;
|
||||
graphics->frame_convert(PicoGraphics::PEN_RGB888, [this, offset](void *data, size_t length) mutable {
|
||||
uint32_t *p = (uint32_t *)data;
|
||||
for(auto i = 0u; i < length / 4; i++) {
|
||||
int x = offset % 53;
|
||||
int y = offset / 53;
|
||||
|
||||
uint32_t col = *p;
|
||||
uint8_t r = (col & 0xff0000) >> 16;
|
||||
uint8_t g = (col & 0x00ff00) >> 8;
|
||||
uint8_t b = (col & 0x0000ff) >> 0;
|
||||
|
||||
set_pixel(x, y, r, g, b);
|
||||
offset++;
|
||||
p++;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue