-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartButtonMonitor.h
More file actions
56 lines (48 loc) · 2.01 KB
/
Copy pathStartButtonMonitor.h
File metadata and controls
56 lines (48 loc) · 2.01 KB
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
#ifndef STARTBUTTONMONITOR_HEADERGUARD
#define STARTBUTTONMONITOR_HEADERGUARD
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include <pins_arduino.h>
#endif
#include "TaskScheduler.h"
#include "PhotoCountSelectMonitor.h"
#include "ColorSelectMonitor.h"
#include "LedFuse.h"
// Continuously monitors the start button. When pressed:
// Disables photoCountMonitor and colorMonitor.
// Tells the ledFuse to start the countdown animation.
// At the end of the countdown, triggers the camera to take the picture.
// Repeats until the desired number of pictures are taken.
// Re-actives photoCountMonitor and colorMonitor.
class StartButtonMonitor
{
public:
StartButtonMonitor(TaskScheduler& scheduler, LedFuse& fuse, PhotoCountSelectMonitor& photoCountMonitor, ColorSelectMonitor& colorMonitor, uint8_t monitorPin, uint8_t triggerPin);
~StartButtonMonitor();
void enable();
void setCountDownTime(uint16_t newBurnTimeMs);
void disable();
static void checkDigitalPin0(void* clientData); //should only be called by the taskScheduler.
static void triggerCamera0(void* clientData); //should only be called by the taskScheduler.
static void reactivate0(void* clientData); //should only be called by the taskScheduler.
private:
// Private functions
void checkDigitalPin();
void triggerCamera();
void reactivate();
// Private variables
TaskScheduler& m_scheduler;
taskToken_t m_currentScheduledTask;
LedFuse& m_ledFuse;
PhotoCountSelectMonitor& m_photoCountSelector;
ColorSelectMonitor& m_colorSelector;
uint16_t m_burnTimeMs;
uint32_t m_ledColor;
uint8_t m_photosToTake;
uint8_t m_photosTaken;
uint8_t m_pinToMonitor;
uint8_t m_triggerPin;
};//end StartButtonMonitor
#endif //STARTBUTTONMONITOR_HEADERGUARD