Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
alt_srf08.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005 Pascal Brisset, Antoine Drouin
3  * Copyright (C) 2002 Chris efstathiou hendrix@otenet.gr
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  */
23 
31 #ifndef SRF08_H
32 #define SRF08_H 1
33 
34 /*###########################################################################*/
35 /* START OF CONFIGURATION BLOCK */
36 /*###########################################################################*/
37 /* Normally you shouldn't need to change anything */
38 
39 #define SRF08_UNIT_0 0xE0 /* the SRF08 MODULE I2C address */
40 #define SRF08_UNIT_1 0xE2 /* the SRF08 MODULE I2C address */
41 #define SRF08_UNIT_2 0xE4 /* the SRF08 MODULE I2C address */
42 #define SRF08_UNIT_3 0xE6 /* the SRF08 MODULE I2C address */
43 #define SRF08_UNIT_4 0xE8 /* the SRF08 MODULE I2C address */
44 #define SRF08_UNIT_5 0xEA /* the SRF08 MODULE I2C address */
45 #define SRF08_UNIT_6 0xEC /* the SRF08 MODULE I2C address */
46 #define SRF08_UNIT_7 0xEE /* the SRF08 MODULE I2C address */
47 #define SRF08_UNIT_8 0xF0 /* the SRF08 MODULE I2C address */
48 #define SRF08_UNIT_9 0xF2 /* the SRF08 MODULE I2C address */
49 #define SRF08_UNIT_10 0xF4 /* the SRF08 MODULE I2C address */
50 #define SRF08_UNIT_11 0xF6 /* the SRF08 MODULE I2C address */
51 #define SRF08_UNIT_12 0xF8 /* the SRF08 MODULE I2C address */
52 #define SRF08_UNIT_13 0xFA /* the SRF08 MODULE I2C address */
53 #define SRF08_UNIT_14 0xFC /* the SRF08 MODULE I2C address */
54 #define SRF08_UNIT_15 0xFE /* the SRF08 MODULE I2C address */
55 
56 /*###########################################################################*/
57 /* END OF CONFIGURATION BLOCK */
58 /*###########################################################################*/
59 
60 #define SRF08_I2C_BROADCAST_ADDRESS 0X00
61 
62 #define SRF08_MIN_GAIN 0 /* sets gain to 94 */
63 #define SRF08_MAX_GAIN 31 /* sets gain to 1025 */
64 #define SRF08_MIN_RANGE 0 /* in millimeters */
65 #define SRF08_MAX_RANGE 11008 /* in millimeters */
66 
67 #define SRF08_INCHES 0X50
68 #define SRF08_CENTIMETERS 0X51
69 #define SRF08_MICROSECONDS 0X52
70 
71 /* register positions */
72 #define SRF08_COMMAND 0
73 #define SRF08_SET_GAIN 1
74 #define SRF08_LIGHT 1
75 #define SRF08_ECHO_1 2
76 #define SRF08_ECHO_2 4
77 #define SRF08_ECHO_3 6
78 #define SRF08_ECHO_4 8
79 #define SRF08_ECHO_5 10
80 #define SRF08_ECHO_6 12
81 #define SRF08_ECHO_7 14
82 #define SRF08_ECHO_8 16
83 #define SRF08_ECHO_9 18
84 #define SRF08_ECHO_10 20
85 #define SRF08_ECHO_11 22
86 #define SRF08_ECHO_12 24
87 #define SRF08_ECHO_13 26
88 #define SRF08_ECHO_14 28
89 #define SRF08_ECHO_15 30
90 #define SRF08_ECHO_16 32
91 #define SRF08_ECHO_17 34
92 
93 /* Function Declaration */
94 
95 extern void srf08_select_unit(uint8_t srf08_address);
96 extern void srf08_init(void);
97 
98 extern void srf08_set_gain(uint8_t gain);
99 extern void srf08_set_range(uint32_t millimeters);
100 
101 extern void srf08_ping(void);
102 extern uint32_t srf08_read_register(uint8_t srf08_register);
103 
104 extern void srf08_change_i2c_address(uint8_t new_i2c_address);
105 
106 extern void srf08_initiate_ranging(void);
107 extern void srf08_receive(void);
108 
109 extern uint16_t srf08_range;
112 extern void srf08_read(void);
114 extern void srf08_copy(void);
115 
116 extern void srf08_event(void);
117 
118 #endif /* #ifndef SRF08_H */
void srf08_select_unit(uint8_t srf08_address)
void srf08_event(void)
Definition: alt_srf08.c:139
void srf08_initiate_ranging(void)
Definition: alt_srf08.c:68
bool srf08_got
Definition: alt_srf08.h:110
void srf08_receive(void)
Ask the value to the device.
Definition: alt_srf08.c:77
void srf08_set_range(uint32_t millimeters)
void srf08_ping(void)
Definition: alt_srf08.c:98
void srf08_set_gain(uint8_t gain)
uint16_t srf08_range
Definition: alt_srf08.c:45
void srf08_copy(void)
Copy the I2C buffer.
Definition: alt_srf08.c:93
bool srf08_received
Definition: alt_srf08.c:43
void srf08_change_i2c_address(uint8_t new_i2c_address)
void srf08_init(void)
Definition: alt_srf08.c:50
uint32_t srf08_read_register(uint8_t srf08_register)
Definition: alt_srf08.c:107
void srf08_read(void)
Read values on the bus.
Definition: alt_srf08.c:86
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98