-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUnicornHat.h
42 lines (31 loc) · 1.05 KB
/
UnicornHat.h
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
#pragma once
#include "ImageDisplay.h"
namespace Gif2UnicornHat {
class Image;
class Animation;
/* Use the rpi_ws2811 library to send images to the UnicornHat. */
class UnicornHat : public ImageDisplay {
typedef unsigned int Dimension;
public: // Construction.
UnicornHat();
~UnicornHat();
private: // Noncopyable / Nonmovable.
UnicornHat(const UnicornHat&) = delete;
UnicornHat& operator=(const UnicornHat&) = delete;
UnicornHat(UnicornHat&&) = delete;
UnicornHat& operator=(UnicornHat&&) = delete;
public: // Dimensions.
static constexpr Dimension width() { return 8; };
static constexpr Dimension height() { return 8; };
public: // Methods.
void setBrightness(double) override;
void setOrientation(int) override;
void showImage(const Image&) override;
void playAnimation(const Animation&,
const volatile std::sig_atomic_t* isAbortRequested = nullptr) override;
private: // Helpers.
Dimension getPixelIndex(Dimension x, Dimension y) const;
private: // Data.
int orientation_;
};
}