Control Surface master
MIDI Control Surface library for Arduino
DisplayInterfaceSSD1306.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Adafruit_SSD1306.h>
5
7
14 protected:
16
17 public:
19 void clear() override { disp.clearDisplay(); }
21 void drawBackground() override = 0;
25 void display() override { disp.display(); }
26
28 void drawPixel(int16_t x, int16_t y, uint16_t color) override {
29 disp.drawPixel(x, y, color);
30 }
31
33 void setTextColor(uint16_t color) override { disp.setTextColor(color); }
35 void setTextSize(uint8_t size) override { disp.setTextSize(size); }
37 void setCursor(int16_t x, int16_t y) override { disp.setCursor(x, y); }
38
46 size_t write(uint8_t c) override { return disp.write(c); }
47
49 void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
50 uint16_t color) override {
51 disp.drawLine(x0, y0, x1, y1, color);
52 }
54 void drawFastVLine(int16_t x, int16_t y, int16_t h,
55 uint16_t color) override {
56 disp.drawFastVLine(x, y, h, color);
57 }
59 void drawFastHLine(int16_t x, int16_t y, int16_t w,
60 uint16_t color) override {
61 disp.drawFastHLine(x, y, w, color);
62 }
63
65 void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
66 int16_t h, uint16_t color) override {
67 disp.drawXBitmap(x, y, bitmap, w, h, color);
68 }
69
70 protected:
71 Adafruit_SSD1306 &disp;
72};
73
#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.