-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathScreenBuffer.h
More file actions
37 lines (27 loc) · 771 Bytes
/
ScreenBuffer.h
File metadata and controls
37 lines (27 loc) · 771 Bytes
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
#pragma once
class ScreenBuffer
{
public:
ScreenBuffer(int width, int height);
~ScreenBuffer(void);
static ScreenBuffer* GetInstance();
void SetupRowPins(int dataPin, int latchPin, int clockPin);
void SetupColumnPins(int dataPin, int latchPin, int clockPin);
int GetWidth();
int GetHeight();
void Write(int x, int y, int value);
void ClearBuffer();
void Sync();
void SyncNext();
void SyncRow(int row);
private:
void ShiftZeros(int data, int latch, int clock, int numshifts);
void ShiftSingle(int data, int latch, int clock, int value);
private:
static ScreenBuffer* _instance;
int _width, _height, _size;
unsigned long* _buffer;
int _currentRow;
int _rowDataPin, _rowLatchPin, _rowClockPin;
int _colDataPin, _colLatchPin, _colClockPin;
};