Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
sonar_i2c.h File Reference

Driver for an sonar rangfinder sensor when used via I2C bus. More...

#include "stdbool.h"
#include "mcu_periph/i2c.h"
+ Include dependency graph for sonar_i2c.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SonarI2C
 

Enumerations

enum  SonarI2CStatus { SONAR_I2C_REQ_DATA , SONAR_I2C_READ_DATA , SONAR_I2C_PARSE_DATA }
 

Functions

void sonar_i2c_init (void)
 Set the default values at initialization.
 
void sonar_i2c_event (void)
 Rangefinder event function Basically just check the progress of the transation to prevent overruns during high speed operation (ie.
 
void sonar_i2c_periodic (void)
 Get the ranger current distance value.
 
void sonar_i2c_report (void)
 Option to send debug informative values over telemetry if you do not want sonar message in telemetry.
 

Variables

struct SonarI2C sonar_i2c
 

Detailed Description

Driver for an sonar rangfinder sensor when used via I2C bus.

Driver for common sonar rangfinder devices used via I2C bus.

Definition in file sonar_i2c.h.


Data Structure Documentation

◆ SonarI2C

struct SonarI2C

Definition at line 38 of file sonar_i2c.h.

+ Collaboration diagram for SonarI2C:
Data Fields
uint8_t addr
float distance Distance scaled to [m].
uint16_t raw raw measuread non scaled range value from sensor
enum SonarI2CStatus status
struct i2c_transaction trans
bool update_agl Do or don't update AGL ABI message.

Enumeration Type Documentation

◆ SonarI2CStatus

Enumerator
SONAR_I2C_REQ_DATA 
SONAR_I2C_READ_DATA 
SONAR_I2C_PARSE_DATA 

Definition at line 32 of file sonar_i2c.h.

Function Documentation

◆ sonar_i2c_event()

void sonar_i2c_event ( void  )
extern

Rangefinder event function Basically just check the progress of the transation to prevent overruns during high speed operation (ie.

polling the sensor at more than maximum, e.g. > 10Hz)

Definition at line 142 of file sonar_i2c.c.

References I2CTransDone, I2CTransFailed, I2CTransPending, I2CTransRunning, I2CTransSuccess, sonar_i2c, sonar_i2c_report(), i2c_transaction::status, and SonarI2C::trans.

+ Here is the call graph for this function:

◆ sonar_i2c_init()

◆ sonar_i2c_periodic()

◆ sonar_i2c_report()

void sonar_i2c_report ( void  )
extern

Option to send debug informative values over telemetry if you do not want sonar message in telemetry.

Definition at line 246 of file sonar_i2c.c.

References DefaultChannel, DefaultDevice, SonarI2C::distance, foo, SonarI2C::raw, and sonar_i2c.

Referenced by sonar_i2c_event().

+ Here is the caller graph for this function:

Variable Documentation

◆ sonar_i2c

struct SonarI2C sonar_i2c
extern