Easyuino  1.2.0
SevenSegments.h
1 /*
2 MIT License
3 
4 Copyright (c) 2017 André Pires
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 /*
25 SevenSegments.h
26 */
27 #ifndef _EASYUINO_SEVEN_SEGMENTS_h
28 #define _EASYUINO_SEVEN_SEGMENTS_h
29 
30 #include <string.h>
31 #include "Utilities.h"
32 #include "Device.h"
33 
34 namespace Easyuino {
35 
40  class SevenSegments : public Device {
41 
42  private:
44  uint8_t _clkPin;
46  uint8_t _dataPin;
47 
48  public:
53  SevenSegments(IN uint8_t clkPin, IN uint8_t dataPin);
54 
57 
58  bool begin();
59 
63  bool begin(IN uint8_t brightness);
64 
65  void end();
66 
70  void setBrightness(IN uint8_t brightness);
71 
77  void print(IN uint8_t digit, IN uint8_t position);
78 
83  void print(IN unsigned int number);
84 
89  void print(IN int number);
90 
95  void print(IN const char* string);
96 
97  private:
101  void sendByte(IN uint8_t byte);
102 
104  void start();
105 
107  void stop();
108 
110  void microDelay();
111 
112  };
113 
114 };
115 
116 #endif
void print(IN uint8_t digit, IN uint8_t position)
Print the digit (0-9) to the seven segment display of the position given.
bool begin()
Used to put the device ready to receive requests.
~SevenSegments()
Destructor.
void setBrightness(IN uint8_t brightness)
sets the brightness of the display
SevenSegments(IN uint8_t clkPin, IN uint8_t dataPin)
Constructor.
Definition: Button.h:38
void end()
Used to stop the device API.
General class that provides the common API behaviour for all the devices/sensors. ...
Definition: Device.h:42
SevenSegments API is used to interact with seven segments displays.
Definition: SevenSegments.h:40