-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathultrason.h
72 lines (50 loc) · 1.79 KB
/
ultrason.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
#ifndef __ULTRASON
#define __ULTRASON
void Init_Ultrasons (void);
#define NUMBER_OF_US 3
#define ULTRASON_THRESHOLD 1000 // seuil d'alarme en mm
#define ULTRASON_THRESHOLD_TRIGGER 750 // zone du triger de schmitt
#define PIN_ULTRASON_D _LATC4 // RC4 = connecteur 5V n3
#define TRIS_ULTRASON_D _TRISC4
#define PIN_CN_ULTRASON_D_IE _CN25IE
//#define PULL_UP_ULTRASON_D _CN25PUE
#define ULTRASON_D_NUM_PIN 4
#define PIN_ULTRASON_G _LATC5 // RC5 = connecteur 5V n2
#define TRIS_ULTRASON_G _TRISC5
#define PIN_CN_ULTRASON_G_IE _CN26IE
//#define PULL_UP_ULTRASON_G _CN26PUE
#define ULTRASON_G_NUM_PIN 5
//
#define PIN_ULTRASON_H _LATC3 // RC3 = connecteur 5V n4
#define TRIS_ULTRASON_H _TRISC3
#define PIN_CN_ULTRASON_H_IE _CN28IE
//#define PULL_UP_ULTRASON_H _CN23PUE
#define ULTRASON_H_NUM_PIN 3
#define U_ETAT_OFF 0x00
#define U_ETAT_FOR_SEND1 0x01
#define U_ETAT_SEND1 0x02
#define U_ETAT_WAIT 0x04
//#define U_ETAT_WAIT0 0x08
#define U_ETAT_WAIT0_OVERSHOOT 0x10
#define U_ETAT_WAIT_FOR_RESTART 0x20
#define US1_IS_GAUCHE 1
#define US2_IS_GAUCHE 0
#define US3_IS_GAUCHE 0
#define US1_IS_DROITE 0
#define US2_IS_DROITE 1
#define US3_IS_DROITE 0
#define US1_IS_HAUT 0
#define US2_IS_HAUT 0
#define US3_IS_HAUT 1
#define NB_TOURS 2
#define DISTANCE_MAX 1200
#define DELTA_D_MAX 650 // 800 1200
#define DELTA_D_MIN 20 // 100
#define DIRECTION_MAX 45.0
#define DIRECTION_MIN 0.0 //on travaille sur la valeur absolue
void Init_Ultrasons(void);
void Init_CN(void);
void Start_Stop_Debug_Ultrason(void);
int Get_US_Sector(int US);
void Set_Threshold_US(int limit_mm);
#endif