Paparazzi UAS  v5.15_devel-88-gb3ad7fe
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sonar_adc.c File Reference
#include "modules/sonar/sonar_adc.h"
#include "generated/airframe.h"
#include "mcu_periph/adc.h"
#include "subsystems/abi.h"
#include "mcu_periph/uart.h"
#include "pprzlink/messages.h"
#include "subsystems/datalink/downlink.h"
+ Include dependency graph for sonar_adc.c:

Go to the source code of this file.

Macros

#define SONAR_OFFSET   0
 Sonar offset. More...
 
#define SONAR_SCALE   0.0166
 Sonar scale. More...
 

Functions

void sonar_adc_init (void)
 
void sonar_adc_read (void)
 Read ADC value to update sonar measurement. More...
 

Variables

struct SonarAdc sonar_adc
 
static struct adc_buf sonar_adc_buf
 

Macro Definition Documentation

#define SONAR_OFFSET   0

Sonar offset.

Offset value in ADC equals to the ADC value so that height is zero

Definition at line 40 of file sonar_adc.c.

Referenced by sonar_adc_init().

#define SONAR_SCALE   0.0166

Sonar scale.

Sensor sensitivity in m/adc (float)

Definition at line 47 of file sonar_adc.c.

Referenced by sonar_adc_read().

Function Documentation

void sonar_adc_init ( void  )

Definition at line 56 of file sonar_adc.c.

References adc_buf_channel(), DEFAULT_AV_NB_SAMPLE, SonarAdc::meas, SonarAdc::offset, sonar_adc, sonar_adc_buf, and SONAR_OFFSET.

+ Here is the call graph for this function:

void sonar_adc_read ( void  )

Read ADC value to update sonar measurement.

Definition at line 68 of file sonar_adc.c.

References AGL_SONAR_ADC_ID, adc_buf::av_nb_sample, DefaultChannel, DefaultDevice, SonarAdc::distance, get_sys_time_usec(), SonarAdc::meas, SonarAdc::offset, sonar_adc, sonar_adc_buf, SONAR_SCALE, stateGetPositionEnu_f(), adc_buf::sum, and EnuCoor_f::z.

+ Here is the call graph for this function:

Variable Documentation

struct SonarAdc sonar_adc

Definition at line 50 of file sonar_adc.c.

Referenced by sonar_adc_init(), and sonar_adc_read().

struct adc_buf sonar_adc_buf
static

Definition at line 53 of file sonar_adc.c.

Referenced by sonar_adc_init(), and sonar_adc_read().