Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
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.
void battery_monitor_init_bus (void)
 Initializes bus ADC.
void battery_monitor_init_balance (struct BatMonBal *batmonbal)
 Initalizes balance ADC.
void battery_monitor_init (void)
 Init variables.
void battery_monitor_event (void)
 Event function Check i2c transaction status for each device.
void battery_monitor_check_i2c_transaction (struct i2c_transaction *t)
 Complete i2c transactions once they succeed or fail.
void battery_monitor_read_bus (void)
 Read bus (current, voltage and temperature sensors).
void battery_monitor_read_balance_ports_1 (void)
 Read Balance ADC 1.
void battery_monitor_read_balance_ports_2 (void)
 Read Balance ADC 2.
void battery_monitor_read_balance_ports (struct BatMonBal *batmonbal)
 Read balance ADC.

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

◆ battery_monitor_check_i2c_transaction()

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:

◆ battery_monitor_event()

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, and battery_monitor_check_i2c_transaction().

Here is the call graph for this function:

◆ battery_monitor_get_address()

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:

◆ battery_monitor_init()

void battery_monitor_init ( void )

Init variables.

Definition at line 140 of file battery_monitor.c.

References 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:

◆ battery_monitor_init_balance()

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:

◆ battery_monitor_init_bus()

◆ battery_monitor_read_balance_ports()

◆ battery_monitor_read_balance_ports_1()

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:

◆ battery_monitor_read_balance_ports_2()

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:

◆ battery_monitor_read_bus()

◆ send_batmon()

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

Definition at line 46 of file battery_monitor.c.

References batmonbal1, batmonbal2, batmonbus, BATTERY_CELLS_NB, dev, and TEMP_SENSORS_NB.

Referenced by battery_monitor_init().

Here is the caller graph for this function:

Variable Documentation

◆ batmon_current_offset

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().

◆ batmon_current_sensitivity

float batmon_current_sensitivity

Definition at line 40 of file battery_monitor.c.

Referenced by battery_monitor_init_bus(), and battery_monitor_read_bus().

◆ batmon_temp_offset

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().

◆ batmon_temp_sensitivity

float batmon_temp_sensitivity

Definition at line 42 of file battery_monitor.c.

Referenced by battery_monitor_init_bus(), and battery_monitor_read_bus().

◆ batmonbal1

◆ batmonbal2

◆ batmonbus