Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
alt_srf08.h File Reference

Basic library for SRF08 telemeter. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SRF08_UNIT_0   0xE0 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_1   0xE2 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_2   0xE4 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_3   0xE6 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_4   0xE8 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_5   0xEA /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_6   0xEC /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_7   0xEE /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_8   0xF0 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_9   0xF2 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_10   0xF4 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_11   0xF6 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_12   0xF8 /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_13   0xFA /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_14   0xFC /* the SRF08 MODULE I2C address */
 
#define SRF08_UNIT_15   0xFE /* the SRF08 MODULE I2C address */
 
#define SRF08_I2C_BROADCAST_ADDRESS   0X00
 
#define SRF08_MIN_GAIN   0 /* sets gain to 94 */
 
#define SRF08_MAX_GAIN   31 /* sets gain to 1025 */
 
#define SRF08_MIN_RANGE   0 /* in millimeters */
 
#define SRF08_MAX_RANGE   11008 /* in millimeters */
 
#define SRF08_INCHES   0X50
 
#define SRF08_CENTIMETERS   0X51
 
#define SRF08_MICROSECONDS   0X52
 
#define SRF08_COMMAND   0
 
#define SRF08_SET_GAIN   1
 
#define SRF08_LIGHT   1
 
#define SRF08_ECHO_1   2
 
#define SRF08_ECHO_2   4
 
#define SRF08_ECHO_3   6
 
#define SRF08_ECHO_4   8
 
#define SRF08_ECHO_5   10
 
#define SRF08_ECHO_6   12
 
#define SRF08_ECHO_7   14
 
#define SRF08_ECHO_8   16
 
#define SRF08_ECHO_9   18
 
#define SRF08_ECHO_10   20
 
#define SRF08_ECHO_11   22
 
#define SRF08_ECHO_12   24
 
#define SRF08_ECHO_13   26
 
#define SRF08_ECHO_14   28
 
#define SRF08_ECHO_15   30
 
#define SRF08_ECHO_16   32
 
#define SRF08_ECHO_17   34
 

Functions

void srf08_select_unit (uint8_t srf08_address)
 
void srf08_init (void)
 
void srf08_set_gain (uint8_t gain)
 
void srf08_set_range (uint32_t millimeters)
 
void srf08_ping (void)
 
uint32_t srf08_read_register (uint8_t srf08_register)
 
void srf08_change_i2c_address (uint8_t new_i2c_address)
 
void srf08_initiate_ranging (void)
 
void srf08_receive (void)
 Ask the value to the device. More...
 
void srf08_read (void)
 Read values on the bus. More...
 
void srf08_copy (void)
 Copy the I2C buffer. More...
 
void srf08_event (void)
 

Variables

uint16_t srf08_range
 
bool srf08_received
 
bool srf08_got
 

Detailed Description

Basic library for SRF08 telemeter.

Definition in file alt_srf08.h.

Macro Definition Documentation

◆ SRF08_CENTIMETERS

#define SRF08_CENTIMETERS   0X51

Definition at line 68 of file alt_srf08.h.

◆ SRF08_COMMAND

#define SRF08_COMMAND   0

Definition at line 72 of file alt_srf08.h.

◆ SRF08_ECHO_1

#define SRF08_ECHO_1   2

Definition at line 75 of file alt_srf08.h.

◆ SRF08_ECHO_10

#define SRF08_ECHO_10   20

Definition at line 84 of file alt_srf08.h.

◆ SRF08_ECHO_11

#define SRF08_ECHO_11   22

Definition at line 85 of file alt_srf08.h.

◆ SRF08_ECHO_12

#define SRF08_ECHO_12   24

Definition at line 86 of file alt_srf08.h.

◆ SRF08_ECHO_13

#define SRF08_ECHO_13   26

Definition at line 87 of file alt_srf08.h.

◆ SRF08_ECHO_14

#define SRF08_ECHO_14   28

Definition at line 88 of file alt_srf08.h.

◆ SRF08_ECHO_15

#define SRF08_ECHO_15   30

Definition at line 89 of file alt_srf08.h.

◆ SRF08_ECHO_16

#define SRF08_ECHO_16   32

Definition at line 90 of file alt_srf08.h.

◆ SRF08_ECHO_17

#define SRF08_ECHO_17   34

Definition at line 91 of file alt_srf08.h.

◆ SRF08_ECHO_2

#define SRF08_ECHO_2   4

Definition at line 76 of file alt_srf08.h.

◆ SRF08_ECHO_3

#define SRF08_ECHO_3   6

Definition at line 77 of file alt_srf08.h.

◆ SRF08_ECHO_4

#define SRF08_ECHO_4   8

Definition at line 78 of file alt_srf08.h.

◆ SRF08_ECHO_5

#define SRF08_ECHO_5   10

Definition at line 79 of file alt_srf08.h.

◆ SRF08_ECHO_6

#define SRF08_ECHO_6   12

Definition at line 80 of file alt_srf08.h.

◆ SRF08_ECHO_7

#define SRF08_ECHO_7   14

Definition at line 81 of file alt_srf08.h.

◆ SRF08_ECHO_8

#define SRF08_ECHO_8   16

Definition at line 82 of file alt_srf08.h.

◆ SRF08_ECHO_9

#define SRF08_ECHO_9   18

Definition at line 83 of file alt_srf08.h.

◆ SRF08_I2C_BROADCAST_ADDRESS

#define SRF08_I2C_BROADCAST_ADDRESS   0X00

Definition at line 60 of file alt_srf08.h.

◆ SRF08_INCHES

#define SRF08_INCHES   0X50

Definition at line 67 of file alt_srf08.h.

◆ SRF08_LIGHT

#define SRF08_LIGHT   1

Definition at line 74 of file alt_srf08.h.

◆ SRF08_MAX_GAIN

#define SRF08_MAX_GAIN   31 /* sets gain to 1025 */

Definition at line 63 of file alt_srf08.h.

◆ SRF08_MAX_RANGE

#define SRF08_MAX_RANGE   11008 /* in millimeters */

Definition at line 65 of file alt_srf08.h.

◆ SRF08_MICROSECONDS

#define SRF08_MICROSECONDS   0X52

Definition at line 69 of file alt_srf08.h.

◆ SRF08_MIN_GAIN

#define SRF08_MIN_GAIN   0 /* sets gain to 94 */

Definition at line 62 of file alt_srf08.h.

◆ SRF08_MIN_RANGE

#define SRF08_MIN_RANGE   0 /* in millimeters */

Definition at line 64 of file alt_srf08.h.

◆ SRF08_SET_GAIN

#define SRF08_SET_GAIN   1

Definition at line 73 of file alt_srf08.h.

◆ SRF08_UNIT_0

#define SRF08_UNIT_0   0xE0 /* the SRF08 MODULE I2C address */

Definition at line 39 of file alt_srf08.h.

◆ SRF08_UNIT_1

#define SRF08_UNIT_1   0xE2 /* the SRF08 MODULE I2C address */

Definition at line 40 of file alt_srf08.h.

◆ SRF08_UNIT_10

#define SRF08_UNIT_10   0xF4 /* the SRF08 MODULE I2C address */

Definition at line 49 of file alt_srf08.h.

◆ SRF08_UNIT_11

#define SRF08_UNIT_11   0xF6 /* the SRF08 MODULE I2C address */

Definition at line 50 of file alt_srf08.h.

◆ SRF08_UNIT_12

#define SRF08_UNIT_12   0xF8 /* the SRF08 MODULE I2C address */

Definition at line 51 of file alt_srf08.h.

◆ SRF08_UNIT_13

#define SRF08_UNIT_13   0xFA /* the SRF08 MODULE I2C address */

Definition at line 52 of file alt_srf08.h.

◆ SRF08_UNIT_14

#define SRF08_UNIT_14   0xFC /* the SRF08 MODULE I2C address */

Definition at line 53 of file alt_srf08.h.

◆ SRF08_UNIT_15

#define SRF08_UNIT_15   0xFE /* the SRF08 MODULE I2C address */

Definition at line 54 of file alt_srf08.h.

◆ SRF08_UNIT_2

#define SRF08_UNIT_2   0xE4 /* the SRF08 MODULE I2C address */

Definition at line 41 of file alt_srf08.h.

◆ SRF08_UNIT_3

#define SRF08_UNIT_3   0xE6 /* the SRF08 MODULE I2C address */

Definition at line 42 of file alt_srf08.h.

◆ SRF08_UNIT_4

#define SRF08_UNIT_4   0xE8 /* the SRF08 MODULE I2C address */

Definition at line 43 of file alt_srf08.h.

◆ SRF08_UNIT_5

#define SRF08_UNIT_5   0xEA /* the SRF08 MODULE I2C address */

Definition at line 44 of file alt_srf08.h.

◆ SRF08_UNIT_6

#define SRF08_UNIT_6   0xEC /* the SRF08 MODULE I2C address */

Definition at line 45 of file alt_srf08.h.

◆ SRF08_UNIT_7

#define SRF08_UNIT_7   0xEE /* the SRF08 MODULE I2C address */

Definition at line 46 of file alt_srf08.h.

◆ SRF08_UNIT_8

#define SRF08_UNIT_8   0xF0 /* the SRF08 MODULE I2C address */

Definition at line 47 of file alt_srf08.h.

◆ SRF08_UNIT_9

#define SRF08_UNIT_9   0xF2 /* the SRF08 MODULE I2C address */

Definition at line 48 of file alt_srf08.h.

Function Documentation

◆ srf08_change_i2c_address()

void srf08_change_i2c_address ( uint8_t  new_i2c_address)

◆ srf08_copy()

void srf08_copy ( void  )

Copy the I2C buffer.

Definition at line 93 of file alt_srf08.c.

References i2c_transaction::buf, srf08_range, and srf_trans.

Referenced by srf08_event().

+ Here is the caller graph for this function:

◆ srf08_event()

void srf08_event ( void  )

Handling of data sent by the device (initiated by srf08_receive()

Definition at line 139 of file alt_srf08.c.

References DefaultChannel, DefaultDevice, f, I2CTransSuccess, srf08_copy(), srf08_got, srf08_range, srf08_read(), srf08_received, srf_trans, and i2c_transaction::status.

+ Here is the call graph for this function:

◆ srf08_init()

void srf08_init ( void  )

Setting the gain to the minimun value (to avoid echos ?)

Definition at line 50 of file alt_srf08.c.

References i2c_transaction::buf, i2c_transmit(), srf08_got, SRF08_I2C_DEV, SRF08_MIN_GAIN, srf08_received, SRF08_SET_GAIN, SRF08_UNIT_0, and srf_trans.

+ Here is the call graph for this function:

◆ srf08_initiate_ranging()

void srf08_initiate_ranging ( void  )

Definition at line 68 of file alt_srf08.c.

References i2c_transaction::buf, i2c_transmit(), LED_ON, SRF08_CENTIMETERS, SRF08_COMMAND, SRF08_I2C_DEV, SRF08_UNIT_0, and srf_trans.

Referenced by srf08_ping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srf08_ping()

void srf08_ping ( void  )

Definition at line 98 of file alt_srf08.c.

References I2CTransSuccess, srf08_initiate_ranging(), srf08_receive(), srf_trans, and i2c_transaction::status.

+ Here is the call graph for this function:

◆ srf08_read()

void srf08_read ( void  )

Read values on the bus.

Definition at line 86 of file alt_srf08.c.

References i2c_receive(), srf08_got, SRF08_I2C_DEV, SRF08_UNIT_0, and srf_trans.

Referenced by srf08_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srf08_read_register()

uint32_t srf08_read_register ( uint8_t  srf08_register)

Definition at line 107 of file alt_srf08.c.

References i2c_transaction::buf, i2c_transceive(), SRF08_I2C_DEV, SRF08_UNIT_0, and srf_trans.

+ Here is the call graph for this function:

◆ srf08_receive()

void srf08_receive ( void  )

Ask the value to the device.

Definition at line 77 of file alt_srf08.c.

References i2c_transaction::buf, i2c_transmit(), LED_OFF, SRF08_ECHO_1, SRF08_I2C_DEV, srf08_received, SRF08_UNIT_0, and srf_trans.

Referenced by srf08_ping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srf08_select_unit()

void srf08_select_unit ( uint8_t  srf08_address)

◆ srf08_set_gain()

void srf08_set_gain ( uint8_t  gain)

◆ srf08_set_range()

void srf08_set_range ( uint32_t  millimeters)

Variable Documentation

◆ srf08_got

bool srf08_got

Definition at line 110 of file alt_srf08.h.

◆ srf08_range

uint16_t srf08_range

Definition at line 45 of file alt_srf08.c.

Referenced by srf08_copy(), and srf08_event().

◆ srf08_received

bool srf08_received

Definition at line 43 of file alt_srf08.c.

Referenced by srf08_event(), srf08_init(), and srf08_receive().