Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
TM1637Display Class Reference

GPIO-driven TM1637 segment display. Call setBrightness() before the first update. Buffered brightness is applied on the next setSegments() or number display operation. More...

#include <TM1637Display.hpp>

Public Member Functions

void setBrightness (uint8_t brightness, bool on=true)
 Cache display brightness and enable state.
void setSegments (const uint8_t segments[], uint8_t length=4, uint8_t pos=0)
 Send raw segment bytes to the display.
void showNumberDec (int num, bool leading_zero=false, uint8_t length=4, uint8_t pos=0)
 Display a signed decimal number.
void showNumberDecEx (int num, uint8_t dots=0, bool leading_zero=false, uint8_t length=4, uint8_t pos=0)
 Display a signed decimal number with decimal-point/colon bits.
uint8_t encodeDigit (uint8_t digit)
 Return the seven-segment bitmap for the low nibble of digit (hexadecimal 0-F).
 TM1637Display (uint8_t pinClk, uint8_t pinDIO)
 Bind clock/data pins, configure released inputs, and clear output latches.

Protected Member Functions

void bitDelay ()
void start ()
void stop ()
bool writeByte (uint8_t b)

Detailed Description

GPIO-driven TM1637 segment display. Call setBrightness() before the first update. Buffered brightness is applied on the next setSegments() or number display operation.

Constructor & Destructor Documentation

◆ TM1637Display()

TM1637Display::TM1637Display ( uint8_t pinClk,
uint8_t pinDIO )

Bind clock/data pins, configure released inputs, and clear output latches.

Parameters
pinClkClock GPIO.
pinDIOBidirectional data GPIO.

Member Function Documentation

◆ setBrightness()

void TM1637Display::setBrightness ( uint8_t brightness,
bool on = true )

Cache display brightness and enable state.

Parameters
brightnessBrightness level 0 through 7 (only low three bits are used).
onTrue enables the display; false switches it off on the next update.

◆ setSegments()

void TM1637Display::setSegments ( const uint8_t segments[],
uint8_t length = 4,
uint8_t pos = 0 )

Send raw segment bytes to the display.

Parameters
segmentsSegment bitmap array, one byte per digit.
lengthNumber of bytes to read from segments.
posStarting digit position; caller must keep the range within the display.

◆ showNumberDec()

void TM1637Display::showNumberDec ( int num,
bool leading_zero = false,
uint8_t length = 4,
uint8_t pos = 0 )

Display a signed decimal number.

Parameters
numNumber to format.
leading_zeroPad with zeros instead of blanks.
lengthDigit field width, 1 through 4.
posStarting digit position within the four-digit display.

◆ showNumberDecEx()

void TM1637Display::showNumberDecEx ( int num,
uint8_t dots = 0,
bool leading_zero = false,
uint8_t length = 4,
uint8_t pos = 0 )

Display a signed decimal number with decimal-point/colon bits.

Parameters
numNumber to format.
dotsDot mask; bits 7 through 4 correspond to the four displayed digits.
leading_zeroPad with zeros instead of blanks.
lengthDigit field width, 1 through 4.
posStarting digit position; keep pos + length at most 4.

The documentation for this class was generated from the following file: