comparison 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
comparison
equal deleted inserted replaced
550:af1c3e3abd5f 551:e3237f580ae9
49 float window; /* defines which range of pitch values are used for detection */ 49 float window; /* defines which range of pitch values are used for detection */
50 float center; /* defines the offset from pitch to middle of active sector (avoid center position is close to the calculated borders) */ 50 float center; /* defines the offset from pitch to middle of active sector (avoid center position is close to the calculated borders) */
51 uint8_t count; /* number of sectors used for detection */ 51 uint8_t count; /* number of sectors used for detection */
52 } SSector; 52 } SSector;
53 53
54 typedef struct
55 {
56 float x;
57 float y;
58 float z;
59 } SCoord;
54 60
61 typedef enum
62 {
63 MOTION_HISTORY_ROLL = 0,
64 MOTION_HISTORY_PITCH,
65 MOTION_HISTORY_YAW
66 } MotionHistoryEntry_t;
55 67
68 typedef struct
69 {
70 uint8_t roll;
71 uint8_t pitch;
72 uint8_t yaw;
73 } SDeltaHistory;
56 74
57 void InitMotionDetection(void); 75 void InitMotionDetection(void);
76 void resetMotionDeltaHistory();
77 void evaluateMotionDelta(float roll, float pitch, float yaw);
58 void DefinePitchSectors(float centerAngle, uint8_t numOfSectors); 78 void DefinePitchSectors(float centerAngle, uint8_t numOfSectors);
59 detectionState_t detectPitch(float currentPitch); 79 detectionState_t detectPitch(float currentPitch);
60 detectionState_t detectSectorButtonEvent(float curPitch); 80 detectionState_t detectSectorButtonEvent(float curPitch);
61 detectionState_t detectScrollButtonEvent(float curPitch); 81 detectionState_t detectScrollButtonEvent(float curPitch);
62 82
83 void anglesToCoord(float roll, float pitch, float yaw, SCoord *pCoord);
84 void calibrateViewport(float roll, float pitch, float yaw);
85 float checkViewport(float roll, float pitch, float yaw);
86 uint8_t viewInFocus(void);
87 void resetFocusState(void);
88
63 #endif /* INC_MOTION_H_ */ 89 #endif /* INC_MOTION_H_ */