-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeLEDMatrix.h
71 lines (50 loc) · 1.47 KB
/
MeLEDMatrix.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef _ME_LED_MATRIX_H_
#define _ME_LED_MATRIX_H_
#include "MePort.h"
#define PointOn 1
#define PointOff 0
#define LED_BUFFER_SIZE 16
#define STRING_DISPLAY_BUFFER_SIZE 20
//Define Data Command Parameters
#define Mode_Address_Auto_Add_1 0x40 //0100 0000 B
#define Mode_Permanent_Address 0x44 //0100 0100 B
//Define Address Command Parameters
#define ADDRESS(addr) (0xC0 | addr)
typedef enum
{
Brightness_0 = 0,
Brightness_1,
Brightness_2,
Brightness_3,
Brightness_4,
Brightness_5,
Brightness_6,
Brightness_7,
Brightness_8
}LED_Matrix_Brightness_TypeDef;
/* Me LED Matrix 8X16 */
class MeLEDMatrix:public MePort
{
public:
MeLEDMatrix();
MeLEDMatrix(uint8_t port);
MeLEDMatrix(uint8_t SCK_Pin, uint8_t DIN_Pin);
void clearScreen();
void setBrightness(uint8_t Bright);
void setColorIndex(bool Color_Number);
void drawBitmap(int8_t x, int8_t y, uint8_t Bitmap_Width, uint8_t *Bitmap);
void drawStr(int16_t X_position, int8_t Y_position, const char *str);
void showClock(uint8_t hour, uint8_t minute, bool = PointOn);
private:
bool b_Color_Index;
bool b_Draw_Str_Flag;
uint8_t u8_Display_Buffer[LED_BUFFER_SIZE];
int16_t i16_Str_Display_X_Position;
int8_t i8_Str_Display_Y_Position;
int16_t i16_Number_of_Character_of_Str;
char i8_Str_Display_Buffer[STRING_DISPLAY_BUFFER_SIZE];
void writeByte(uint8_t data);
void writeBytesToAddress(uint8_t Address, const uint8_t *P_data, uint8_t count_of_data);
void showStr();
};
#endif