C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
display_device.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "pico/stdlib.h"
14#include "sw/widget/canvas.h"
15
16#include "FreeRTOS.h"
17#include "task.h"
18#include "queue.h"
19#include "semphr.h"
20
29
32class DisplayDevice
33{
34private:
35 /* data */
36public:
37 DisplayDevice(/* args */);
38 virtual ~DisplayDevice();
39};
40
42class rtos_Widget;
43
54
57class GraphicDisplayDevice : public DisplayDevice
58{
59protected:
60public:
65
69 virtual void check_display_device_compatibility(struct_ConfigGraphicWidget framebuffer_cfg, CanvasFormat canvas_format) = 0;
70
80 virtual void show(Canvas *canvas, const uint8_t anchor_x, const uint8_t anchor_y) = 0;
81
88 GraphicDisplayDevice(size_t screen_width,
89 size_t screen_height);
90
92 virtual ~GraphicDisplayDevice();
93};
94
99class TerminalConsole : public DisplayDevice
100{
101private:
102public:
110 char *text_buffer = nullptr;
111
115 TerminalConsole(size_t number_of_char_width,
116 size_t number_of_char_hieght);
117 virtual ~TerminalConsole();
118
120 virtual void show();
121};
122
125class rtos_DisplayDevice
126{
127private:
128 /* data */
129public:
131 SemaphoreHandle_t display_device_mutex;
132 rtos_DisplayDevice(/* args */);
133 ~rtos_DisplayDevice();
134
137 virtual void show_widget(rtos_Widget *widget_to_show) = 0;
138
140 virtual void clear_device_screen_buffer() = 0;
141};
142
145class rtos_GraphicDisplayDevice : public rtos_DisplayDevice
146{
147private:
148 /* data */
149public:
150 rtos_GraphicDisplayDevice(/* args */);
151 ~rtos_GraphicDisplayDevice();
152
157};
158
160class rtos_TerminalConsole : public rtos_DisplayDevice
161{
162private:
163 /* data */
164public:
171
174 void show_widget(rtos_Widget *widget_to_show);
175
178
182 rtos_TerminalConsole(size_t number_of_char_width,
183 size_t number_of_char_hight);
184 virtual ~rtos_TerminalConsole();
185};
186
189{
190private:
192 SemaphoreHandle_t data_sent; // pour attendre la fin d'utilisation de la resource bus / display
193public:
195 QueueHandle_t graphic_widget_data;
196
205 void send_widget_data(rtos_Widget *widget);
208 void receive_widget_data(struct_WidgetDataToGateKeeper received_widget_data);
209};
CanvasFormat
the format of the canvas
Definition canvas.h:61
The canvas is a virtual memory in which the widget draws.
Definition canvas.h:129
virtual ~GraphicDisplayDevice()
Destroy the Display Device object.
Definition display_device.cpp:21
virtual void show(Canvas *canvas, const uint8_t anchor_x, const uint8_t anchor_y)=0
A pure virtual member function. It transfers the pixel buffer to the a part of display screen buffer ...
size_t TFT_panel_width_in_pixel
the physical width of the screen (in pixel)
Definition display_device.h:62
size_t TFT_panel_height_in_pixel
the physical height of the screen (in pixel)
Definition display_device.h:64
virtual void check_display_device_compatibility(struct_ConfigGraphicWidget framebuffer_cfg, CanvasFormat canvas_format)=0
A pure virtual member function. Each device must implement this method and check the compatibility of...
GraphicDisplayDevice(size_t screen_width, size_t screen_height)
Construct a new Display Device object.
Definition display_device.cpp:14
virtual void show()
the method that actually print the content of text_buffer on the console
Definition display_device.cpp:39
TerminalConsole(size_t number_of_char_width, size_t number_of_char_hieght)
Construct a new Terminal Console object.
Definition display_device.cpp:25
size_t number_of_line
the number of line
Definition display_device.h:106
size_t text_buffer_size
the number of characters
Definition display_device.h:108
size_t number_of_column
the size, in number of character of a line
Definition display_device.h:104
char * text_buffer
the effective character buffer
Definition display_device.h:110
The RTOS display device is the base class for all display devices that are managed by a dedicated dis...
Definition display_device.h:126
virtual void clear_device_screen_buffer()=0
Clear the device screen buffer.
virtual void show_widget(rtos_Widget *widget_to_show)=0
Show the widget on the display device.
SemaphoreHandle_t display_device_mutex
the mutex to protect the display device access
Definition display_device.h:131
The RTOS graphic display device is the base class for all graphic display devices that are managed by...
Definition display_device.h:146
virtual void check_rtos_display_device_compatibility(struct_ConfigGraphicWidget framebuffer_cfg, CanvasFormat canvas_format)=0
Check the compatibility of the framebuffer configuration with the display device physical limitations...
void send_clear_device_command(rtos_GraphicDisplayDevice *device)
Send the clear device command to the display task.
Definition display_device.cpp:107
SemaphoreHandle_t data_sent
Semaphore to signal that data has been sent to the display.
Definition display_device.h:192
void receive_widget_data(struct_WidgetDataToGateKeeper received_widget_data)
Receive the widget data from the display task.
Definition display_device.cpp:141
rtos_GraphicDisplayGateKeeper()
constructor for rtos_GraphicDisplayGateKeeper
Definition display_device.cpp:97
void send_widget_data(rtos_Widget *widget)
Send the widget data to the display task.
Definition display_device.cpp:125
QueueHandle_t graphic_widget_data
Queue to send widget data to the display task.
Definition display_device.h:195
size_t number_of_column
the size, in number of character of a line
Definition display_device.h:166
void clear_device_screen_buffer()
Clear the device screen buffer.
Definition display_device.cpp:77
size_t number_of_line
the number of line
Definition display_device.h:168
void show_widget(rtos_Widget *widget_to_show)
Construct a new rtos_TerminalConsole object.
Definition display_device.cpp:70
rtos_TerminalConsole(size_t number_of_char_width, size_t number_of_char_hight)
Construct a new rtos_TerminalConsole object.
Definition display_device.cpp:85
size_t text_buffer_size
the number of characters
Definition display_device.h:170
RTOS wrapper for Widget class.
Definition rtos_widget.h:31
DisplayCommand
Enumeration of display commands for display task management.
Definition display_device.h:23
@ SHOW_IMAGE
Command to show an image.
Definition display_device.h:27
@ CLEAR_SCREEN
Command to clear the screen.
Definition display_device.h:25
data structure used to configure graphic framebuffer
Definition canvas.h:81
data structure used to queue widget data to send to the display task
Definition display_device.h:46
DisplayCommand command
the command to be executed by the display task
Definition display_device.h:48
rtos_DisplayDevice * display
the display device
Definition display_device.h:50
rtos_Widget * widget
the widget to be displayed
Definition display_device.h:52