Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
DisplayInterfaceSSD1306.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Adafruit_SSD1306.h>
5
7
15 protected:
17
18 public:
20 void clear() override { disp.clearDisplay(); }
22 void drawBackground() override = 0;
26 void display() override { disp.display(); }
27
29 void drawPixel(int16_t x, int16_t y, uint16_t color) override {
30 disp.drawPixel(x, y, color);
31 }
32
34 void setTextColor(uint16_t color) override { disp.setTextColor(color); }
36 void setTextSize(uint8_t size) override { disp.setTextSize(size); }
38 void setCursor(int16_t x, int16_t y) override { disp.setCursor(x, y); }
39
47 size_t write(uint8_t c) override { return disp.write(c); }
48
50 void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
51 uint16_t color) override {
52 disp.drawLine(x0, y0, x1, y1, color);
53 }
55 void drawFastVLine(int16_t x, int16_t y, int16_t h,
56 uint16_t color) override {
57 disp.drawFastVLine(x, y, h, color);
58 }
60 void drawFastHLine(int16_t x, int16_t y, int16_t w,
61 uint16_t color) override {
62 disp.drawFastHLine(x, y, w, color);
63 }
64
66 void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
67 int16_t h, uint16_t color) override {
68 disp.drawXBitmap(x, y, bitmap, w, h, color);
69 }
70
71 protected:
72 Adafruit_SSD1306 &disp;
73};
74
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
An interface for displays.
This class creates a mapping between the Adafruit_SSD1306 display driver and the general display inte...
size_t write(uint8_t c) override
Write a character to the display.
void display() override
Write the frame buffer to the display.
void drawBackground() override=0
Draw a custom background.
void setTextSize(uint8_t size) override
Set the text size.
void setCursor(int16_t x, int16_t y) override
Set the cursor position.
void setTextColor(uint16_t color) override
Set the text color.
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override
Draw a vertical line.
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) override
Draw a line between two points.
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override
Draw a horizontal line.
void drawPixel(int16_t x, int16_t y, uint16_t color) override
Paint a single pixel with the given color.
void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color) override
Draw a bitmap to the display.
SSD1306_DisplayInterface(Adafruit_SSD1306 &display)
void clear() override
Clear the frame buffer or clear the display.