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
451 B

5 years ago
  1. #include <ViewStates.h>
  2. void ViewState::setColor(uint8_t _color)
  3. {
  4. color = _color;
  5. };
  6. void ViewState::renderBinaryClock(uint8_t matrix[121], DS3231 &ds3231)
  7. {
  8. uint8_t h = ds3231.getHours() % 12;
  9. uint8_t mm = ds3231.getMinutes();
  10. for (int b = 0; b < 4; b++)
  11. {
  12. if (bitRead(h, b))
  13. {
  14. matrix[110 + b] = color;
  15. }
  16. }
  17. for (int b = 0; b < 6; b++)
  18. {
  19. if (bitRead(mm, b))
  20. {
  21. matrix[115 + b] = color;
  22. }
  23. }
  24. };