Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
pump_control.c File Reference
#include "modules/pump_control/pump_control.h"
#include "navigation.h"
#include "mcu_periph/adc.h"
#include "mcu_periph/gpio.h"
#include "modules/datalink/downlink.h"
+ Include dependency graph for pump_control.c:

Go to the source code of this file.

Data Structures

struct  PumpControl
 

Macros

#define PUMP_CONTROL_ADC   ADC_4
 
#define PUMP_CONTROL_ADC_EMPTY   20000
 
#define PUMP_CONTROL_GPIO_ACTIVATE   GPIOA,GPIO0
 
#define PUMP_CONTROL_GPIO_PURGE   GPIOA,GPIO1
 
#define PUMP_CTRL_OFF   0
 
#define PUMP_CTRL_PUMP   1
 
#define PUMP_CTRL_VALVE   2
 

Functions

void pump_control_init (void)
 
void pump_activate (void)
 
void pump_purge (void)
 
void pump_stop (void)
 
bool pump_pumping (void)
 
bool pump_done (float duration, float timeout)
 
void pump_control_handler (float value)
 
void pump_control_report (void)
 

Variables

static const float nav_dt = 1.f / NAVIGATION_FREQUENCY
 
float pump_ctrl_state
 
static struct PumpControl pump_control
 

Detailed Description

Author
Gautier Hattenberger gauti.nosp@m.er.h.nosp@m.atten.nosp@m.berg.nosp@m.er@en.nosp@m.ac.f.nosp@m.r Pump control for IMAV2026

Default values for Tawaki v2, AUX 1 connector

Definition in file pump_control.c.


Data Structure Documentation

◆ PumpControl

struct PumpControl

Definition at line 60 of file pump_control.c.

+ Collaboration diagram for PumpControl:
Data Fields
struct adc_buf adc_b
float time
float time_pumping

Macro Definition Documentation

◆ PUMP_CONTROL_ADC

#define PUMP_CONTROL_ADC   ADC_4

Definition at line 36 of file pump_control.c.

◆ PUMP_CONTROL_ADC_EMPTY

#define PUMP_CONTROL_ADC_EMPTY   20000

Definition at line 40 of file pump_control.c.

◆ PUMP_CONTROL_GPIO_ACTIVATE

#define PUMP_CONTROL_GPIO_ACTIVATE   GPIOA,GPIO0

Definition at line 44 of file pump_control.c.

◆ PUMP_CONTROL_GPIO_PURGE

#define PUMP_CONTROL_GPIO_PURGE   GPIOA,GPIO1

Definition at line 48 of file pump_control.c.

◆ PUMP_CTRL_OFF

#define PUMP_CTRL_OFF   0

Definition at line 52 of file pump_control.c.

◆ PUMP_CTRL_PUMP

#define PUMP_CTRL_PUMP   1

Definition at line 53 of file pump_control.c.

◆ PUMP_CTRL_VALVE

#define PUMP_CTRL_VALVE   2

Definition at line 54 of file pump_control.c.

Function Documentation

◆ pump_activate()

void pump_activate ( void  )

Definition at line 79 of file pump_control.c.

References gpio_clear(), gpio_set(), pump_control, PUMP_CONTROL_GPIO_ACTIVATE, PUMP_CONTROL_GPIO_PURGE, PUMP_CTRL_PUMP, pump_ctrl_state, PumpControl::time, and PumpControl::time_pumping.

Referenced by pump_control_handler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pump_control_handler()

void pump_control_handler ( float  value)

Definition at line 121 of file pump_control.c.

References pump_activate(), PUMP_CTRL_OFF, PUMP_CTRL_PUMP, PUMP_CTRL_VALVE, pump_purge(), pump_stop(), and val.

+ Here is the call graph for this function:

◆ pump_control_init()

◆ pump_control_report()

void pump_control_report ( void  )

Definition at line 140 of file pump_control.c.

References PumpControl::adc_b, adc_buf_get(), DefaultChannel, DefaultDevice, foo, pump_control, and PUMP_CONTROL_ADC_EMPTY.

+ Here is the call graph for this function:

◆ pump_done()

bool pump_done ( float  duration,
float  timeout 
)

Definition at line 108 of file pump_control.c.

References nav_dt, pump_control, pump_pumping(), PumpControl::time, PumpControl::time_pumping, and timeout.

+ Here is the call graph for this function:

◆ pump_pumping()

bool pump_pumping ( void  )

Definition at line 104 of file pump_control.c.

References PumpControl::adc_b, adc_buf_get(), pump_control, and PUMP_CONTROL_ADC_EMPTY.

Referenced by pump_done().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pump_purge()

void pump_purge ( void  )

Definition at line 88 of file pump_control.c.

References gpio_clear(), gpio_set(), pump_control, PUMP_CONTROL_GPIO_ACTIVATE, PUMP_CONTROL_GPIO_PURGE, pump_ctrl_state, PUMP_CTRL_VALVE, PumpControl::time, and PumpControl::time_pumping.

Referenced by pump_control_handler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pump_stop()

void pump_stop ( void  )

Definition at line 97 of file pump_control.c.

References gpio_clear(), PUMP_CONTROL_GPIO_ACTIVATE, PUMP_CONTROL_GPIO_PURGE, PUMP_CTRL_OFF, and pump_ctrl_state.

Referenced by pump_control_handler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ nav_dt

const float nav_dt = 1.f / NAVIGATION_FREQUENCY
static

Definition at line 56 of file pump_control.c.

Referenced by pump_done().

◆ pump_control

struct PumpControl pump_control
static

◆ pump_ctrl_state

float pump_ctrl_state

Definition at line 58 of file pump_control.c.

Referenced by pump_activate(), pump_purge(), and pump_stop().