Control Surface  1.1.1
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:
15  SSD1306_DisplayInterface(Adafruit_SSD1306 &display) : disp(display) {}
16 
17  public:
18  void clear() override { disp.clearDisplay(); }
19  void drawBackground() override = 0;
20  void display() override { disp.display(); }
21 
22  void drawPixel(int16_t x, int16_t y, uint16_t color) override {
23  disp.drawPixel(x, y, color);
24  }
25 
26  void setTextColor(uint16_t color) override { disp.setTextColor(color); }
27  void setTextSize(uint8_t size) override { disp.setTextSize(size); }
28  void setCursor(int16_t x, int16_t y) override { disp.setCursor(x, y); }
29 
30  size_t write(uint8_t c) override { return disp.write(c); }
31 
32  void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
33  uint16_t color) override {
34  disp.drawLine(x0, y0, x1, y1, color);
35  }
36  void drawFastVLine(int16_t x, int16_t y, int16_t h,
37  uint16_t color) override {
38  disp.drawFastVLine(x, y, h, color);
39  }
40  void drawFastHLine(int16_t x, int16_t y, int16_t w,
41  uint16_t color) override {
42  disp.drawFastHLine(x, y, w, color);
43  }
44 
45  void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
46  int16_t h, uint16_t color) override {
47  disp.drawXBitmap(x, y, bitmap, w, h, color);
48  }
49 
50  protected:
51  Adafruit_SSD1306 &disp;
52 };
53 
SSD1306_DisplayInterface::setTextSize
void setTextSize(uint8_t size) override
Set the text size.
Definition: DisplayInterfaceSSD1306.hpp:27
SSD1306_DisplayInterface::disp
Adafruit_SSD1306 & disp
Definition: DisplayInterfaceSSD1306.hpp:51
SSD1306_DisplayInterface::drawBackground
void drawBackground() override=0
Draw a custom background.
SSD1306_DisplayInterface::display
void display() override
Write the frame buffer to the display.
Definition: DisplayInterfaceSSD1306.hpp:20
DisplayInterface
An interface for displays.
Definition: DisplayInterface.hpp:14
SSD1306_DisplayInterface::drawFastHLine
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override
Draw a horizontal line.
Definition: DisplayInterfaceSSD1306.hpp:40
SSD1306_DisplayInterface::write
size_t write(uint8_t c) override
Write a character to the display.
Definition: DisplayInterfaceSSD1306.hpp:30
SSD1306_DisplayInterface::drawXBitmap
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.
Definition: DisplayInterfaceSSD1306.hpp:45
SSD1306_DisplayInterface::drawFastVLine
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override
Draw a vertical line.
Definition: DisplayInterfaceSSD1306.hpp:36
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
DisplayInterface.hpp
SSD1306_DisplayInterface::setCursor
void setCursor(int16_t x, int16_t y) override
Set the cursor position.
Definition: DisplayInterfaceSSD1306.hpp:28
SSD1306_DisplayInterface
This class creates a mapping between the Adafruit_SSD1306 display driver and the general display inte...
Definition: DisplayInterfaceSSD1306.hpp:13
SSD1306_DisplayInterface::setTextColor
void setTextColor(uint16_t color) override
Set the text color.
Definition: DisplayInterfaceSSD1306.hpp:26
SSD1306_DisplayInterface::SSD1306_DisplayInterface
SSD1306_DisplayInterface(Adafruit_SSD1306 &display)
Definition: DisplayInterfaceSSD1306.hpp:15
SSD1306_DisplayInterface::drawPixel
void drawPixel(int16_t x, int16_t y, uint16_t color) override
Paint a single pixel with the given color.
Definition: DisplayInterfaceSSD1306.hpp:22
SSD1306_DisplayInterface::drawLine
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) override
Draw a line between two points.
Definition: DisplayInterfaceSSD1306.hpp:32
SSD1306_DisplayInterface::clear
void clear() override
Clear the frame buffer or display.
Definition: DisplayInterfaceSSD1306.hpp:18