Compare commits
10 Commits
cb437405ea
...
80f687aff6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80f687aff6 | ||
|
|
00cd075f69 | ||
|
|
6b4cfae6e5 | ||
|
|
1508d99abb | ||
|
|
b779a65eb9 | ||
|
|
7a94b31533 | ||
|
|
e4a7aad4d7 | ||
|
|
5756b7ae7d | ||
|
|
da0b7ec9e2 | ||
|
|
8ba4623718 |
13
CHANGES.txt
13
CHANGES.txt
@@ -1,3 +1,16 @@
|
||||
Version 2.1.3
|
||||
|
||||
- ISSUE #26: Added a define TM1638_COLOR_NONE for clarity when clearing a single LED.
|
||||
|
||||
Version 2.1.2
|
||||
|
||||
- ISSUE #22: Corrected setDisplayDigit repeatedly with the dot set to true;
|
||||
- ISSUE #24: Correction on setDisplayToDecNumber bug (thanks to hbx3485).
|
||||
|
||||
Version 2.1.1
|
||||
|
||||
- ISSUE #21: Problems on clearDisplay and setupDisplay.
|
||||
|
||||
Version 2.1.0
|
||||
|
||||
- ISSUE #20: Support for negative decimal numbers;
|
||||
|
||||
@@ -68,7 +68,7 @@ void TM1638::setDisplayToDecNumberAt(unsigned long number, byte dots, byte start
|
||||
void TM1638::setDisplayToDecNumber(unsigned long number, byte dots, boolean leadingZeros,
|
||||
const byte numberFont[])
|
||||
{
|
||||
setDisplayToDecNumberAt(number, dots, leadingZeros, 0, numberFont);
|
||||
setDisplayToDecNumberAt(number, dots, 0, leadingZeros, numberFont);
|
||||
}
|
||||
|
||||
void TM1638::setDisplayToSignedDecNumber(signed long number, byte dots, boolean leadingZeros,
|
||||
|
||||
1
TM1638.h
1
TM1638.h
@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "TM16XX.h"
|
||||
#include "TM16XXFonts.h"
|
||||
|
||||
#define TM1638_COLOR_NONE 0
|
||||
#define TM1638_COLOR_RED 1
|
||||
#define TM1638_COLOR_GREEN 2
|
||||
|
||||
|
||||
16
TM1640.cpp
16
TM1640.cpp
@@ -35,4 +35,20 @@ TM1640::TM1640(byte dataPin, byte clockPin, boolean activateDisplay, byte intens
|
||||
void TM1640::sendChar(byte pos, byte data, boolean dot)
|
||||
{
|
||||
sendData(pos, data | (dot ? 0b10000000 : 0));
|
||||
|
||||
// necessary for the TM1640
|
||||
digitalWrite(strobePin, LOW);
|
||||
digitalWrite(clockPin, LOW);
|
||||
digitalWrite(clockPin, HIGH);
|
||||
digitalWrite(strobePin, HIGH);
|
||||
}
|
||||
|
||||
void TM1640::clearDisplay()
|
||||
{
|
||||
digitalWrite(strobePin, LOW);
|
||||
send(0xC0);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
send(0x00);
|
||||
}
|
||||
digitalWrite(strobePin, HIGH);
|
||||
}
|
||||
|
||||
2
TM1640.h
2
TM1640.h
@@ -33,6 +33,8 @@ class TM1640 : public TM16XX
|
||||
public:
|
||||
/** Instantiate a tm1640 module specifying the display state, the starting intensity (0-7) data and clock pins. */
|
||||
TM1640(byte dataPin, byte clockPin, boolean activateDisplay = true, byte intensity = 7);
|
||||
/** Clear the display */
|
||||
virtual void clearDisplay();
|
||||
|
||||
protected:
|
||||
virtual void sendChar(byte pos, byte data, boolean dot);
|
||||
|
||||
@@ -54,6 +54,12 @@ TM16XX::TM16XX(byte dataPin, byte clockPin, byte strobePin, byte displays, boole
|
||||
void TM16XX::setupDisplay(boolean active, byte intensity)
|
||||
{
|
||||
sendCommand(0x80 | (active ? 8 : 0) | min(7, intensity));
|
||||
|
||||
// necessary for the TM1640
|
||||
digitalWrite(strobePin, LOW);
|
||||
digitalWrite(clockPin, LOW);
|
||||
digitalWrite(clockPin, HIGH);
|
||||
digitalWrite(strobePin, HIGH);
|
||||
}
|
||||
|
||||
void TM16XX::setDisplayDigit(byte digit, byte pos, boolean dot, const byte numberFont[])
|
||||
|
||||
Reference in New Issue
Block a user