28 lines
617 B
C++
28 lines
617 B
C++
|
|
#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);
|
|
} |