Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
alt_srf08.c File Reference

Basic library for SRF08 telemeter. More...

#include "mcu_periph/i2c.h"
#include "alt_srf08.h"
#include "mcu_periph/uart.h"
#include "pprzlink/messages.h"
#include "modules/datalink/downlink.h"
#include "led.h"
+ Include dependency graph for alt_srf08.c:

Go to the source code of this file.

Macros

#define SRF08_I2C_DEV   i2c0
 

Functions

void srf08_init (void)
 
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_ping ()
 
uint32_t srf08_read_register (uint8_t srf08_register)
 
void srf08_event (void)
 

Variables

bool srf08_received
 
bool srf08_got
 
struct i2c_transaction srf_trans
 
uint16_t srf08_range
 

Detailed Description

Basic library for SRF08 telemeter.

Definition in file alt_srf08.c.

Macro Definition Documentation

◆ SRF08_I2C_DEV

#define SRF08_I2C_DEV   i2c0

Definition at line 39 of file alt_srf08.c.

Function Documentation

◆ 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:

Variable Documentation

◆ srf08_got

bool srf08_got

Definition at line 43 of file alt_srf08.c.

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

◆ 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().

◆ srf_trans