A class for the SSD1306 OLED display, uses the ssd1306 library for low-level operations.
More...
#include <Display.h>
|
|
void | begin () |
| | Initialize the display.
|
|
void | clear () |
| | Clear the display.
|
|
| Display () |
| | Construct a new Display object.
|
| void | drawCircle (int16_t x0, int16_t y0, int16_t r, bool fill) |
| | Draw a circle.
|
| void | drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1) |
| | Draw a line between two points.
|
| void | drawSquare (uint32_t x, uint32_t y, uint32_t w, uint32_t h, bool fill) |
| | Draw a square.
|
|
void | stopDisplay () |
| | Stop the display (power off).
|
| void | writeText (const char *text) |
| | Write text to the display with a scale of 2 at center (8,24).
|
| void | writeTextPositioned (int16_t x, int16_t y, const char *text, uint8_t scale=1) |
| | Write text to the display with a specified scale and position.
|
A class for the SSD1306 OLED display, uses the ssd1306 library for low-level operations.
Display is connected to the I2C bus using address SSD1306_I2C_ADDRESS (0x3C). Functions are based on TKJHAT C SDK with minimal modifications to fit Arduino style and the class structure.
Default connections:
- Precondition
- The I2C interface must be initialized (use TKJHAT::begin()).
- See also
- SSD1306 datasheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
-
pico-ssd1306 library used: https://github.com/daschr/pico-ssd1306
◆ drawCircle()
| void Display::drawCircle |
( |
int16_t | x0, |
|
|
int16_t | y0, |
|
|
int16_t | r, |
|
|
bool | fill ) |
Draw a circle.
- Parameters
-
| x0 | The x-coordinate of the center |
| y0 | The y-coordinate of the center |
| r | The radius of the circle |
| fill | Whether to fill the circle |
◆ drawLine()
| void Display::drawLine |
( |
int16_t | x0, |
|
|
int16_t | y0, |
|
|
int16_t | x1, |
|
|
int16_t | y1 ) |
Draw a line between two points.
- Parameters
-
| x0 | The x-coordinate of the first point |
| y0 | The y-coordinate of the first point |
| x1 | The x-coordinate of the second point |
| y1 | The y-coordinate of the second point |
◆ drawSquare()
| void Display::drawSquare |
( |
uint32_t | x, |
|
|
uint32_t | y, |
|
|
uint32_t | w, |
|
|
uint32_t | h, |
|
|
bool | fill ) |
Draw a square.
- Parameters
-
| x | The x-coordinate of the top-left corner |
| y | The y-coordinate of the top-left corner |
| w | The width of the square |
| h | The height of the square |
| fill | Whether to fill the square |
◆ writeText()
| void Display::writeText |
( |
const char * | text | ) |
|
Write text to the display with a scale of 2 at center (8,24).
- Parameters
-
◆ writeTextPositioned()
| void Display::writeTextPositioned |
( |
int16_t | x, |
|
|
int16_t | y, |
|
|
const char * | text, |
|
|
uint8_t | scale = 1 ) |
Write text to the display with a specified scale and position.
- Parameters
-
| text | The text to display |
| x | The x-coordinate of the text |
| y | The y-coordinate of the text |
| scale | Optional, change the scale of text (default is 1) |
The documentation for this class was generated from the following file: