Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
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 |
driver for ADC AD7997 on a custom made power board version 4.0 and 5.0
Definition in file battery_monitor.c.
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().
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.
Translates the channel number to the value for address pointer register Channels are numbered from 1 to 8.
chan | - desired channel |
Definition at line 91 of file battery_monitor.c.
Referenced by battery_monitor_read_balance_ports(), and battery_monitor_read_bus().
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().
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().
void battery_monitor_init_bus | ( | void | ) |
Initializes bus ADC.
Definition at line 102 of file battery_monitor.c.
References BatMonBus::addr, batmon_current_offset, batmon_current_sensitivity, batmon_temp_offset, batmon_temp_sensitivity, batmonbus, BATTERY_MONITOR_BUS_CURRENT_REQ, BATTERY_MONITOR_CURRENT_OFFSET, BATTERY_MONITOR_CURRENT_SENSITIVITY, BATTERY_MONITOR_TEMP_OFFSET, BATTERY_MONITOR_TEMP_SENSITIVITY, BatMonBus::bus_brd_tmp, BatMonBus::bus_current, BatMonBus::bus_current_mvolts, BatMonBus::bus_status, BatMonBus::bus_temp, BatMonBus::bus_tempsensors_mvolts, BatMonBus::bus_trans, BatMonBus::bus_voltage_mvolts, BatMonBus::data, I2CTransDone, i2c_transaction::status, and BatMonBus::t_idx.
Referenced by battery_monitor_init().
void battery_monitor_read_balance_ports | ( | struct BatMonBal * | batmonbal | ) |
Read balance ADC.
Definition at line 354 of file battery_monitor.c.
References BatMonBal::addr, BatMonBal::bat_cell_mvolts, BATTERY_CELLS_NB, BATTERY_MONITOR_BIT_RES, battery_monitor_cellgains, battery_monitor_cellmap, battery_monitor_get_address(), BATTERY_MONITOR_VREF_MULT, i2c_transaction::buf, BatMonBal::bus_trans, BatMonBal::cell_index, BatMonBal::data, i2c_transceive(), I2CTransDone, and i2c_transaction::status.
Referenced by battery_monitor_read_balance_ports_1(), and battery_monitor_read_balance_ports_2().
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().
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().
void battery_monitor_read_bus | ( | void | ) |
Read bus (current, voltage and temperature sensors)
Definition at line 197 of file battery_monitor.c.
References BatMonBus::addr, batmon_current_offset, batmon_current_sensitivity, batmon_temp_offset, batmon_temp_sensitivity, batmonbus, BatmonVbusGain, BATTERY_MONITOR_BIT_RES, BATTERY_MONITOR_BUS_CURRENT_CHANNEL, BATTERY_MONITOR_BUS_CURRENT_READ, BATTERY_MONITOR_BUS_CURRENT_REQ, BATTERY_MONITOR_BUS_TEMPERATURE_READ, BATTERY_MONITOR_BUS_TEMPERATURE_REQ, BATTERY_MONITOR_BUS_VOLTAGE_CHANNEL, BATTERY_MONITOR_BUS_VOLTAGE_READ, BATTERY_MONITOR_BUS_VOLTAGE_REQ, battery_monitor_get_address(), battery_monitor_tempmap, BATTERY_MONITOR_VREF_MULT, i2c_transaction::buf, BatMonBus::bus_current, BatMonBus::bus_current_mvolts, BatMonBus::bus_status, BatMonBus::bus_temp, BatMonBus::bus_tempsensors_mvolts, BatMonBus::bus_trans, BatMonBus::bus_voltage_mvolts, Electrical::current, BatMonBus::data, electrical, i2c_transceive(), I2CTransDone, i2c_transaction::status, BatMonBus::t_idx, TEMP_SENSORS_NB, and Electrical::vsupply.
|
static |
Definition at line 46 of file battery_monitor.c.
References BatMonBal::bat_cell_mvolts, batmonbal1, batmonbal2, batmonbus, BATTERY_CELLS_NB, BatMonBus::bus_current, BatMonBus::bus_current_mvolts, BatMonBus::bus_status, BatMonBus::bus_temp, BatMonBus::bus_tempsensors_mvolts, BatMonBal::bus_trans, BatMonBus::bus_trans, BatMonBus::bus_voltage_mvolts, dev, i2c_transaction::status, and TEMP_SENSORS_NB.
Referenced by battery_monitor_init().
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().
struct BatMonBal batmonbal1 |
Definition at line 35 of file battery_monitor.c.
Referenced by battery_monitor_event(), battery_monitor_init(), battery_monitor_read_balance_ports_1(), and send_batmon().
struct BatMonBal batmonbal2 |
Definition at line 36 of file battery_monitor.c.
Referenced by battery_monitor_event(), battery_monitor_init(), battery_monitor_read_balance_ports_2(), and send_batmon().
struct BatMonBus batmonbus |
Definition at line 34 of file battery_monitor.c.
Referenced by battery_monitor_event(), battery_monitor_init_bus(), battery_monitor_read_bus(), and send_batmon().