|
PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Public Member Functions | |
| INA226 (int bus=INA226_BUS_DEFAULT, int address=INA226_BASEADDR) | |
| virtual | ~INA226 () |
| virtual int | init () |
| void | print_info () |
| Diagnostics - print some basic information about the driver. More... | |
Protected Member Functions | |
| virtual int | probe () |
Private Member Functions | |
| int | read (uint8_t address) |
| Test whetpower_monitorhe device supported by the driver is present at a specific address. More... | |
| int | write (uint8_t address, uint16_t data) |
| void | start () |
| Initialise the automatic measurement state machine and start it. More... | |
| void | stop () |
| Stop the automatic measurement state machine. More... | |
| void | Run () override |
| Perform a poll cycle; collect from the previous measurement and start a new one. More... | |
| int | measure () |
| int | collect () |
Private Attributes | |
| bool | _sensor_ok {false} |
| int | _measure_interval {0} |
| bool | _collect_phase {false} |
| orb_advert_t | _power_monitor_topic {nullptr} |
| perf_counter_t | _sample_perf |
| perf_counter_t | _comms_errors |
| int16_t | _bus_volatage {0} |
| int16_t | _power {-1} |
| int16_t | _current {-1} |
| int16_t | _shunt {0} |
| int16_t | _cal {0} |
| bool | _mode_trigged {false} |
| float | _max_current {MAX_CURRENT} |
| float | _rshunt {INA226_SHUNT} |
| uint16_t | _config {INA226_CONFIG} |
| float | _current_lsb {_max_current / DN_MAX} |
| float | _power_lsb {25.0f * _current_lsb} |
Definition at line 146 of file ina226.cpp.
| INA226::INA226 | ( | int | bus = INA226_BUS_DEFAULT, |
| int | address = INA226_BASEADDR |
||
| ) |
Definition at line 224 of file ina226.cpp.
References _config, _current_lsb, _max_current, _mode_trigged, _power_lsb, _rshunt, DN_MAX, INA226_CONFIG, INA226_MODE_MASK, INA226_MODE_SHIFTS, INA226_MODE_SHUNT_BUS_TRIG, INA226_SHUNT, MAX_CURRENT, param_find(), param_get(), and PARAM_INVALID.
Referenced by ina226::start_bus().
|
virtual |
Definition at line 262 of file ina226.cpp.
References _comms_errors, _sample_perf, perf_free(), and stop().
|
private |
Definition at line 377 of file ina226.cpp.
References _bus_volatage, _comms_errors, _current, _current_lsb, _power, _power_lsb, _power_monitor_topic, _sample_perf, _shunt, power_monitor_s::al, power_monitor_s::current_a, hrt_absolute_time(), INA226_REG_ALERTLIMIT, INA226_REG_BUSVOLTAGE, INA226_REG_CALIBRATION, INA226_REG_CONFIGURATION, INA226_REG_CURRENT, INA226_REG_MASKENABLE, INA226_REG_POWER, INA226_REG_SHUNTVOLTAGE, INA226_VSCALE, ll40ls::instance, power_monitor_s::me, OK, ORB_ID, ORB_PRIO_DEFAULT, orb_publish_auto(), perf_begin(), perf_count(), perf_end(), power_monitor_s::power_w, power_monitor_s::rbv, power_monitor_s::rc, power_monitor_s::rcal, power_monitor_s::rconf, read(), power_monitor_s::rp, power_monitor_s::rsv, power_monitor_s::timestamp, and power_monitor_s::voltage_v.
Referenced by Run().
|
virtual |
Definition at line 297 of file ina226.cpp.
References _cal, _config, _current_lsb, _mode_trigged, _sensor_ok, INA226_BASEADDR, INA226_CONST, INA226_REG_CALIBRATION, INA226_REG_CONFIGURATION, INA226_RST, INA226_SHUNT, ToneAlarmInterface::init(), OK, start(), and write().
Referenced by ina226::start_bus().
|
private |
Definition at line 360 of file ina226.cpp.
References _comms_errors, _config, _mode_trigged, INA226_REG_CONFIGURATION, OK, perf_count(), and write().
Referenced by Run().
| void INA226::print_info | ( | ) |
Diagnostics - print some basic information about the driver.
Definition at line 490 of file ina226.cpp.
References _comms_errors, _measure_interval, _sample_perf, and perf_print_counter().
Referenced by ina226::info().
|
protectedvirtual |
Definition at line 332 of file ina226.cpp.
References _comms_errors, INA226_MFG_DIE, INA226_MFG_DIEID, INA226_MFG_ID, INA226_MFG_ID_TI, OK, perf_count(), and read().
|
private |
Test whetpower_monitorhe device supported by the driver is present at a specific address.
| address | The I2C bus address to read or write. |
Definition at line 272 of file ina226.cpp.
References _comms_errors, data, OK, perf_count(), and swap16.
Referenced by collect(), and probe().
|
overrideprivate |
Perform a poll cycle; collect from the previous measurement and start a new one.
Definition at line 452 of file ina226.cpp.
References _collect_phase, _measure_interval, _mode_trigged, collect(), INA226_CONVERSION_INTERVAL, measure(), OK, and start().
|
private |
Initialise the automatic measurement state machine and start it.
Definition at line 432 of file ina226.cpp.
References _collect_phase, _measure_interval, and INA226_CONVERSION_INTERVAL.
Referenced by init(), and Run().
|
private |
Stop the automatic measurement state machine.
Definition at line 446 of file ina226.cpp.
Referenced by ~INA226().
|
private |
Definition at line 290 of file ina226.cpp.
References data.
Referenced by init(), and measure().
|
private |
Definition at line 172 of file ina226.cpp.
Referenced by collect().
|
private |
Definition at line 176 of file ina226.cpp.
Referenced by init().
|
private |
Definition at line 165 of file ina226.cpp.
|
private |
Definition at line 170 of file ina226.cpp.
Referenced by collect(), measure(), print_info(), probe(), read(), and ~INA226().
|
private |
Definition at line 181 of file ina226.cpp.
|
private |
Definition at line 174 of file ina226.cpp.
Referenced by collect().
|
private |
Definition at line 182 of file ina226.cpp.
|
private |
Definition at line 179 of file ina226.cpp.
Referenced by INA226().
|
private |
Definition at line 164 of file ina226.cpp.
Referenced by print_info(), Run(), and start().
|
private |
|
private |
Definition at line 173 of file ina226.cpp.
Referenced by collect().
|
private |
Definition at line 183 of file ina226.cpp.
|
private |
Definition at line 167 of file ina226.cpp.
Referenced by collect().
|
private |
Definition at line 180 of file ina226.cpp.
Referenced by INA226().
|
private |
Definition at line 169 of file ina226.cpp.
Referenced by collect(), print_info(), and ~INA226().
|
private |
Definition at line 163 of file ina226.cpp.
Referenced by init().
|
private |
Definition at line 175 of file ina226.cpp.
Referenced by collect().