Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions Adafruit_LEDBackpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
} ///< 16-bit var swap
#endif

uint8_t colonValue;

static const PROGMEM uint8_t sevensegfonttable[] = {

0b00000000, // (space)
Expand Down Expand Up @@ -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()); }

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
14 changes: 14 additions & 0 deletions Adafruit_LEDBackpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading