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.

27 lines
617 B

5 years ago
  1. #include <ViewStates.h>
  2. ViewSecondsState::ViewSecondsState(DS3231 &_ds3231, AT24C32 &_at24c32) : ViewTextState(at24c32)
  3. {
  4. ds3231 = _ds3231;
  5. at24c32 = _at24c32;
  6. };
  7. void ViewSecondsState::render(uint8_t matrix[121], ControlStates controlState)
  8. {
  9. uint8_t const seconds = ds3231.getSeconds();
  10. bool const blink = (millis() / CONTROL_BLINK_INTERVAL) % 2 == 0;
  11. length = 0;
  12. if (controlState != ControlStates::TIME_SECONDS || blink)
  13. {
  14. length = 2;
  15. text[0] = (seconds / 10) + 0x30;
  16. text[1] = (seconds % 10) + 0x30;
  17. }
  18. ViewTextState::writeChars(matrix);
  19. renderBinaryClock(matrix, ds3231);
  20. }