Boboter
Loading...
Searching...
No Matches
display.h
Go to the documentation of this file.
1
7
8#pragma once
9
10#include <esp_lcd_panel_ssd1306.h>
11#include "include/log_sources.h"
12
13class Robot;
14
15namespace Device {
16 class Display {
17 private:
18 static constexpr const char* TAG = "Device::Display";
19 static constexpr log_source LOG_SOURCE = LOG_SOURCE_DEVICE_DISPLAY;
20
21 static constexpr uint8_t I2C_ADDRESS = 0x3C;
22 static constexpr uint8_t WIDTH = 128;
23 static constexpr uint8_t HEIGHT = 64;
24 static constexpr uint8_t CHAR_WIDTH = 8;
25 static constexpr uint8_t CHAR_HEIGHT = 8;
26 static constexpr uint8_t MAX_COLUMNS = WIDTH / CHAR_WIDTH;
27 static constexpr uint8_t MAX_ROWS = HEIGHT / CHAR_HEIGHT;
28
29 static constexpr uint8_t font8x8[128][8] = {
30 #include "display_font.inc.h"
31 };
32
33 Robot& robot;
34
35 uint8_t* display_buffer;
36 uint8_t cursor_column;
37 uint8_t cursor_row;
38
39 esp_lcd_panel_handle_t panel_handle;
40 esp_lcd_panel_io_handle_t io_handle;
41
42 public:
43 explicit Display(Robot& robot);
44 ~Display();
45
49 void initialize();
50
54 void shutdown();
55
59 void clear();
60
67 void write_text(const char* text);
68
75 void set_cursor_position(uint8_t column, uint8_t row);
76
81 };
82}
void clear()
Clears the display.
Definition display.cpp:94
~Display()
Definition display.cpp:29
void write_text(const char *text)
Writes text to the display buffer at the current cursor position.
Definition display.cpp:113
void set_cursor_position(uint8_t column, uint8_t row)
Sets the position of the cursor.
Definition display.cpp:162
Display(Robot &robot)
Definition display.cpp:18
void shutdown()
Shuts down the LCD panel and the according I2C device.
Definition display.cpp:67
void write_buffer_to_display()
Writes the display buffer to the display.
Definition display.cpp:185
void initialize()
Configures the LCD panel and all I2C components related to the display.
Definition display.cpp:34
Class containing all the components of the robot.
Definition robot.h:32
log_source
Definition log_sources.h:12
@ LOG_SOURCE_DEVICE_DISPLAY
Definition log_sources.h:21
Definition battery.cpp:14