Files
basic1/display/low_level_display_st7789.h
T

54 lines
1.5 KiB
C++

#ifndef LOW_LEVEL_DISPLAY_ST7789_H
#define LOW_LEVEL_DISPLAY_ST7789_H
#include "low_level_display.h"
#include "st7789.h"
class LowLevelDisplayST7789 : public LowLevelDisplay {
private:
const st7789_config* config;
int width;
int height;
bool initialized;
uint16_t* rgb_buffer; // Persistent buffer for 1-bit to RGB565 conversion
public:
LowLevelDisplayST7789(const st7789_config* cfg, int w, int h);
~LowLevelDisplayST7789() override;
// Core display operations - converts 1-bit to RGB565 internally
bool init() override;
void clear(bool white = true) override;
void draw_pixel(int x, int y, bool white) override;
void draw_buffer(const uint8_t* bit_buffer) override;
void refresh() override;
// Display properties
int get_width() const override { return width; }
int get_height() const override { return height; }
DisplayType get_type() const override { return DISPLAY_TYPE_ST7789; }
bool is_color() const override { return true; }
// Backlight control
void set_backlight(bool on) override;
// Brightness control
void set_brightness(uint8_t brightness) override;
uint8_t get_brightness() const override;
// Orientation control
void set_rotation(uint8_t rotation) override;
// Power saving hooks
void on_idle_2min() override;
void on_idle_10min() override;
void on_user_interaction() override;
private:
uint8_t saved_brightness = 100;
bool is_dimmed = false;
bool is_sleeping = false;
};
#endif // LOW_LEVEL_DISPLAY_ST7789_H