diff --git a/TM1637TinyDisplay.cpp b/TM1637TinyDisplay.cpp index e34257b..95d5328 100644 --- a/TM1637TinyDisplay.cpp +++ b/TM1637TinyDisplay.cpp @@ -263,6 +263,12 @@ void TM1637TinyDisplay::setSegments(const uint8_t segments[], uint8_t length, ui writeBuffer(); } +void TM1637TinyDisplay::setSegments(uint8_t A, uint8_t pos) +{ + digitsbuf[pos] = A; + writeBuffer(); +} + void TM1637TinyDisplay::clear() { // digits[MAXDIGITS] output array to render diff --git a/TM1637TinyDisplay.h b/TM1637TinyDisplay.h index 7a19c1b..a3f9251 100644 --- a/TM1637TinyDisplay.h +++ b/TM1637TinyDisplay.h @@ -187,6 +187,16 @@ class TM1637TinyDisplay { //! @param length The number of digits to be modified //! @param pos The position from which to start the modification (0 - leftmost, 3 - rightmost) void setSegments(const uint8_t segments[], uint8_t length = MAXDIGITS, uint8_t pos = 0); + + //! Update a single digit segment values + //! + //! This function receives raw segment values as input and displays them. The segment data + //! is a single byte @ref A to update the digit as specified by @ref pos argument + //! with 0 being the leftmost digit. + //! + //! @param A An byte containing the raw segment values + //! @param pos The position from which to start the modification (0 - leftmost, 3 - rightmost) + void setSegments(const uint8_t A, uint8_t pos = 0); //! Clear the display void clear(); diff --git a/TM1637TinyDisplay6.cpp b/TM1637TinyDisplay6.cpp index 7f9772a..7f3aed0 100644 --- a/TM1637TinyDisplay6.cpp +++ b/TM1637TinyDisplay6.cpp @@ -265,6 +265,12 @@ void TM1637TinyDisplay6::setSegments(const uint8_t segments[], uint8_t length, u writeBuffer(); } +void TM1637TinyDisplay6::setSegments(uint8_t A, uint8_t pos) +{ + digitsbuf[pos] = A; + writeBuffer(); +} + void TM1637TinyDisplay6::clear() { // digits[MAXDIGITS] output array to render diff --git a/TM1637TinyDisplay6.h b/TM1637TinyDisplay6.h index 73fc678..1c11b9f 100644 --- a/TM1637TinyDisplay6.h +++ b/TM1637TinyDisplay6.h @@ -188,6 +188,16 @@ class TM1637TinyDisplay6 { //! @param pos The position from which to start the modification (0 - leftmost, 5 - rightmost) void setSegments(const uint8_t segments[], uint8_t length = MAXDIGITS, uint8_t pos = 0); + //! Update a single digit segment values + //! + //! This function receives raw segment values as input and displays them. The segment data + //! is a single byte @ref A to update the digit as specified by @ref pos argument + //! with 0 being the leftmost digit. + //! + //! @param A An byte containing the raw segment values + //! @param pos The position from which to start the modification (0 - leftmost, 3 - rightmost) + void setSegments(const uint8_t A, uint8_t pos = 0); + //! Clear the display void clear();