This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anton Bielousov
committed
Dec 15, 2017
1 parent
f36e9ab
commit d213ca8
Showing
3 changed files
with
57 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* States Definition | ||
* ===================== | ||
*/ | ||
|
||
// Decisions state | ||
struct DECISION_STATE { | ||
uint16_t timeSincePreviousDecision = 0; | ||
}; | ||
|
||
// Environment state | ||
struct ENVIRONMENT_STATE { | ||
bool isHumanDetected = false; | ||
uint16_t timeWhenHumanArrived = 0; | ||
uint16_t timeWhenHumanDeparted = 0; | ||
}; | ||
|
||
// Eyes state | ||
struct EYES_STATE { | ||
bool isOpen = false; | ||
uint8_t pupilsPosition[2] = {0, 0}; | ||
uint8_t pupilsSize[2] = {2, 2}; | ||
byte* currentFrame; | ||
}; | ||
|
||
// Global state store | ||
struct STATE { | ||
DECISION_STATE Decision = {}; | ||
ENVIRONMENT_STATE Environment = {}; | ||
EYES_STATE Eyes = {}; | ||
}; | ||
|
||
/* | ||
* States Initialization | ||
* ===================== | ||
*/ | ||
STATE State = {}; | ||
|
||
/* | ||
* Public Methods | ||
*/ | ||
|
||
uint16_t getTime() { | ||
return millis() / 1000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters