-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scroller.h
42 lines (31 loc) · 880 Bytes
/
Scroller.h
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
31
32
33
34
35
36
37
38
39
40
41
42
#include <string>
#include <mutex>
#include <vector>
#include <wiringPi.h>
#ifndef SPI_SCROLLER_H
#define SPI_SCROLLER_H
#define CHANNEL 0
#define ROWS 8
#define MATRIXES 9
struct Matrix {
std::uint8_t rows[ROWS];
char letter;
};
class Scroller {
std::mutex run_mutex;
bool run;
void doScroll(int times, Matrix *buffer, const std::vector<int> &text);
Matrix scroll(Matrix &matrix, Matrix &prest);
void setupBits(std::vector<int> text, Matrix* matrix);
void display(Matrix *matrix, int len);
void printAll(Matrix *buffer, int len);
void showBits(std::uint8_t x);
uint8_t reverse(std::uint8_t n);
public:
void setupText(int times, const std::vector<int> &str);
void setRun(bool run);
bool isRunning();
void setupLEDMatrix(int channel);
void setSPIValue(uint8_t reg, uint8_t val);
};
#endif //SPI_SCROLLER_H