-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathArduino_GigaDisplay_GFX.h
More file actions
54 lines (46 loc) · 1.48 KB
/
Arduino_GigaDisplay_GFX.h
File metadata and controls
54 lines (46 loc) · 1.48 KB
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
#ifndef __ARDUINO_GIGADISPLAY_GFX__
#define __ARDUINO_GIGADISPLAY_GFX__
#include "Arduino_H7_Video.h"
#include "Adafruit_GFX.h"
#include "Adafruit_SPITFT.h"
#include "dsi.h"
#include "SDRAM.h"
#include "rtos.h"
class GigaDisplay_GFX : public Adafruit_GFX {
public:
GigaDisplay_GFX();
~GigaDisplay_GFX(void);
void begin();
void drawPixel(int16_t x, int16_t y, uint16_t color);
void fillScreen(uint16_t color);
void byteSwap(void);
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
uint16_t getPixel(int16_t x, int16_t y);
uint16_t *getBuffer(void) {
return buffer;
}
uint16_t *hasBuffer(void) {
if (!buffer) {
begin();
}
return buffer;
}
void startWrite();
void endWrite();
uint16_t color565(uint8_t red, uint8_t green, uint8_t blue) {
return ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | (blue >> 3);
}
protected:
uint16_t getRawPixel(int16_t x, int16_t y);
void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
uint16_t *buffer = nullptr; ///< Raster data: no longer private, allow subclass access
private:
Arduino_H7_Video* display;
void refresh_if_needed();
bool need_refresh = false;
uint32_t last_refresh = 0;
rtos::Thread* _refresh_thd;
};
#endif //__ARDUINO_GIGADISPLAY_GFX__