-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSplitFlapDisplay.h
82 lines (69 loc) · 2.38 KB
/
SplitFlapDisplay.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) 2020 Stefano Guglielmetti
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#ifndef SPLIT_FLAP_DISPLAY_H
#define SPLIT_FLAP_DISPLAY_H
#include "SplitFlapLetter.h"
class SplitFlapDisplay {
public:
/*!
@brief SplitFlapDisplay constructor
@param lettersNumber the number of the total letters in the display
@param letterPins an array containing the relay pins of the single letters
@param lettehallPinsrPins an array containing the hall sensor pins of the
single letters
@param flapDelay the delay between flaps in milliseconds. 80 has proven to
be a safe value letters. Shorter times may result in flapping
failures
*/
SplitFlapDisplay(int lettersNumber, int letterPins[], int hallPins[], int flapDelay);
/*!
@brief SplitFlapDisplay initialization. Automatically reset the display
upon initialization.
*/
void init();
/*!
@brief Resets the whole display to blank
*/
void reset();
/*!
@brief Refreshes the whole display. Must be called at each Arduino loop.
*/
void refresh();
/*!
@brief Cycles through all the letters ready state, and returns
true if all the letters are ready.
@return Display ready state (boolean).
*/
bool isReady();
/*!
@brief Displays the same character on all the display letters.
@param letter character to display (char).
*/
void print(char letter);
/*!
@brief Displays the provided char array on the display.
Only the first <lettersNumber> will be displayed, all
the remaining characters will be ignored.
@param letter characters to display (char array).
*/
void print(char* letter);
/*!
@brief Definitely could be removed. It's here only for demo purposes, to
manually flap the display and play nice 1 note songs. When no
parameters are provided, the whole display flaps.
*/
void flap();
/*!
@brief As above, but flaps only one letter
@param letter the id of the letter to flap, zero based.
*/
void flap(int letter);
private:
byte lettersNumber; ///< Number of letters in the display
byte flapDelay; ///< Delay between flaps
unsigned long previousMillis; ///< Used by the internal non-blocking timer
SplitFlapLetter letters[64]; ///< Letter objects
};
#endif