wordclock/libraries/States/ViewState.cpp
2019-02-13 19:27:22 +01:00

29 lines
451 B
C++

#include <ViewStates.h>
void ViewState::setColor(uint8_t _color)
{
color = _color;
};
void ViewState::renderBinaryClock(uint8_t matrix[121], DS3231 &ds3231)
{
uint8_t h = ds3231.getHours() % 12;
uint8_t mm = ds3231.getMinutes();
for (int b = 0; b < 4; b++)
{
if (bitRead(h, b))
{
matrix[110 + b] = color;
}
}
for (int b = 0; b < 6; b++)
{
if (bitRead(mm, b))
{
matrix[115 + b] = color;
}
}
};