29 lines
438 B
C++
29 lines
438 B
C++
#ifndef CAROUSEL_H
|
|
#define CAROUSEL_H
|
|
|
|
#include <Arduino.h>
|
|
#include <U8g2lib.h>
|
|
|
|
struct Screen
|
|
{
|
|
void (*draw)(U8G2 &u8g2);
|
|
};
|
|
|
|
class Carousel
|
|
{
|
|
public:
|
|
Carousel(Screen *screens, size_t screenCount);
|
|
void draw(U8G2 &u8g2);
|
|
bool consumeDirty();
|
|
void nextScreen();
|
|
void update(unsigned long now);
|
|
|
|
private:
|
|
Screen *screens_;
|
|
size_t screenCount_;
|
|
size_t currentIndex_;
|
|
unsigned long nextUpdate_;
|
|
bool dirty_;
|
|
};
|
|
|
|
#endif |