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
|
#ifndef INOVALEDDISPLAY_H
#define INOVALEDDISPLAY_H
#include <Adafruit_GFX.h>
#include "driver/gpio.h"
#include "driver/spi_master.h"
#define NUM_COL 160
#define NUM_ROW 24
#define NUM_SEGMENTS 3
#define ROWS_PER_SEGMENT NUM_ROW / NUM_SEGMENTS
class InovaLedDisplay : public virtual Adafruit_GFX {
public:
InovaLedDisplay(uint8_t r0, uint8_t g0, uint8_t r1, uint8_t g1, uint8_t r2, uint8_t g2, uint8_t clk, uint8_t latchParam, uint8_t oeParam, uint8_t addr0Param, uint8_t addr1Param, uint8_t addr2Param);
void drawPixel(int16_t x, int16_t y, uint16_t c);
void swapBuffer(void);
void runDisplay(void);
void stopDisplay(void);
private:
uint8_t displayBuffer[2][ROWS_PER_SEGMENT][NUM_COL]; // 3 segments of the matrix packed into bytes
spi_device_handle_t spi;
bool run = true;
bool shouldSwapBuffer = false;
uint8_t backBufferIndex = 0;
gpio_num_t latch, oe, addr0, addr1, addr2;
};
#endif
|