35 lines
1021 B
C++
35 lines
1021 B
C++
#include "display.hpp"
|
|
|
|
Display::Display(int dataIn, int clk, int load) : _ledControler{dataIn, clk, load} {
|
|
_ledControler.shutdown(0,false);
|
|
/* Set the brightness to a medium values */
|
|
_ledControler.setIntensity(0,8);
|
|
/* and clear the display */
|
|
_ledControler.clearDisplay(0);
|
|
_ledControler.setDigit(0, 0, 0, false);
|
|
_ledControler.setDigit(0, 1, 0, false);
|
|
}
|
|
|
|
void Display::print_time(int seconds) {
|
|
if (seconds < 60) {
|
|
_ledControler.setDigit(0, 0, seconds % 10, false);
|
|
_ledControler.setDigit(0, 1, seconds / 10, false);
|
|
} else if (seconds < 600) {
|
|
_ledControler.setDigit(0, 0, (seconds / 10) % 6, false);
|
|
_ledControler.setDigit(0, 1, seconds / 60, true);
|
|
} else {
|
|
int minutes = seconds / 60;
|
|
_ledControler.setDigit(0, 0, minutes % 10, true);
|
|
_ledControler.setDigit(0, 1, minutes / 10, false);
|
|
}
|
|
}
|
|
|
|
void Display::chenillard(void) {
|
|
for (size_t i = 0; i < 6; i++) {
|
|
_ledControler.clearDisplay(0);
|
|
_ledControler.setRow(0, 0, 1 << i);
|
|
_ledControler.setRow(0, 1, 1 << i);
|
|
delay(200);
|
|
}
|
|
}
|