-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathP10_matrix.h
70 lines (51 loc) · 1.8 KB
/
P10_matrix.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
/*********************************************************************
This is a library for Chinese P10 32x16 LED matrix displays
It is based on the 5110 library by Adafruit
Written by Dominic Buchstaller.
BSD license, check license.txt for more information
*********************************************************************/
#ifndef _P10_MATRIX_H
#define _P10_MATRIX_H
// This is how many color levels the display shows - the more the slower the update
#define color_depth 8
#define PATTERN4
//#define PATTERN8
//#define P5_PATTERN16
#include "Adafruit_GFX.h"
#include "Arduino.h"
#include <SPI.h>
class P10_MATRIX : public Adafruit_GFX {
public:
P10_MATRIX(uint8_t LATCH, uint8_t OE, uint8_t A,uint8_t B,uint8_t C);
//Constructor for 32x64 panel (adds 'D' pin):
P10_MATRIX(uint8_t LATCH, uint8_t OE, uint8_t A,uint8_t B,uint8_t C,uint8_t D);
void begin();
void clearDisplay(void);
void display(uint16_t show_time);
void drawPixelRGB565(int16_t x, int16_t y, uint16_t color);
void drawPixel(int16_t x, int16_t y, uint16_t color);
void drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g,uint8_t b);
uint8_t getPixel(int8_t x, int8_t y);
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
void displayTestPattern(uint16_t showtime);
void flushDisplay();
void setRotate(bool rotate);
private:
uint8_t _display_color;
uint8_t _LATCH_PIN;
uint8_t _OE_PIN;
uint8_t _A_PIN;
uint8_t _B_PIN;
uint8_t _C_PIN;
uint8_t _D_PIN;
uint8_t _width;
uint8_t _height;
bool _rotate;
uint16_t _test_pixel_counter;
uint8_t _test_line_counter;
unsigned long _test_last_call;
void fillMatrixBuffer(int16_t x, int16_t y, uint8_t r, uint8_t g,uint8_t b);
// Init code common to both constructors
void init(uint8_t LATCH, uint8_t OE, uint8_t A,uint8_t B,uint8_t C);
};
#endif