arduino based wordclock
https://www.champonthis.de/projects/wordclock
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
617 B
28 lines
617 B
|
|
#include <ViewStates.h>
|
|
|
|
ViewSecondsState::ViewSecondsState(DS3231 &_ds3231, AT24C32 &_at24c32) : ViewTextState(at24c32)
|
|
{
|
|
ds3231 = _ds3231;
|
|
at24c32 = _at24c32;
|
|
};
|
|
|
|
void ViewSecondsState::render(uint8_t matrix[121], ControlStates controlState)
|
|
{
|
|
uint8_t const seconds = ds3231.getSeconds();
|
|
|
|
bool const blink = (millis() / CONTROL_BLINK_INTERVAL) % 2 == 0;
|
|
|
|
length = 0;
|
|
|
|
if (controlState != ControlStates::TIME_SECONDS || blink)
|
|
{
|
|
length = 2;
|
|
text[0] = (seconds / 10) + 0x30;
|
|
text[1] = (seconds % 10) + 0x30;
|
|
}
|
|
|
|
ViewTextState::writeChars(matrix);
|
|
|
|
renderBinaryClock(matrix, ds3231);
|
|
}
|