Paparazzi UAS  v5.15_devel-79-g48e7b20
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
electrical.c File Reference

Implemnetation for electrical status: supply voltage, current, battery status, etc. More...

#include "subsystems/electrical.h"
#include "mcu_periph/adc.h"
#include "subsystems/commands.h"
#include "autopilot.h"
#include "generated/airframe.h"
#include <BOARD_CONFIG>
+ Include dependency graph for electrical.c:

Go to the source code of this file.

Macros

#define BAT_CHECKER_DELAY   5
 
#define ELECTRICAL_PERIODIC_FREQ   10
 
#define MIN_BAT_LEVEL   3
 
#define VoltageOfAdc(adc)   DefaultVoltageOfAdc(adc)
 
#define MilliAmpereOfAdc(adc)   DefaultMilliAmpereOfAdc(adc)
 
#define CURRENT_ESTIMATION_NONLINEARITY   1.2
 

Functions

void electrical_init (void)
 
void electrical_periodic (void)
 

Variables

static float period_to_hour = 1 / 3600.f / ELECTRICAL_PERIODIC_FREQ
 
struct Electrical electrical
 

Detailed Description

Implemnetation for electrical status: supply voltage, current, battery status, etc.

Definition in file electrical.c.

Macro Definition Documentation

#define BAT_CHECKER_DELAY   5

Definition at line 52 of file electrical.c.

Referenced by electrical_periodic().

#define CURRENT_ESTIMATION_NONLINEARITY   1.2

Definition at line 90 of file electrical.c.

Referenced by electrical_init().

#define ELECTRICAL_PERIODIC_FREQ   10

Definition at line 55 of file electrical.c.

Referenced by electrical_periodic().

#define MilliAmpereOfAdc (   adc)    DefaultMilliAmpereOfAdc(adc)

Definition at line 86 of file electrical.c.

Referenced by electrical_periodic().

#define MIN_BAT_LEVEL   3

Definition at line 59 of file electrical.c.

Referenced by electrical_periodic().

#define VoltageOfAdc (   adc)    DefaultVoltageOfAdc(adc)

Definition at line 83 of file electrical.c.

Referenced by electrical_periodic().

Function Documentation

void electrical_init ( void  )

Definition at line 100 of file electrical.c.

References adc_buf_channel(), ADC_CHANNEL_CURRENT, ADC_CHANNEL_VSUPPLY, Electrical::bat_critical, Electrical::bat_low, Electrical::charge, Electrical::current, CURRENT_ESTIMATION_NONLINEARITY, DEFAULT_AV_NB_SAMPLE, Electrical::energy, and Electrical::vsupply.

Referenced by init_fbw(), and main_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

float period_to_hour = 1 / 3600.f / ELECTRICAL_PERIODIC_FREQ
static

Definition at line 56 of file electrical.c.

Referenced by electrical_periodic().