flipdot/flipcontrol_esp32/include/image.h

77 lines
1.5 KiB
C
Raw Normal View History

#ifndef IMAGE_H
#define IMAGE_H
#include <Arduino.h>
#include "flipdot.h"
2023-02-13 18:05:24 +00:00
#define COLUMNS 75
#define ROWS 16
2023-02-11 16:31:49 +00:00
enum UpdateReturn {
wait,
finished,
nochange,
updating
};
class Image
{
private:
Flipdot flipdot;
//buffer is 16 bit because of 16 Rows
uint16_t frontBuffer[COLUMNS]; //1 is bright dot / set dot. 0 is black / cleared
uint16_t backBuffer[COLUMNS];
bool flag_updating; //when true, display flip is in progress. frontBuffer does not match backBuffer
uint8_t update_counter; //used for keeping track of progress for updating
int countz=0;
unsigned long lastUpdateMillis; //time when last dots where started flipping
unsigned long updateDelay;
2023-02-11 17:51:33 +00:00
uint8_t orderArray[COLUMNS];
void serialPrintInt(uint16_t source);
2023-02-08 20:29:10 +00:00
public:
Image();
void init();
2023-02-11 17:51:33 +00:00
UpdateReturn updateByColumn(bool clearFirst, bool optimizeClear, bool optimizeSet);
uint8_t getW(); //returns Columns
uint8_t getH(); //returns Rows
2023-02-11 17:51:33 +00:00
void resetOrder(bool ascending);
void shuffleOrder(uint8_t iterations);
void setBuffer_solid(bool set);
2023-02-13 18:58:45 +00:00
void setBufferColumn(uint8_t _colnum, uint16_t _rowdata);
2023-02-08 20:29:10 +00:00
void setBuffer_random(uint8_t randomness);
void setBuffer_Image1();
void setBuffer_Image2();
void setBuffer_Image3();
void setBuffer_Image4();
void loop_testDots();
void loop_drawClearTest();
2023-02-08 20:29:10 +00:00
2023-02-11 17:51:33 +00:00
2023-02-08 20:29:10 +00:00
unsigned long updateDuration; //for statistics and debugging. time it took for one update (max)
};
#endif