diff --git a/Adafruit_LEDBackpack.cpp b/Adafruit_LEDBackpack.cpp index 087fd9c..22c69a3 100644 --- a/Adafruit_LEDBackpack.cpp +++ b/Adafruit_LEDBackpack.cpp @@ -51,6 +51,8 @@ } ///< 16-bit var swap #endif +uint8_t colonValue; + static const PROGMEM uint8_t sevensegfonttable[] = { 0b00000000, // (space) @@ -568,7 +570,7 @@ void Adafruit_BicolorMatrix::drawPixel(int16_t x, int16_t y, uint16_t color) { /******************************* 7 SEGMENT OBJECT */ -Adafruit_7segment::Adafruit_7segment(void) { position = 0; } +Adafruit_7segment::Adafruit_7segment(void) { position = 0; colonValue = 2; } void Adafruit_7segment::print(const String &c) { write(c.c_str(), c.length()); } @@ -687,7 +689,7 @@ void Adafruit_7segment::writeDigitRaw(uint8_t d, uint8_t bitmask) { void Adafruit_7segment::drawColon(bool state) { if (state) - displaybuffer[2] = 0x2; + displaybuffer[2] = colonValue; else displaybuffer[2] = 0; } @@ -812,3 +814,14 @@ void Adafruit_7segment::printError(void) { writeDigitRaw(i, (i == 2 ? 0x00 : 0x40)); } } + + +void Adafruit_7segment::setColon(uint8_t value){ + if(value>127)value = 127; + colonValue = value; +} + + +uint8_t Adafruit_7segment::getColon(void){ + return colonValue; +} diff --git a/Adafruit_LEDBackpack.h b/Adafruit_LEDBackpack.h index 8b5f086..415ef46 100644 --- a/Adafruit_LEDBackpack.h +++ b/Adafruit_LEDBackpack.h @@ -455,6 +455,20 @@ class Adafruit_7segment : public Adafruit_LEDBackpack { @brief Issue colon-on directly to display (bypass buffer). */ void writeColon(void); + + /*! + @brief Set custom value for colon segment. + @param 8 bit value corresponding to the 7 possible segments. + max value 127. + */ + + void setColon(uint8_t value); + + /*! + @brief Returns the current value being used for the colon. + */ + uint8_t getColon(void); + private: uint8_t position; ///< Current print position, 0-3