-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKYSevenSegment.h
57 lines (36 loc) · 1.16 KB
/
KYSevenSegment.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
/*
Title:KYSevenSegment
Written By KYLiN
This is a seven segment lib for Arduino
easy to control seven segment display
Date: 28/8/2022
*/
#ifndef __KY_SEVEN_SEGMENT_H__
#define __KY_SEVEN_SEGMENT_H__
#include <Arduino.h>
class KYSevenSegment {
private:
static const byte _numberHex[];
private: // function
void __displayHex_inv(const byte& value, const bool& dp, const bool& dp_only = false) const;
void __displayHex(const byte& value, const bool& dp, const bool& dp_only = false) const;
void __initPins() const;
public:
KYSevenSegment(uint16_t pins[8], bool inv_mode = false);
KYSevenSegment(int a, int b, int c, int d, int e, int f, int g, int dp, bool inv_mode = false);
~KYSevenSegment();
//set
void setInvMode(const bool& inv_mode);
void setPins(uint16_t pins[8]);
// get
bool getMode() const;
// function
void displayNumber(const uint16_t& id, const bool& dp = false) const;
void displayHex(const byte& value, const bool& dp = false) const;
void onlyControlDP(const bool& dp = false) const;
void clearDisplay() const;
private: // member
uint16_t _pins[8];
bool _inv_mode;
};
#endif