AceSegment  0.7.0
A framework for rendering seven segment LED displays using the TM1637, MAX7219, HT16K33, or 74HC595 controller chips
Public Types | Public Member Functions | Static Public Attributes | List of all members
ace_segment::ClockWriter Class Reference

The ClockWriter writes "hh:mm" and "yyyy" to the LedModule. More...

#include <ClockWriter.h>

Public Types

using hexchar_t = NumberWriter::hexchar_t
 

Public Member Functions

 ClockWriter (LedModule &ledModule, uint8_t colonDigit=1)
 Constructor. More...
 
LedModuleledModule ()
 Get the underlying LedModule.
 
void writeCharAt (uint8_t pos, hexchar_t c)
 Write the hexchar_t 'c' at 'pos'.
 
void writeChars2At (uint8_t pos, hexchar_t c0, hexchar_t c1)
 Write the 2 hexchar_t 'c0' and 'c1' at 'pos' and 'pos+1'. More...
 
void writeBcd2At (uint8_t pos, uint8_t bcd)
 Write a 2-digit BCD number at position, which involves just printing the number as a hexadecimal number. More...
 
void writeDec2At (uint8_t pos, uint8_t d)
 Write a 2-digit decimal number at position digit, right justified. More...
 
void writeDec4At (uint8_t pos, uint16_t dd)
 Write the 4 digit decimal number at pos, right justified, padded with a '0' character. More...
 
void writeHourMinute (uint8_t hh, uint8_t mm)
 Write the hour and minutes, and the colon in one-shot, assuming the LED module is a 4-digit clock module. More...
 
void writeColon (bool state=true)
 Write the colon symbol between 'hh' and 'mm'. More...
 
void clear ()
 Clear the entire display.
 
void clearToEnd (uint8_t pos)
 Clear the display from pos to the end.
 

Static Public Attributes

static const hexchar_t kCharSpace = NumberWriter::kCharSpace
 Blank digit.
 
static const hexchar_t kCharMinus = NumberWriter::kCharMinus
 A minus ("-") sign.
 
static const uint8_t kPatternA = 0b01110111
 The "A" character for "AM".
 
static const uint8_t kPatternP = 0b01110011
 The "P" character for "PM".
 

Detailed Description

The ClockWriter writes "hh:mm" and "yyyy" to the LedModule.

A few other characters are supported.

Definition at line 37 of file ClockWriter.h.

Constructor & Destructor Documentation

◆ ClockWriter()

ace_segment::ClockWriter::ClockWriter ( LedModule ledModule,
uint8_t  colonDigit = 1 
)
inlineexplicit

Constructor.

Parameters
ledModuleinstance of LedModule
colonDigitThe digit which has the colon (":") character, mapped to bit 7 (i.e. 'H' segment). In many 4-digit LED clock display modules, this is digit 1 (counting from the left, 0-based, so the second digit from the left).

Definition at line 62 of file ClockWriter.h.

Member Function Documentation

◆ writeBcd2At()

void ace_segment::ClockWriter::writeBcd2At ( uint8_t  pos,
uint8_t  bcd 
)
inline

Write a 2-digit BCD number at position, which involves just printing the number as a hexadecimal number.

For example, 0x12 is printed as "12", but 0x1A is printed as "1 ".

Definition at line 93 of file ClockWriter.h.

◆ writeChars2At()

void ace_segment::ClockWriter::writeChars2At ( uint8_t  pos,
hexchar_t  c0,
hexchar_t  c1 
)
inline

Write the 2 hexchar_t 'c0' and 'c1' at 'pos' and 'pos+1'.

This is a convenience method because the need to write 2 digits (or 2 spaces) occurs quite frequently when implementing clocks.

Definition at line 83 of file ClockWriter.h.

◆ writeColon()

void ace_segment::ClockWriter::writeColon ( bool  state = true)
inline

Write the colon symbol between 'hh' and 'mm'.

Parameters
stateSet to false to turn off the colon.

Definition at line 141 of file ClockWriter.h.

◆ writeDec2At()

void ace_segment::ClockWriter::writeDec2At ( uint8_t  pos,
uint8_t  d 
)
inline

Write a 2-digit decimal number at position digit, right justified.

If the number is greater than 100, then print " " (2 spaces). Useful for day, hour, minute, seconds.

Definition at line 106 of file ClockWriter.h.

◆ writeDec4At()

void ace_segment::ClockWriter::writeDec4At ( uint8_t  pos,
uint16_t  dd 
)
inline

Write the 4 digit decimal number at pos, right justified, padded with a '0' character.

Useful for year.

Definition at line 119 of file ClockWriter.h.

◆ writeHourMinute()

void ace_segment::ClockWriter::writeHourMinute ( uint8_t  hh,
uint8_t  mm 
)
inline

Write the hour and minutes, and the colon in one-shot, assuming the LED module is a 4-digit clock module.

This is a convenience function.

Definition at line 130 of file ClockWriter.h.


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