comparison Discovery/Inc/motion.h @ 387:0dbb74be972f

Merged in Ideenmodellierer/ostc4/MotionDetection (pull request #34) MotionDetection
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Sun, 24 Nov 2019 15:46:58 +0000
parents 49a02dea8ae3
children e3237f580ae9
comparison
equal deleted inserted replaced
358:c6a084d1433f 387:0dbb74be972f
1 /*
2 * motion.h
3 *
4 * Created on: 20.05.2019
5 * Author: Thorsten Sonntag
6 */
7
8 #ifndef INC_MOTION_H_
9 #define INC_MOTION_H_
10
11
12 /* exported data types */
13 #define CUSTOMER_DEFINED_VIEWS (100u) /* value will cause the function to detect the number of selected views */
14 #define CUSTOMER_KEEP_LAST_SECTORS (200u) /* do not update number of sectors, just define the new center position */
15
16 typedef enum
17 {
18 MOTION_DETECT_OFF = 0,
19 MOTION_DETECT_SECTOR,
20 MOTION_DETECT_MOVE,
21 MOTION_DETECT_SCROLL,
22 MOTION_DETECT_END
23 } MotionDetectMethod_t;
24
25 typedef enum
26 {
27 DETECT_START = 0,
28 DETECT_POS_MOVE,
29 DETECT_MAXIMA,
30 DETECT_FALLBACK,
31 DETECT_POS_PITCH,
32 DETECT_NEG_MOVE,
33 DETECT_MINIMA,
34 DETECT_RISEBACK,
35 DETECT_NEG_PITCH,
36 DETECT_NOTHING
37 } detectionState_t;
38
39 typedef struct
40 {
41 float upperborder; /* current sector is changed if pitch exceeds these borders */
42 float lowerborder;
43
44 uint8_t current; /* number of the current visible sector */
45 uint8_t target; /* used for sector switch => number of the sector which shall be finnaly displayed */
46
47 float offset; /* offset to adjust minimum pitch value used for detection to zero */
48 float size; /* delta of upper and lower boarder defining the sector in degree */
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) */
51 uint8_t count; /* number of sectors used for detection */
52 } SSector;
53
54
55
56
57 void InitMotionDetection(void);
58 void DefinePitchSectors(float centerAngle, uint8_t numOfSectors);
59 detectionState_t detectPitch(float currentPitch);
60 detectionState_t detectSectorButtonEvent(float curPitch);
61 detectionState_t detectScrollButtonEvent(float curPitch);
62
63 #endif /* INC_MOTION_H_ */