-
Notifications
You must be signed in to change notification settings - Fork 0
/
GFX.hpp
30 lines (22 loc) · 1.21 KB
/
GFX.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once
#include "SSD1309.hpp"
#include "font.hpp"
#include <stdlib.h>
#include <string>
#define _swap_int(a, b) { int t = a; a = b; b = t; }
class GFX : public SSD1309 {
const uint8_t* font = font_8x5;
uint8_t size = 1;
void swap(int a, int b);
public:
GFX(uint16_t const DevAddr, uint8_t const width, uint8_t const height, i2c_inst_t * i2c, uint8_t resetPin);
void drawChar(int x, int y, char chr, colors color = colors::WHITE);
void drawString(int x, int y, std::string str, colors color = colors::WHITE);
void drawCharArray(int x, int y, char* str, colors color = colors::WHITE);
void drawProgressBar(int x, int y, uint16_t w, uint16_t h, uint8_t progress, colors color = colors::WHITE);
void drawFillRectangle(int x, int y, uint16_t w, uint16_t h, colors color = colors::WHITE);
void drawRectangle(int x, int y, uint16_t w, uint16_t h, colors color = colors::WHITE);
void drawFastHLine(int x_start, int y_start, int w, colors color = colors::WHITE);
void drawFastVLine(int x_start, int y_start, int w, colors color = colors::WHITE);
void writeLine(int x_start, int y_start, int x_end, int y_end, colors color = colors::WHITE);
};