uSevenSegmentLib
https://github.com/Naguissa/uSevenSegmentLib
Loading...
Searching...
No Matches
uSevenSegmentLib.h
Go to the documentation of this file.
1
22#ifndef _uSevenSegmentLib_
26 #define _uSevenSegmentLib_
27
28 #include "Arduino.h"
29 #include "uTimerLib.h"
30
32 public:
33 // Constructors
34 uSevenSegmentLib(const unsigned char, int[8], int *, unsigned int = 40, bool = false);
35
36 void set(long int);
37 long int get();
38 void attachInterrupt();
39
40 void zeroFill(bool);
41
42 static void interrupt(void);
43
45
46 private:
47 void _interrupt(void);
48
49 unsigned char _displays;
50 // Value 200 means digit disabled.
51 // Value 201 means minus sign
52 // Value 1X is X with dot
53 unsigned char *_values;
54 int *_muxes;
55 int _pins[8];
56 int _freq = 40;
57 bool _zeroFill = false;
58
59 // Originally defined as common_cathode. Will XOR if common anode
60
78 unsigned char _mask[10] = {B11111100, B01100000, B11011010, B11110010, B01100110, B10110110, B00111110, B11100000, B11111110, B11100110};
79 unsigned char _dot = B00000001;
80 unsigned char _minus = B00000010;
81 bool _off = B00000000;
82 bool _offB = B00000000;
83 bool _onB = B11111111;
84
85 unsigned char _current = 0;
86 unsigned char _last = 0;
87 };
88#endif
89
Really tiny library to basic 7 segments displays.
Definition uSevenSegmentLib.h:31
void attachInterrupt()
Attach timer interrupt.
Definition uSevenSegmentLib.cpp:149
void zeroFill(bool)
Sets Zerofill on/off.
Definition uSevenSegmentLib.cpp:139
void set(long int)
Sets a number to all displays.
Definition uSevenSegmentLib.cpp:74
long int get()
Gets stored number.
Definition uSevenSegmentLib.cpp:105
static void interrupt(void)
Main public interrupt loop.
Definition uSevenSegmentLib.cpp:164
static uSevenSegmentLib * instance
Static variable assignment to NULL.
Definition uSevenSegmentLib.h:44