Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
battery_monitor.c File Reference

driver for ADC AD7997 on a custom made power board version 4.0 and 5.0 More...

+ Include dependency graph for battery_monitor.c:

Go to the source code of this file.

Functions

static void send_batmon (struct transport_tx *trans, struct link_device *dev)
 
uint8_t battery_monitor_get_address (uint8_t chan)
 Translates the channel number to the value for address pointer register Channels are numbered from 1 to 8. More...
 
void battery_monitor_init_bus (void)
 Initializes bus ADC. More...
 
void battery_monitor_init_balance (struct BatMonBal *batmonbal)
 Initalizes balance ADC. More...
 
void battery_monitor_init (void)
 Init variables. More...
 
void battery_monitor_event (void)
 Event function Check i2c transaction status for each device. More...
 
void battery_monitor_check_i2c_transaction (struct i2c_transaction *t)
 Complete i2c transactions once they succeed or fail. More...
 
void battery_monitor_read_bus (void)
 Read bus (current, voltage and temperature sensors) More...
 
void battery_monitor_read_balance_ports_1 (void)
 Read Balance ADC 1. More...
 
void battery_monitor_read_balance_ports_2 (void)
 Read Balance ADC 2. More...
 
void battery_monitor_read_balance_ports (struct BatMonBal *batmonbal)
 Read balance ADC. More...
 

Variables

struct BatMonBus batmonbus
 
struct BatMonBal batmonbal1
 
struct BatMonBal batmonbal2
 
int16_t batmon_current_offset
 
float batmon_current_sensitivity
 
int16_t batmon_temp_offset
 
float batmon_temp_sensitivity
 

Detailed Description

driver for ADC AD7997 on a custom made power board version 4.0 and 5.0

Definition in file battery_monitor.c.

Function Documentation

void battery_monitor_check_i2c_transaction ( struct i2c_transaction t)

Complete i2c transactions once they succeed or fail.

Definition at line 170 of file battery_monitor.c.

References I2CTransDone, I2CTransFailed, I2CTransPending, I2CTransRunning, I2CTransSuccess, and i2c_transaction::status.

Referenced by battery_monitor_event().

+ Here is the caller graph for this function:

void battery_monitor_event ( void  )

Event function Check i2c transaction status for each device.

Definition at line 161 of file battery_monitor.c.

References batmonbal1, batmonbal2, batmonbus, battery_monitor_check_i2c_transaction(), BatMonBal::bus_trans, and BatMonBus::bus_trans.

+ Here is the call graph for this function:

uint8_t battery_monitor_get_address ( uint8_t  chan)

Translates the channel number to the value for address pointer register Channels are numbered from 1 to 8.

Parameters
chan- desired channel
Returns
addres pointer Byte (see AD7997/8 datasheet)

Definition at line 91 of file battery_monitor.c.

Referenced by battery_monitor_read_balance_ports(), and battery_monitor_read_bus().

+ Here is the caller graph for this function:

void battery_monitor_init ( void  )

Init variables.

Definition at line 140 of file battery_monitor.c.

References BatMonBal::addr, batmonbal1, batmonbal2, battery_monitor_init_balance(), battery_monitor_init_bus(), DefaultPeriodic, register_periodic_telemetry(), and send_batmon().

+ Here is the call graph for this function:

void battery_monitor_init_balance ( struct BatMonBal batmonbal)

Initalizes balance ADC.

Definition at line 130 of file battery_monitor.c.

References BatMonBal::bat_cell_mvolts, BatMonBal::bus_trans, BatMonBal::cell_index, BatMonBal::data, I2CTransDone, and i2c_transaction::status.

Referenced by battery_monitor_init().

+ Here is the caller graph for this function:

void battery_monitor_read_balance_ports_1 ( void  )

Read Balance ADC 1.

Definition at line 340 of file battery_monitor.c.

References batmonbal1, and battery_monitor_read_balance_ports().

+ Here is the call graph for this function:

void battery_monitor_read_balance_ports_2 ( void  )

Read Balance ADC 2.

Definition at line 347 of file battery_monitor.c.

References batmonbal2, and battery_monitor_read_balance_ports().

+ Here is the call graph for this function:

static void send_batmon ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Variable Documentation

int16_t batmon_current_offset

Definition at line 39 of file battery_monitor.c.

Referenced by battery_monitor_init_bus(), and battery_monitor_read_bus().

float batmon_current_sensitivity

Definition at line 40 of file battery_monitor.c.

Referenced by battery_monitor_init_bus(), and battery_monitor_read_bus().

int16_t batmon_temp_offset

Definition at line 41 of file battery_monitor.c.

Referenced by battery_monitor_init_bus(), and battery_monitor_read_bus().

float batmon_temp_sensitivity

Definition at line 42 of file battery_monitor.c.

Referenced by battery_monitor_init_bus(), and battery_monitor_read_bus().