Skip to content

Commit

Permalink
Add setSegments() OL for single digit updates #18
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Aug 1, 2022
1 parent df28df2 commit 8e3dae8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions TM1637TinyDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions TM1637TinyDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions TM1637TinyDisplay6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions TM1637TinyDisplay6.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 8e3dae8

Please sign in to comment.