RBCX
Library for the RB3204-RBCX board with the ESP32 by RoboticsBrno.
Loading...
Searching...
No Matches
RBCXOled.h
Go to the documentation of this file.
1#pragma once
2
3#include "rbcx.pb.h"
4#include <string>
5
6namespace rb {
7
11class Oled {
12 friend class Manager;
13
14public:
15 typedef enum {
18 } OledType;
19
20 // Enumeration for screen colors
21 typedef enum OledColor {
22 Black = 0, // Black color, no pixel
23 White = 1 // Pixel is set. Color depends on OLED
25
26 typedef enum {
32
33 void init(OledType type, bool rotate = true, bool inverseColor = false);
34 void fill(OledColor color = White);
35 void updateScreen(void);
36 void drawPixel(uint8_t x, uint8_t y, OledColor color = White);
37 void writeString(
38 const char* str, OledFontDef Font, OledColor color = White);
40 const std::string& str, OledFontDef Font, OledColor color = White) {
41 writeString(str, Font, color);
42 }
43 void setCursor(uint8_t x, uint8_t y);
44 void drawLine(
45 uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, OledColor color);
46 void drawArc(uint8_t x, uint8_t y, uint8_t radius, uint16_t start_angle,
47 uint16_t sweep, OledColor color);
48 void drawCircle(uint8_t x, uint8_t y, uint8_t radius, OledColor color);
49 void drawRectangle(
50 uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, OledColor color);
51 inline uint8_t getWidth() { return m_width; }
52 inline uint8_t getHeight() { return m_height; }
53
54private:
55 Oled();
56 Oled(const Oled&) = delete;
57 ~Oled();
58 void sendOledReq(CoprocReq_OledReq oledReq);
59
60 bool m_init;
61 uint32_t m_width;
62 uint32_t m_height;
63
64}; // class Oled
65}; // namespace rb
The main library class for working with the RBCX board. Call the install() method at the start of you...
Definition: RBCXManager.h:61
Helper class for controlling the Oled.
Definition: RBCXOled.h:11
void writeString(const char *str, OledFontDef Font, OledColor color=White)
Definition: RBCXOled.cpp:61
uint8_t getHeight()
Definition: RBCXOled.h:52
void drawCircle(uint8_t x, uint8_t y, uint8_t radius, OledColor color)
Definition: RBCXOled.cpp:110
void drawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, OledColor color)
Definition: RBCXOled.cpp:83
void drawArc(uint8_t x, uint8_t y, uint8_t radius, uint16_t start_angle, uint16_t sweep, OledColor color)
Definition: RBCXOled.cpp:96
void init(OledType type, bool rotate=true, bool inverseColor=false)
Definition: RBCXOled.cpp:14
OledType
Definition: RBCXOled.h:15
@ Oled_128x32
Definition: RBCXOled.h:16
@ Oled_128x64
Definition: RBCXOled.h:17
void writeString(const std::string &str, OledFontDef Font, OledColor color=White)
Definition: RBCXOled.h:39
uint8_t getWidth()
Definition: RBCXOled.h:51
OledFontDef
Definition: RBCXOled.h:26
@ Font_11x18
Definition: RBCXOled.h:29
@ Font_7x10
Definition: RBCXOled.h:28
@ Font_6x8
Definition: RBCXOled.h:27
@ Font_16x26
Definition: RBCXOled.h:30
OledColor
Definition: RBCXOled.h:21
@ White
Definition: RBCXOled.h:23
@ Black
Definition: RBCXOled.h:22
void fill(OledColor color=White)
Definition: RBCXOled.cpp:38
void setCursor(uint8_t x, uint8_t y)
Definition: RBCXOled.cpp:74
void drawPixel(uint8_t x, uint8_t y, OledColor color=White)
Definition: RBCXOled.cpp:51
void drawRectangle(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, OledColor color)
Definition: RBCXOled.cpp:121
void updateScreen(void)
Definition: RBCXOled.cpp:45
Definition: RBCXAngle.cpp:3