2021-01-16 12:26:03 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-05-13 12:06:01 +01:00
|
|
|
#include "drivers/st7789/st7789.hpp"
|
|
|
|
#include "libraries/pico_graphics/pico_graphics.hpp"
|
2021-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
namespace pimoroni {
|
|
|
|
|
|
|
|
class PicoDisplay : public PicoGraphics {
|
2021-01-20 15:59:48 +00:00
|
|
|
public:
|
|
|
|
static const int WIDTH = 240;
|
|
|
|
static const int HEIGHT = 135;
|
2021-03-06 21:27:40 +00:00
|
|
|
static const int PORTRAIT_WIDTH = 135;
|
|
|
|
static const int PORTRAIT_HEIGHT = 240;
|
|
|
|
static const uint8_t A = 12;
|
2021-01-20 15:59:48 +00:00
|
|
|
static const uint8_t B = 13;
|
|
|
|
static const uint8_t X = 14;
|
|
|
|
static const uint8_t Y = 15;
|
|
|
|
|
2021-01-20 18:21:53 +00:00
|
|
|
uint16_t *__fb;
|
2021-01-20 15:59:48 +00:00
|
|
|
private:
|
2021-01-16 12:26:03 +00:00
|
|
|
ST7789 screen;
|
|
|
|
|
|
|
|
public:
|
2021-01-20 18:21:53 +00:00
|
|
|
PicoDisplay(uint16_t *buf);
|
2021-03-06 21:27:40 +00:00
|
|
|
PicoDisplay(uint16_t *buf, int width, int height);
|
2021-01-16 12:26:03 +00:00
|
|
|
|
2021-01-20 15:59:48 +00:00
|
|
|
void init();
|
|
|
|
void update();
|
|
|
|
void set_backlight(uint8_t brightness);
|
2021-01-16 12:26:03 +00:00
|
|
|
void set_led(uint8_t r, uint8_t g, uint8_t b);
|
|
|
|
bool is_pressed(uint8_t button);
|
2021-03-06 16:45:38 +00:00
|
|
|
void flip();
|
2021-01-16 12:26:03 +00:00
|
|
|
};
|
|
|
|
|
2021-03-06 16:45:38 +00:00
|
|
|
}
|