diff Discovery/Inc/motion.h @ 551:e3237f580ae9

Added viewport functionality: The viewport shall estimate if the user is looking at the display (in focus) or not. This is done by vector calculation using roll, pitch and yaw angles. The first usecase is to enable the motion detection feature: It is only active if the user is looking at the display. Still in development state => deactivated by compile switch
author Ideenmodellierer
date Sun, 08 Nov 2020 18:43:19 +0100
parents 49a02dea8ae3
children 132e7e3d13a7
line wrap: on
line diff
--- a/Discovery/Inc/motion.h	Sun Nov 08 18:38:53 2020 +0100
+++ b/Discovery/Inc/motion.h	Sun Nov 08 18:43:19 2020 +0100
@@ -51,13 +51,39 @@
     uint8_t count;				/* number of sectors used for detection */
 } SSector;
 
+typedef struct
+{
+	float x;
+	float y;
+	float z;
+} SCoord;
 
+typedef enum
+{
+		MOTION_HISTORY_ROLL = 0,
+		MOTION_HISTORY_PITCH,
+		MOTION_HISTORY_YAW
+} MotionHistoryEntry_t;
 
+typedef struct
+{
+	uint8_t roll;
+	uint8_t pitch;
+	uint8_t yaw;
+} SDeltaHistory;
 
 void InitMotionDetection(void);
+void resetMotionDeltaHistory();
+void evaluateMotionDelta(float roll, float pitch, float yaw);
 void DefinePitchSectors(float centerAngle, uint8_t numOfSectors);
 detectionState_t detectPitch(float currentPitch);
 detectionState_t detectSectorButtonEvent(float curPitch);
 detectionState_t detectScrollButtonEvent(float curPitch);
 
+void anglesToCoord(float roll, float pitch, float yaw, SCoord *pCoord);
+void calibrateViewport(float roll, float pitch, float yaw);
+float checkViewport(float roll, float pitch, float yaw);
+uint8_t viewInFocus(void);
+void resetFocusState(void);
+
 #endif /* INC_MOTION_H_ */