aboutsummaryrefslogtreecommitdiffstats
path: root/source/sharp.hpp
blob: a122e5d212fa5319b19ed2f5c11a0203824cae1f (plain)
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
#ifndef SHARP_HPP_
#define SHARP_HPP_

#include "sharp/Adafruit_SharpMem.h"

#include <functional>

using RenderFunc = std::function<void(Adafruit_GFX&)>;
using Display = Adafruit_GFX;

class Sharp {
private:
	static Adafruit_SharpMem display;
	static TaskHandle_t taskHandle;
	static bool holdRendering;

	static RenderFunc currentScreen;

public:
	static void begin(void);

	inline static void pause(void) {
		holdRendering = true;
	}

	inline static void unpause(void) {
		holdRendering = false;
	}

	inline static void setScreen(const RenderFunc& rf) {
		currentScreen = rf;
	}

private:
	static void updateTask(void *);
};

#endif // SHARP_HPP_