-
Notifications
You must be signed in to change notification settings - Fork 3
/
tasbot.h
65 lines (51 loc) · 1.88 KB
/
tasbot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef TASBOT_EYES_TASBOT_H
#define TASBOT_EYES_TASBOT_H
#include "gif.h"
#include "utils.h"
#define NOSE_RANGE_MIN 9
#define NOSE_RANGE_MAX 18
#define FIELD_WIDTH 8
#define FIELD_HEIGHT 6
#define MAX_BLINKS 4 //How many times does TASBot blink between animations
#define MIN_TIME_BETWEEN_BLINKS 4 //Based on human numbers. We Blink about every 4 to 6 seconds
#define MAX_TIME_BETWEEN_BLINKS 6
#define DEFAULT_HUE_FADE_SPEED 10 //ms
extern int TASBotIndex[8][28];
extern int maxBlinks;
extern int minTimeBetweenBlinks;
extern int maxTimeBetweenBlinks;
extern int repetitions;
extern float playbackSpeed;
extern ws2811_led_t defaultColor;
extern bool playbackSpeedAffectBlinks;
extern bool useGammaCorrection;
extern bool useRandomColors;
extern bool useRandomColorsForAll;
extern bool rainbowMode;
extern int fadeSpeed;
extern int hue; //max 255
extern pthread_t hueThread;
//stack
void fillStack(char* _sourceFolder);
bool addToStack(char* _path);
//animations
void playRandomAnimationFromDirectory(char* _path, bool _useRandomColor, bool _repeatAnimations);
void playAnimationFromFilepath(char* _filePath, bool _useRandomColor, bool _repeatAnimations);
void playAnimation(Animation* _animation, bool _useRandomColor, bool _repeatAnimations);
void showFrame(AnimationFrame* _frame, ws2811_led_t _color);
void freeAnimation(Animation* _animation);
char* getRandomAnimation(char* list[], int _count);
//blink
unsigned int getBlinkDelay();
unsigned int getBlinkAmount();
//led
void setBufferAtIndex(unsigned int _x, unsigned int _y, ws2811_led_t _color);
void setNoseLED(unsigned int _index, GifColorType _color);
//misc
float getLuminance(GifColorType* _color);
void startHueThread();
void* fadeHue(void* vargp);
//Debug
unsigned int ledMatrixTranslation(unsigned int _x, unsigned int _y);
bool numberIsEven(unsigned int _number);
#endif //TASBOT_EYES_TASBOT_H