AceSegment  0.4.0
An adjustable, configurable, and extensible framework for rendering seven segment LED displays.
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 LedDisplay. More...

#include <ClockWriter.h>

Public Types

using hexchar_t = NumberWriter::hexchar_t
 

Public Member Functions

 ClockWriter (LedDisplay &ledDisplay, uint8_t colonDigit=1)
 Constructor. More...
 
LedDisplaydisplay () const
 Get the underlying LedDisplay.
 
void writeCharAt (uint8_t pos, hexchar_t c)
 Write the hexchar_t 'c' at 'pos'.
 
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...
 

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".
 
static const uint8_t kPatternDegree = 0b01100011
 The superscript degree symbol for temperature.
 

Detailed Description

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

A few other characters are supported.

Definition at line 38 of file ClockWriter.h.

Constructor & Destructor Documentation

◆ ClockWriter()

ace_segment::ClockWriter::ClockWriter ( LedDisplay ledDisplay,
uint8_t  colonDigit = 1 
)
inlineexplicit

Constructor.

Parameters
ledDisplayinstance of LedDisplay
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 66 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 89 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 139 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 103 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 117 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 128 of file ClockWriter.h.


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