Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures 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 "mcu_periph/uart.h"
#include "messages.h"
#include "subsystems/datalink/downlink.h"
+ Include dependency graph for sonar_adc.c:

Go to the source code of this file.

Macros

#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE
 
#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

uint16_t sonar_meas
 Raw ADC value. More...
 
bool_t sonar_data_available
 New data available. More...
 
float sonar_distance
 Sonar distance in m. More...
 
float sonar_offset
 
float sonar_scale
 
static struct adc_buf sonar_adc
 

Macro Definition Documentation

#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE

Definition at line 34 of file sonar_adc.c.

#define SONAR_OFFSET   0.

Sonar offset.

Offset value in m (float) equals to the height when the ADC gives 0

Definition at line 42 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 49 of file sonar_adc.c.

Referenced by sonar_adc_init().

Function Documentation

void sonar_adc_init ( void  )

Definition at line 62 of file sonar_adc.c.

References adc_buf_channel(), DEFAULT_AV_NB_SAMPLE, FALSE, sonar_adc, sonar_data_available, sonar_distance, sonar_meas, SONAR_OFFSET, sonar_offset, SONAR_SCALE, and sonar_scale.

+ Here is the call graph for this function:

void sonar_adc_read ( void  )

Read ADC value to update sonar measurement.

Definition at line 76 of file sonar_adc.c.

References adc_buf::av_nb_sample, DefaultChannel, DefaultDevice, sonar_adc, sonar_data_available, sonar_distance, sonar_meas, sonar_offset, sonar_scale, stateGetPositionEnu_f(), adc_buf::sum, TRUE, and EnuCoor_f::z.

+ Here is the call graph for this function:

Variable Documentation

struct adc_buf sonar_adc
static

Definition at line 59 of file sonar_adc.c.

Referenced by sonar_adc_init(), and sonar_adc_read().

bool_t sonar_data_available

New data available.

Definition at line 53 of file sonar_adc.c.

Referenced by sonar_adc_init(), and sonar_adc_read().

float sonar_distance

Sonar distance in m.

Definition at line 54 of file sonar_adc.c.

Referenced by sonar_adc_init(), and sonar_adc_read().

uint16_t sonar_meas

Raw ADC value.

Definition at line 52 of file sonar_adc.c.

Referenced by ins_update_baro(), ins_update_sonar(), sonar_adc_init(), and sonar_adc_read().

float sonar_offset

Definition at line 55 of file sonar_adc.c.

Referenced by sonar_adc_init(), and sonar_adc_read().

float sonar_scale

Definition at line 56 of file sonar_adc.c.

Referenced by sonar_adc_init(), and sonar_adc_read().