abstracting display, touch and sd
This commit is contained in:
48
display/low_level_display_st7789.h
Normal file
48
display/low_level_display_st7789.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef LOW_LEVEL_DISPLAY_ST7789_H
|
||||
#define LOW_LEVEL_DISPLAY_ST7789_H
|
||||
|
||||
#include "low_level_display.h"
|
||||
|
||||
// ST7789 configuration structure (similar to ST7796)
|
||||
struct st7789_config {
|
||||
void* spi; // SPI instance
|
||||
int gpio_din; // MOSI pin
|
||||
int gpio_clk; // Clock pin
|
||||
int gpio_cs; // Chip select pin
|
||||
int gpio_dc; // Data/Command pin
|
||||
int gpio_rst; // Reset pin
|
||||
int gpio_bl; // Backlight pin
|
||||
};
|
||||
|
||||
class LowLevelDisplayST7789 : public LowLevelDisplay {
|
||||
private:
|
||||
const st7789_config* config;
|
||||
int width;
|
||||
int height;
|
||||
bool initialized;
|
||||
|
||||
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;
|
||||
|
||||
// Orientation control
|
||||
void set_rotation(uint8_t rotation) override;
|
||||
};
|
||||
|
||||
#endif // LOW_LEVEL_DISPLAY_ST7789_H
|
||||
Reference in New Issue
Block a user