hardware/display_controller.h¶
I2C OLED status display controller.
This module drives a small SSD1306-compatible OLED display over the Raspberry Pi’s I2C bus. It is intentionally isolated from game logic: callers send high-level status text, and this controller owns the hardware details, text layout, and future scrolling behavior.
Enums
-
struct DisplayMessage¶
- #include <display_controller.h>
-
class DisplayController¶
- #include <display_controller.h>
Public Functions
-
DisplayController(const char *i2cDevice = "/dev/i2c-1", uint8_t i2cAddress = DEFAULT_ADDRESS, int displayWidth = DEFAULT_WIDTH, int displayHeight = DEFAULT_HEIGHT)¶
-
~DisplayController()¶
-
bool init()¶
-
void enableSimulation()¶
-
void shutdown()¶
-
inline bool isReady() const¶
-
inline const uint8_t *getFramebuffer() const¶
-
inline int framebufferSize() const¶
-
bool isPixelSet(int x, int y) const¶
-
bool clear()¶
-
bool showMessage(const DisplayMessage &message)¶
-
bool showStatus(DisplayStatus status, const std::string &detail = "", const std::string &line2 = "", const std::string &line3 = "")¶
-
bool showTestPattern()¶
Private Functions
-
bool writeCommand(uint8_t command)¶
-
bool writeCommands(const uint8_t *commands, int count)¶
-
bool writeData(const uint8_t *data, int count)¶
-
bool flush()¶
-
void clearBuffer()¶
-
void setPixel(int x, int y, bool on = true)¶
-
void drawChar(int x, int y, char c)¶
-
void drawText(int x, int y, const std::string &text)¶
-
std::string fitLine(const std::string &text) const¶
Private Members
-
int fd¶
-
bool ready¶
-
bool simulationMode¶
-
std::string devicePath¶
-
uint8_t address¶
-
int width¶
-
int height¶
-
uint8_t framebuffer[DEFAULT_WIDTH * DEFAULT_HEIGHT / 8]¶
-
DisplayController(const char *i2cDevice = "/dev/i2c-1", uint8_t i2cAddress = DEFAULT_ADDRESS, int displayWidth = DEFAULT_WIDTH, int displayHeight = DEFAULT_HEIGHT)¶