aboutsummaryrefslogtreecommitdiffstats
path: root/source/sharp.hpp
blob: 3c1d34ee2f2dac32ede86146f1cd7250f871859f (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
40
41
42
43
44
#ifndef SHARP_HPP_
#define SHARP_HPP_

#include "sharp/Adafruit_SharpMem.h"
#include "widget.hpp"

#include <vector>

#define BLACK 0
#define WHITE 1

constexpr int SHARP_WIDTH = 144;
constexpr int SHARP_HEIGHT = 168;

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

	static std::vector<Widget *> widgets;

	static int topY;
	static int scrollVelocity;

public:
	static void begin(void);

	template<class T, typename... Args>
	inline static void addWidget(Args... args) {
		widgets.emplace_back(new T(args...));
	}

	inline static void setScrollVelocity(int vel) {
		scrollVelocity = vel;
	}

	static void sendInput(int ypos);

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

#endif // SHARP_HPP_