-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefines.h
75 lines (62 loc) · 1.9 KB
/
defines.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
******************************************************************************
* @file defines.h
* @author Paolo Sassi
* @date 4 February 2016
* @brief Application global defines.
******************************************************************************
*/
#ifndef DEFINES_H_
#define DEFINES_H_
/**
* @defgroup app_macros Application Macros
* @{
*/
/**
* @brief Sonic Range Finder related macros
*/
#define ADDRESS 0xE0 /* device address */
#define COMM_REG 0x00 /* command register */
#define GAIN_REG 0x01 /* gain register */
#define RANGE_REG 0x02 /* range register */
#define RES_INCH 0x50 /* ranging results in inches */
#define RES_CM 0x51 /* ranging results in centimeters */
#define RANGE 30 /* 1.33 meters range */
#define MAX_GAIN 0x02 /* Max gain 100 */
#define MAX_REG 35 /* max device register */
/**
* @brief Display macros
*/
#define SCALE 0.15 /* display scale factor */
#define SC_WIDTH 320 /* display width */
#define SC_HEIGHT 240 /* display height */
#define X_OFFSET 30
#define Y_OFFSET 10
#define FONT_SMALL &Font8x8
#define FONT_BIG &Font12x12
/* converts the real coordinate into a screen coordinate */
#define SC_X(x) x + X_OFFSET
#define SC_Y(x) x / SCALE + Y_OFFSET
/* length of the displayed vertical axis */
#define AXIS_LENGHT SC_HEIGHT - Y_OFFSET
/* maximum representable distance */
#define MAX_DIST (AXIS_LENGHT - Y_OFFSET) * SCALE
/* maximum distance between two cut points */
#define CUT_DIST 10
/* CutOff sensibility */
#define CUT_SENSE 3
/**
* @brief Other macros
*/
#define K 0.75 /* round correlation constant */
#define F 0.60 /* samples filtering constant */
#define MAX_POINTS 290 /* max stored samples */
#define MAX_ROUNDS 1 /* max ranging rounds */
/* show the original samples from the range finder */
/* #define NO_FILTER */
/* reverse the order in which the samples are drawn */
#define REVERSE_SAMPLES
/**
* @}
*/
#endif /* DEFINES_H_ */