16 #ifndef WIPPERSNAPPER_I2C_DRIVER_OUT_SSD1306_H 17 #define WIPPERSNAPPER_I2C_DRIVER_OUT_SSD1306_H 20 #include <Adafruit_SSD1306.h> 23 #define WS_SSD1306_DEFAULT_WIDTH \ 25 #define WS_SSD1306_DEFAULT_HEIGHT \ 60 _display->ssd1306_command(SSD1306_DISPLAYOFF);
78 _display->setTextColor(SSD1306_WHITE);
100 uint8_t rotation = 0) {
121 _display->setTextColor(SSD1306_WHITE);
129 size_t msg_size = strlen(message);
130 for (
size_t i = 0; i < msg_size && c_idx < msg_size; i++) {
131 if (message[i] ==
'\\' && i + 1 < msg_size &&
132 (message[i + 1] ==
'n' || message[i + 1] ==
'r')) {
134 if (message[i + 1] ==
'r' && i + 3 < msg_size &&
135 message[i + 2] ==
'\\' && message[i + 3] ==
'n') {
137 y_idx += line_height;
140 }
else if (message[i + 1] ==
'n') {
142 y_idx += line_height;
146 }
else if (message[i] == 0xC2 && message[i + 1] == 0xB0) {
166 #endif // WIPPERSNAPPER_I2C_DRIVER_OUT_SSD1306_H Class that provides a driver interface for a SSD1306 OLED Display.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:32
~WipperSnapper_I2C_Driver_Out_Ssd1306()
Destructor for a SSD1306 OLED display.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:56
uint8_t _height
Height of the display in pixels.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:161
WipperSnapper_I2C_Driver_Out_Ssd1306(TwoWire *i2c, uint16_t sensorAddress)
Constructor for a SSD1306 OLED display.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:45
Derived class for I2C output component drivers.
Definition: WipperSnapper_I2C_Driver_Out.h:25
#define WS_SSD1306_DEFAULT_HEIGHT
Default height for a ssd1306 128x64 display.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:25
uint16_t _sensorAddress
The I2C driver's unique I2C address.
Definition: WipperSnapper_I2C_Driver.h:1322
#define WS_SSD1306_DEFAULT_WIDTH
Default width for a ssd1306 128x64 display.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:23
void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size, uint8_t rotation=0)
Configures a SSD1306 OLED display. Must be called before driver begin()
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:99
uint8_t _text_sz
Text size of the display.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:163
uint8_t _width
Width of the display in pixels.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:160
Adafruit_SSD1306 * _display
Pointer to the Adafruit_SSD1306 object.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:158
uint8_t _rotation
Rotation of the display in degrees.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:162
void WriteMessageSSD1306(const char *message)
Writes a message to the SSD1306 display.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:112
TwoWire * _i2c
Pointer to the I2C driver's Wire object.
Definition: WipperSnapper_I2C_Driver.h:1321
bool begin()
Initializes the SSD1306 display and begins I2C.
Definition: WipperSnapper_I2C_Driver_Out_Ssd1306.h:70