Skip to content

Commit

Permalink
Merge pull request #42 from smaryus/remove-clean-from-begin
Browse files Browse the repository at this point in the history
Remove clean and set brightness from begin
  • Loading branch information
jasonacox authored Nov 2, 2024
2 parents a4d07fb + 8b1cc5a commit 848382a
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 9 deletions.
30 changes: 30 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Release Notes for TM1637TinyDisplay

## v1.12.0 - Clear Display Option

* Update `begin()` function to allow parameter control of display clear and full brightness setting. Default behavior if not specified will be `true` which is the behavior with prior version.
* Remove clean and set brightness from begin by @smaryus in https://github.com/jasonacox/TM1637TinyDisplay/pull/42.

```cpp
//! Initialize the display, setting the clock and data pins.
//!
//! This method should be called once (typically in setup()) before calling any other.
//! @note It may be unnecessary depending on your hardware configuration.
void begin();
//! @param clearDisplay - Clear display and set the brightness to maximum value.
void begin(bool clearDisplay=true);

void TM1637TinyDisplay::begin(bool clearDisplay)
{
// Set the pin direction and default value.
// Both pins are set as inputs, allowing the pull-up resistors to pull them up
pinMode(m_pinClk, INPUT);
pinMode(m_pinDIO, INPUT);
digitalWrite(m_pinClk, LOW);
digitalWrite(m_pinDIO, LOW);
if (clearDisplay)
{
clear();
setBrightness(BRIGHT_HIGH);
}
}
```
## v1.11.0 - Enhanced Character Set
* Updated character set by @J-Brinkman in https://github.com/jasonacox/TM1637TinyDisplay/issues/39
Expand Down
9 changes: 6 additions & 3 deletions TM1637TinyDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,19 @@ TM1637TinyDisplay::TM1637TinyDisplay(uint8_t pinClk, uint8_t pinDIO, unsigned in
m_flipDisplay = flip;
}

void TM1637TinyDisplay::begin()
void TM1637TinyDisplay::begin(bool clearDisplay)
{
// Set the pin direction and default value.
// Both pins are set as inputs, allowing the pull-up resistors to pull them up
pinMode(m_pinClk, INPUT);
pinMode(m_pinDIO, INPUT);
digitalWrite(m_pinClk, LOW);
digitalWrite(m_pinDIO, LOW);
clear();
setBrightness(BRIGHT_HIGH);
if (clearDisplay)
{
clear();
setBrightness(BRIGHT_HIGH);
}
}

void TM1637TinyDisplay::flipDisplay(bool flip)
Expand Down
3 changes: 2 additions & 1 deletion TM1637TinyDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class TM1637TinyDisplay {
//!
//! This method should be called once (typically in setup()) before calling any other.
//! @note It may be unnecessary depending on your hardware configuration.
void begin();
//! @param clearDisplay - Clear display and set the brightness to maximum value.
void begin(bool clearDisplay=true);

//! Sets the orientation of the display.
//!
Expand Down
9 changes: 6 additions & 3 deletions TM1637TinyDisplay6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,19 @@ TM1637TinyDisplay6::TM1637TinyDisplay6(uint8_t pinClk, uint8_t pinDIO,
m_flipDisplay = flip;
}

void TM1637TinyDisplay6::begin()
void TM1637TinyDisplay6::begin(bool clearDisplay)
{
// Set the pin direction and default value.
// Both pins are set as inputs, allowing the pull-up resistors to pull them up
pinMode(m_pinClk, INPUT);
pinMode(m_pinDIO, INPUT);
digitalWrite(m_pinClk, LOW);
digitalWrite(m_pinDIO, LOW);
clear();
setBrightness(BRIGHT_HIGH);
if (clearDisplay)
{
clear();
setBrightness(BRIGHT_HIGH);
}
}

void TM1637TinyDisplay6::flipDisplay(bool flip)
Expand Down
3 changes: 2 additions & 1 deletion TM1637TinyDisplay6.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class TM1637TinyDisplay6 {
//!
//! This method should be called once (typically in setup()) before calling any other.
//! @note It may be unnecessary depending on your hardware configuration.
void begin();
//! @param clearDisplay - Clear display and set the brightness to maximum value.
void begin(bool clearDisplay=true);

//! Sets the orientation of the display.
//!
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=TM1637TinyDisplay
version=1.11.0
version=1.12.0
author=Jason Cox <[email protected]>
maintainer=Jason Cox <[email protected]>
sentence=A simple library to display numbers, text and animation on 4 and 6 digit 7-segment TM1637 based display modules. Offers non-blocking animations and scrolling!
Expand Down

0 comments on commit 848382a

Please sign in to comment.