Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
sonar_adc.c File Reference
#include "generated/airframe.h"
#include "modules/sonar/sonar_adc.h"
#include "modules/core/abi.h"
#include "modules/datalink/telemetry.h"
#include "pprzlink/messages.h"
#include "mcu_periph/adc.h"
#include "filters/low_pass_filter.h"
+ Include dependency graph for sonar_adc.c:

Go to the source code of this file.

Macros

#define SONAR_ADC_MIN_RANGE   0.24f
 The minimum chosen distance for the device to be give readings.
 
#define SONAR_ADC_MAX_RANGE   4.0f
 The maximum chosen distance for the device to be give readings.
 
#define SONAR_ADC_RAW_OFFSET   0
 Sonar offset in ADC units.
 
#define SONAR_ADC_OFFSET   0.0f
 Rangefinder distance offset value for what should be considered zero distance, e.g.
 
#define SONAR_ADC_USE_FILTER   1
 Filter the raw measuread sonar data.
 
#define USE_SONAR_ADC_AGL   0
 Option to send AGL data over ABI.
 
#define SONAR_ADC_LOWPASS_TAU   0.16
 
#define SONAR_ADC_COMPENSATE_ROTATION   0
 
#define SONAR_ADC_SCALE   0.001855f
 Scale Sensor sensitivity in m/adc (float)
 

Functions

static void sonar_adc_send_sonar (struct transport_tx *trans, struct link_device *dev)
 Sending Send measured value and status information so it can be read back in e.g.
 
void sonar_adc_init (void)
 
void sonar_adc_periodic (void)
 Reading Read ADC value to update sonar measurement.
 
void sonar_adc_report (void)
 Debug report Option to send debug informative values over telemetry.
 

Variables

static Butterworth2LowPass sonar_filt
 
struct SonarADC sonar_adc
 
static struct adc_buf sonar_adc_buf
 

Macro Definition Documentation

◆ SONAR_ADC_COMPENSATE_ROTATION

#define SONAR_ADC_COMPENSATE_ROTATION   0

Definition at line 97 of file sonar_adc.c.

◆ SONAR_ADC_LOWPASS_TAU

#define SONAR_ADC_LOWPASS_TAU   0.16

Definition at line 90 of file sonar_adc.c.

◆ SONAR_ADC_MAX_RANGE

#define SONAR_ADC_MAX_RANGE   4.0f

The maximum chosen distance for the device to be give readings.

Definition at line 63 of file sonar_adc.c.

◆ SONAR_ADC_MIN_RANGE

#define SONAR_ADC_MIN_RANGE   0.24f

The minimum chosen distance for the device to be give readings.

Definition at line 58 of file sonar_adc.c.

◆ SONAR_ADC_OFFSET

#define SONAR_ADC_OFFSET   0.0f

Rangefinder distance offset value for what should be considered zero distance, e.g.

high landing gear of 1.1m to tarmac still could be considered zero This is NOT the same as the RAW ADC value offset

Definition at line 74 of file sonar_adc.c.

◆ SONAR_ADC_RAW_OFFSET

#define SONAR_ADC_RAW_OFFSET   0

Sonar offset in ADC units.

Definition at line 68 of file sonar_adc.c.

◆ SONAR_ADC_SCALE

#define SONAR_ADC_SCALE   0.001855f

Scale Sensor sensitivity in m/adc (float)

Definition at line 104 of file sonar_adc.c.

◆ SONAR_ADC_USE_FILTER

#define SONAR_ADC_USE_FILTER   1

Filter the raw measuread sonar data.

Definition at line 79 of file sonar_adc.c.

◆ USE_SONAR_ADC_AGL

#define USE_SONAR_ADC_AGL   0

Option to send AGL data over ABI.

Definition at line 84 of file sonar_adc.c.

Function Documentation

◆ sonar_adc_init()

◆ sonar_adc_periodic()

◆ sonar_adc_report()

void sonar_adc_report ( void  )

Debug report Option to send debug informative values over telemetry.

Definition at line 207 of file sonar_adc.c.

References DefaultChannel, DefaultDevice, SonarADC::distance, foo, SonarADC::raw, and sonar_adc.

Referenced by sonar_adc_periodic().

+ Here is the caller graph for this function:

◆ sonar_adc_send_sonar()

static void sonar_adc_send_sonar ( struct transport_tx trans,
struct link_device dev 
)
static

Sending Send measured value and status information so it can be read back in e.g.

log file for debugging

Definition at line 116 of file sonar_adc.c.

References dev, SonarADC::distance, foo, SonarADC::raw, and sonar_adc.

Referenced by sonar_adc_init().

+ Here is the caller graph for this function:

Variable Documentation

◆ sonar_adc

struct SonarADC sonar_adc

◆ sonar_adc_buf

struct adc_buf sonar_adc_buf
static

Definition at line 110 of file sonar_adc.c.

Referenced by sonar_adc_init(), and sonar_adc_periodic().

◆ sonar_filt

Butterworth2LowPass sonar_filt
static

Definition at line 92 of file sonar_adc.c.

Referenced by sonar_adc_init(), sonar_adc_periodic(), sonar_pwm_init(), and sonar_pwm_read().