Added portrait mode (building with the work from hamid-elaosta:portrait)

pull/103/head
David Tillotson 2021-03-06 21:27:40 +00:00 zatwierdzone przez Phil Howard
rodzic baf16fc332
commit 1993d403e5
3 zmienionych plików z 18 dodań i 1 usunięć

Wyświetl plik

@ -58,6 +58,10 @@ namespace pimoroni {
madctl[0] = 0x70;
}
if(width == 135 && height == 240) {
madctl[0] = 0x00;
}
command(reg::MADCTL, 1, madctl); // row/column addressing order - rgb pixel order
command(reg::TEON, 1, "\x00"); // enable frame sync signal if used
command(reg::COLMOD, 1, "\x05"); // 16 bits per pixel
@ -78,6 +82,11 @@ namespace pimoroni {
command(reg::RASET, 4, "\x00\x35\x00\xbb"); // 53 .. 187 (135 rows)
command(reg::CASET, 4, "\x00\x28\x01\x17"); // 40 .. 279 (240 columns)
}
if(width == 135 && height == 240) {
command(reg::CASET, 4, "\x00\x34\x00\xba"); // 52 .. 186 (135 rows)
command(reg::RASET, 4, "\x00\x28\x01\x17"); // 40 .. 279 (240 columns)
}
}
// the dma transfer works but without vsync it's not that useful as you could

Wyświetl plik

@ -17,6 +17,11 @@ namespace pimoroni {
__fb = buf;
}
PicoDisplay::PicoDisplay(uint16_t *buf, int width, int height)
: PicoGraphics(width, height, buf), screen(width, height, buf) {
__fb = buf;
}
void PicoDisplay::init() {
// setup the rgb led for pwm control
pwm_config cfg = pwm_get_default_config();

Wyświetl plik

@ -9,7 +9,9 @@ namespace pimoroni {
public:
static const int WIDTH = 240;
static const int HEIGHT = 135;
static const uint8_t A = 12;
static const int PORTRAIT_WIDTH = 135;
static const int PORTRAIT_HEIGHT = 240;
static const uint8_t A = 12;
static const uint8_t B = 13;
static const uint8_t X = 14;
static const uint8_t Y = 15;
@ -20,6 +22,7 @@ namespace pimoroni {
public:
PicoDisplay(uint16_t *buf);
PicoDisplay(uint16_t *buf, int width, int height);
void init();
void update();