Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
082d20c562 | ||
|
|
5e2afcdaeb | ||
|
|
bdee0e3872 | ||
|
|
fb4924cc0a | ||
|
|
ca9bc6f3bb |
@@ -1,3 +1,8 @@
|
|||||||
|
Version 2.0.1
|
||||||
|
|
||||||
|
- ISSUE #15: Backwards compatibility with previous Arduino IDE (pure virtual functions were not supported);
|
||||||
|
- ISSUE #18: Corrected problem with setLEDs() caused by changes in the previous version.
|
||||||
|
|
||||||
Version 2.0.0
|
Version 2.0.0
|
||||||
|
|
||||||
- Support for the TM1640;
|
- Support for the TM1640;
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ void TM1638::setLEDs(word leds)
|
|||||||
for (int i = 0; i < displays; i++) {
|
for (int i = 0; i < displays; i++) {
|
||||||
byte color = 0;
|
byte color = 0;
|
||||||
|
|
||||||
if (leds & (1 << i) != 0) {
|
if ((leds & (1 << i)) != 0) {
|
||||||
color |= TM1638_COLOR_RED;
|
color |= TM1638_COLOR_RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leds & (1 << (i + 8)) != 0) {
|
if ((leds & (1 << (i + 8))) != 0) {
|
||||||
color |= TM1638_COLOR_GREEN;
|
color |= TM1638_COLOR_GREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
TM1640.h
4
TM1640.h
@@ -34,10 +34,6 @@ class TM1640 : public TM16XX
|
|||||||
/** Instantiate a tm1640 module specifying the display state, the starting intensity (0-7) data and clock pins. */
|
/** 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);
|
TM1640(byte dataPin, byte clockPin, boolean activateDisplay = true, byte intensity = 7);
|
||||||
|
|
||||||
/** Set the display to a unsigned decimal number (with or without leading zeros) */
|
|
||||||
void setDisplayToDecNumber(unsigned long number, word dots, boolean leadingZeros = true,
|
|
||||||
const byte numberFont[] = NUMBER_FONT);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void sendChar(byte pos, byte data, boolean dot);
|
virtual void sendChar(byte pos, byte data, boolean dot);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -165,3 +165,9 @@ byte TM16XX::receive()
|
|||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(ARDUINO) || ARDUINO < 100
|
||||||
|
// empty implementation instead of pure virtual for older Arduino IDE
|
||||||
|
void TM16XX::sendChar(byte pos, byte data, boolean dot) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
8
TM16XX.h
8
TM16XX.h
@@ -59,7 +59,13 @@ class TM16XX
|
|||||||
const byte font[] = FONT_DEFAULT);
|
const byte font[] = FONT_DEFAULT);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void sendChar(byte pos, byte data, boolean dot) = 0;
|
#if defined(ARDUINO) && ARDUINO >= 100
|
||||||
|
// pure virtual is NOT supported in older Arduino IDE
|
||||||
|
virtual void sendChar(byte pos, byte data, boolean dot) = 0;
|
||||||
|
#else
|
||||||
|
virtual void sendChar(byte pos, byte data, boolean dot);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
virtual void sendCommand(byte led);
|
virtual void sendCommand(byte led);
|
||||||
virtual void sendData(byte add, byte data);
|
virtual void sendData(byte add, byte data);
|
||||||
|
|||||||
Reference in New Issue
Block a user