32 lines
604 B
C++
32 lines
604 B
C++
#ifndef CAROUSEL_H
|
|
#define CAROUSEL_H
|
|
|
|
#include <Arduino.h>
|
|
#include <U8g2lib.h>
|
|
|
|
#include "screens.h"
|
|
|
|
class Carousel {
|
|
public:
|
|
Carousel(Screen *screens, size_t screenCount);
|
|
|
|
void begin(unsigned long now);
|
|
void update(unsigned long now);
|
|
void next(unsigned long now);
|
|
void render(U8X8 &display) const;
|
|
bool consumeDirty();
|
|
|
|
private:
|
|
Screen *screens_;
|
|
size_t screenCount_;
|
|
size_t currentIndex_;
|
|
unsigned long nextAutoAdvanceAt_;
|
|
unsigned long manualModeUntil_;
|
|
bool dirty_;
|
|
|
|
void scheduleNextAdvance(unsigned long now);
|
|
void drawIndicators(U8X8 &display) const;
|
|
};
|
|
|
|
#endif
|