Logic_library
Library for Logic board by RoboticsBrno.
Loading...
Searching...
No Matches
StatusBar.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Platform.hpp"
4#include <SmartLeds.h>
5#include <array>
6#include <mutex>
7
8enum States {
9 A = 0,
14};
15
16using Stavy = States;
17
18class StatusBar {
19 friend class Logic;
20
21private:
22 const char* m_tag = "StatusBar";
23
24 SmartLed m_statusLeds;
25
26 mutable std::mutex m_mutex;
27
28 static constexpr int s_count = 5;
29
30 int m_state;
31 Rgb m_color;
32
33 StatusBar(Rgb color = Rgb(255, 255, 255), int count = 5, int i_channel = 1);
34
35 std::array<Rgb, 5> m_frame;
36public:
37 StatusBar(StatusBar&) = delete;
38 StatusBar(StatusBar&&) = delete;
41
42 ~StatusBar() = default;
43
49 void setState(int state);
50
56 void nastavStav(int stav) { setState(stav); }
57
63 int state() const;
64
70 int stav() const { return state(); }
71
77 void setColor(Rgb color);
78
85
91 Rgb color() const;
92
98 Rgb barva() const { return color(); }
99
105 void show(int intensity = 255);
106
112 void ukaz(int intenzita = 255) { show(intenzita); }
113
117 void clear();
118
122 void vycisti() { clear(); }
123
130 Rgb& at(int x);
131
138 Rgb& pozice(int x) { return at(x); }
139
140 Rgb& operator[](int i_index);
141};
States
Definition: StatusBar.hpp:8
@ B
Definition: StatusBar.hpp:10
@ A
Definition: StatusBar.hpp:9
@ C
Definition: StatusBar.hpp:11
@ D
Definition: StatusBar.hpp:12
@ E
Definition: StatusBar.hpp:13
Definition: Logic.hpp:14
Definition: StatusBar.hpp:18
Rgb & operator[](int i_index)
Definition: StatusBar.cpp:53
StatusBar & operator=(StatusBar &&)=delete
void vycisti()
Vyčistí celý displej.
Definition: StatusBar.hpp:122
Rgb barva() const
Vrátí aktuální barvu stavového řádku.
Definition: StatusBar.hpp:98
void ukaz(int intenzita=255)
Vykreslí aktuální snímek/stav.
Definition: StatusBar.hpp:112
StatusBar(StatusBar &)=delete
void setState(int state)
Set progress.
Definition: StatusBar.cpp:12
~StatusBar()=default
StatusBar(StatusBar &&)=delete
Rgb color() const
Returns current color of status bar.
Definition: StatusBar.cpp:23
void show(int intensity=255)
Show current frame/state.
Definition: StatusBar.cpp:31
Rgb & pozice(int x)
Vrátí pixel na dané pozici.
Definition: StatusBar.hpp:138
void nastavBarvu(Rgb barva)
Nastaví barvu stavové řádky.
Definition: StatusBar.hpp:84
StatusBar & operator=(StatusBar &)=delete
void nastavStav(int stav)
Nastaví stav.
Definition: StatusBar.hpp:56
int stav() const
Vrátí aktuálně nastavený stav.
Definition: StatusBar.hpp:70
Rgb & at(int x)
Return pixel at given position.
Definition: StatusBar.cpp:48
void clear()
Clear the display.
Definition: StatusBar.cpp:43
void setColor(Rgb color)
Set the color of status bar.
Definition: StatusBar.cpp:27
int state() const
Returns current state.
Definition: StatusBar.cpp:19