PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Header for a battery monitor connected via SMBus (I2C). More...
#include <ecl/geo/geo.h>
#include <lib/drivers/smbus/SMBus.hpp>
#include <mathlib/mathlib.h>
#include <perf/perf_counter.h>
#include <px4_platform_common/module.h>
#include <px4_platform_common/getopt.h>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <uORB/topics/battery_status.h>
#include "board_config.h"
Go to the source code of this file.
Classes | |
struct | batt_smbus_bus_option |
class | BATT_SMBUS |
Macros | |
#define | DATA_BUFFER_SIZE 32 |
#define | BATT_CELL_VOLTAGE_THRESHOLD_RTL 0.5f |
Threshold in volts to RTL if cells are imbalanced. More... | |
#define | BATT_CELL_VOLTAGE_THRESHOLD_FAILED 1.5f |
Threshold in volts to Land if cells are imbalanced. More... | |
#define | BATT_CURRENT_UNDERVOLTAGE_THRESHOLD 5.0f |
Threshold in amps to disable undervoltage protection. More... | |
#define | BATT_VOLTAGE_UNDERVOLTAGE_THRESHOLD 3.4f |
Threshold in volts to re-enable undervoltage protection. More... | |
#define | BATT_SMBUS_ADDR 0x0B |
Default 7 bit address I2C address. 8 bit = 0x16. More... | |
#define | BATT_SMBUS_CURRENT 0x0A |
current register More... | |
#define | BATT_SMBUS_AVERAGE_CURRENT 0x0B |
current register More... | |
#define | BATT_SMBUS_TEMP 0x08 |
temperature register More... | |
#define | BATT_SMBUS_VOLTAGE 0x09 |
voltage register More... | |
#define | BATT_SMBUS_FULL_CHARGE_CAPACITY 0x10 |
capacity when fully charged More... | |
#define | BATT_SMBUS_RUN_TIME_TO_EMPTY 0x11 |
predicted remaining battery capacity based on the present rate of discharge in min More... | |
#define | BATT_SMBUS_AVERAGE_TIME_TO_EMPTY 0x12 |
predicted remaining battery capacity based on the present rate of discharge in min More... | |
#define | BATT_SMBUS_REMAINING_CAPACITY 0x0F |
predicted remaining battery capacity as a percentage More... | |
#define | BATT_SMBUS_CYCLE_COUNT 0x17 |
number of cycles the battery has experienced More... | |
#define | BATT_SMBUS_DESIGN_CAPACITY 0x18 |
design capacity register More... | |
#define | BATT_SMBUS_DESIGN_VOLTAGE 0x19 |
design voltage register More... | |
#define | BATT_SMBUS_MANUFACTURER_NAME 0x20 |
manufacturer name More... | |
#define | BATT_SMBUS_MANUFACTURE_DATE 0x1B |
manufacture date register More... | |
#define | BATT_SMBUS_SERIAL_NUMBER 0x1C |
serial number register More... | |
#define | BATT_SMBUS_MEASUREMENT_INTERVAL_US 100000 |
time in microseconds, measure at 10Hz More... | |
#define | BATT_SMBUS_MANUFACTURER_ACCESS 0x00 |
#define | BATT_SMBUS_MANUFACTURER_DATA 0x23 |
#define | BATT_SMBUS_MANUFACTURER_BLOCK_ACCESS 0x44 |
#define | BATT_SMBUS_SECURITY_KEYS 0x0035 |
#define | BATT_SMBUS_CELL_1_VOLTAGE 0x3F |
#define | BATT_SMBUS_CELL_2_VOLTAGE 0x3E |
#define | BATT_SMBUS_CELL_3_VOLTAGE 0x3D |
#define | BATT_SMBUS_CELL_4_VOLTAGE 0x3C |
#define | BATT_SMBUS_LIFETIME_FLUSH 0x002E |
#define | BATT_SMBUS_LIFETIME_BLOCK_ONE 0x0060 |
#define | BATT_SMBUS_ENABLED_PROTECTIONS_A_ADDRESS 0x4938 |
#define | BATT_SMBUS_SEAL 0x0030 |
#define | BATT_SMBUS_ENABLED_PROTECTIONS_A_DEFAULT 0xcf |
#define | BATT_SMBUS_ENABLED_PROTECTIONS_A_CUV_DISABLED 0xce |
#define | NUM_BUS_OPTIONS (sizeof(smbus_bus_options)/sizeof(smbus_bus_options[0])) |
Enumerations | |
enum | BATT_SMBUS_BUS { BATT_SMBUS_BUS_ALL = 0, BATT_SMBUS_BUS_I2C_INTERNAL, BATT_SMBUS_BUS_I2C_EXTERNAL, BATT_SMBUS_BUS_I2C_EXTERNAL1, BATT_SMBUS_BUS_I2C_EXTERNAL2 } |
Variables | |
struct batt_smbus_bus_option | smbus_bus_options [] |
Header for a battery monitor connected via SMBus (I2C).
Designed for BQ40Z50-R1/R2
Definition in file batt_smbus.h.
#define BATT_CELL_VOLTAGE_THRESHOLD_FAILED 1.5f |
Threshold in volts to Land if cells are imbalanced.
Definition at line 60 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_startup_info(), and BATT_SMBUS::Run().
#define BATT_CELL_VOLTAGE_THRESHOLD_RTL 0.5f |
Threshold in volts to RTL if cells are imbalanced.
Definition at line 59 of file batt_smbus.h.
#define BATT_CURRENT_UNDERVOLTAGE_THRESHOLD 5.0f |
Threshold in amps to disable undervoltage protection.
Definition at line 62 of file batt_smbus.h.
Referenced by BATT_SMBUS::set_undervoltage_protection().
#define BATT_SMBUS_ADDR 0x0B |
Default 7 bit address I2C address. 8 bit = 0x16.
Definition at line 65 of file batt_smbus.h.
#define BATT_SMBUS_AVERAGE_CURRENT 0x0B |
#define BATT_SMBUS_AVERAGE_TIME_TO_EMPTY 0x12 |
predicted remaining battery capacity based on the present rate of discharge in min
Definition at line 73 of file batt_smbus.h.
Referenced by BATT_SMBUS::Run().
#define BATT_SMBUS_CELL_1_VOLTAGE 0x3F |
Definition at line 86 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_cell_voltages().
#define BATT_SMBUS_CELL_2_VOLTAGE 0x3E |
Definition at line 87 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_cell_voltages().
#define BATT_SMBUS_CELL_3_VOLTAGE 0x3D |
Definition at line 88 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_cell_voltages().
#define BATT_SMBUS_CELL_4_VOLTAGE 0x3C |
Definition at line 89 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_cell_voltages().
#define BATT_SMBUS_CURRENT 0x0A |
#define BATT_SMBUS_CYCLE_COUNT 0x17 |
number of cycles the battery has experienced
Definition at line 75 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_startup_info().
#define BATT_SMBUS_DESIGN_CAPACITY 0x18 |
design capacity register
Definition at line 76 of file batt_smbus.h.
#define BATT_SMBUS_DESIGN_VOLTAGE 0x19 |
design voltage register
Definition at line 77 of file batt_smbus.h.
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_ADDRESS 0x4938 |
Definition at line 92 of file batt_smbus.h.
Referenced by BATT_SMBUS::set_undervoltage_protection().
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_CUV_DISABLED 0xce |
Definition at line 96 of file batt_smbus.h.
Referenced by BATT_SMBUS::set_undervoltage_protection().
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_DEFAULT 0xcf |
Definition at line 95 of file batt_smbus.h.
Referenced by BATT_SMBUS::set_undervoltage_protection().
#define BATT_SMBUS_FULL_CHARGE_CAPACITY 0x10 |
capacity when fully charged
Definition at line 71 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_startup_info().
#define BATT_SMBUS_LIFETIME_BLOCK_ONE 0x0060 |
Definition at line 91 of file batt_smbus.h.
Referenced by BATT_SMBUS::lifetime_read_block_one().
#define BATT_SMBUS_LIFETIME_FLUSH 0x002E |
Definition at line 90 of file batt_smbus.h.
Referenced by BATT_SMBUS::lifetime_data_flush().
#define BATT_SMBUS_MANUFACTURE_DATE 0x1B |
manufacture date register
Definition at line 79 of file batt_smbus.h.
Referenced by BATT_SMBUS::manufacture_date().
#define BATT_SMBUS_MANUFACTURER_ACCESS 0x00 |
Definition at line 82 of file batt_smbus.h.
Referenced by BATT_SMBUS::unseal().
#define BATT_SMBUS_MANUFACTURER_BLOCK_ACCESS 0x44 |
Definition at line 84 of file batt_smbus.h.
Referenced by BATT_SMBUS::dataflash_read(), BATT_SMBUS::dataflash_write(), BATT_SMBUS::manufacturer_read(), and BATT_SMBUS::manufacturer_write().
#define BATT_SMBUS_MANUFACTURER_DATA 0x23 |
Definition at line 83 of file batt_smbus.h.
#define BATT_SMBUS_MANUFACTURER_NAME 0x20 |
manufacturer name
Definition at line 78 of file batt_smbus.h.
Referenced by BATT_SMBUS::manufacturer_name().
#define BATT_SMBUS_MEASUREMENT_INTERVAL_US 100000 |
time in microseconds, measure at 10Hz
Definition at line 81 of file batt_smbus.h.
Referenced by BATT_SMBUS::resume(), and BATT_SMBUS::task_spawn().
#define BATT_SMBUS_REMAINING_CAPACITY 0x0F |
predicted remaining battery capacity as a percentage
Definition at line 74 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_startup_info(), and BATT_SMBUS::Run().
#define BATT_SMBUS_RUN_TIME_TO_EMPTY 0x11 |
predicted remaining battery capacity based on the present rate of discharge in min
Definition at line 72 of file batt_smbus.h.
Referenced by BATT_SMBUS::Run().
#define BATT_SMBUS_SEAL 0x0030 |
Definition at line 93 of file batt_smbus.h.
Referenced by BATT_SMBUS::seal().
#define BATT_SMBUS_SECURITY_KEYS 0x0035 |
Definition at line 85 of file batt_smbus.h.
#define BATT_SMBUS_SERIAL_NUMBER 0x1C |
serial number register
Definition at line 80 of file batt_smbus.h.
Referenced by BATT_SMBUS::get_serial_number(), and BATT_SMBUS::get_startup_info().
#define BATT_SMBUS_TEMP 0x08 |
#define BATT_SMBUS_VOLTAGE 0x09 |
#define BATT_VOLTAGE_UNDERVOLTAGE_THRESHOLD 3.4f |
Threshold in volts to re-enable undervoltage protection.
Definition at line 63 of file batt_smbus.h.
Referenced by BATT_SMBUS::set_undervoltage_protection().
#define DATA_BUFFER_SIZE 32 |
Definition at line 57 of file batt_smbus.h.
Referenced by BATT_SMBUS::dataflash_read(), BATT_SMBUS::dataflash_write(), and BATT_SMBUS::manufacturer_write().
#define NUM_BUS_OPTIONS (sizeof(smbus_bus_options)/sizeof(smbus_bus_options[0])) |
Definition at line 98 of file batt_smbus.h.
enum BATT_SMBUS_BUS |
Enumerator | |
---|---|
BATT_SMBUS_BUS_ALL | |
BATT_SMBUS_BUS_I2C_INTERNAL | |
BATT_SMBUS_BUS_I2C_EXTERNAL | |
BATT_SMBUS_BUS_I2C_EXTERNAL1 | |
BATT_SMBUS_BUS_I2C_EXTERNAL2 |
Definition at line 100 of file batt_smbus.h.
struct batt_smbus_bus_option smbus_bus_options[] |
Referenced by BATT_SMBUS::task_spawn().