Arduino TKJHAT
Arduino library for Pico HAT extension board
Loading...
Searching...
No Matches
Display.h
1#ifndef TKJHAT_DISPLAY_H
2#define TKJHAT_DISPLAY_H
3
4#include <Arduino.h>
5
27
28
29
30extern "C" { // Including C headers in a C++ file requires extern "C"
31#include "display/ssd1306.h"
32}
33
34class Display {
35
36private:
37 ssd1306_t _disp;
38
39public:
40
45
49 void begin();
50
56 void writeText(const char* text);
57
66 void writeTextPositioned(int16_t x, int16_t y, const char* text, uint8_t scale = 1);
67
68 // Helper functions for drawing primitives
69 void putp(int16_t x, int16_t y);
70 void hspan(int16_t x0, int16_t x1, int16_t y);
71
80 void drawCircle(int16_t x0, int16_t y0, int16_t r, bool fill);
81
89 void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
90
99 void drawSquare(uint32_t x, uint32_t y, uint32_t w, uint32_t h, bool fill);
100
104 void clear();
105
110
114};
115
116#endif
void clear()
Clear the display.
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.
void stopDisplay()
Stop the display (power off).
void drawSquare(uint32_t x, uint32_t y, uint32_t w, uint32_t h, bool fill)
Draw a square.
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
Draw a line between two points.
void drawCircle(int16_t x0, int16_t y0, int16_t r, bool fill)
Draw a circle.
void begin()
Initialize the display.
Display()
Construct a new Display object.