WeightI2C unit.
More...
#include <unit_WeightI2C.hpp>
|
bool | read_register (const uint8_t reg, uint8_t *buf, const size_t len) |
|
bool | read_register8 (const uint8_t reg, uint8_t &val) |
|
bool | start_periodic_measurement (const weighti2c::Mode mode, const uint32_t interval) |
|
bool | stop_periodic_measurement () |
|
bool | read_measurement (weighti2c::Data &d, const weighti2c::Mode m) |
|
bool | read_filter (uint8_t *buf3) |
|
bool | write_filter (const uint8_t *buf3) |
|
| M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitWeightI2C, weighti2c::Data) |
|
◆ changeI2CAddress()
bool m5::unit::UnitWeightI2C::changeI2CAddress |
( |
const uint8_t | i2c_address | ) |
|
Change unit I2C address.
- Parameters
-
- Returns
- True if successful
◆ enableLPFilter()
bool m5::unit::UnitWeightI2C::enableLPFilter |
( |
const bool | enable | ) |
|
Enable the Low-Pass Filter.
- Parameters
-
enable | True:enable False:disable |
- Returns
- True if successful
◆ isEnabledLPFilter()
bool m5::unit::UnitWeightI2C::isEnabledLPFilter |
( |
bool & | enabled | ) |
|
Is enabled the Low-Pass Filter?
- Parameters
-
[out] | enabled | True if enabled |
- Returns
- True if successful
◆ iweight()
int32_t m5::unit::UnitWeightI2C::iweight |
( |
| ) |
const |
|
inline |
Oldest measured weight (integer)
- Warning
- Depends on Mode
◆ measureSingleshot() [1/2]
bool m5::unit::UnitWeightI2C::measureSingleshot |
( |
char * | buf | ) |
|
Measurement single shot return as string.
- Parameters
-
- Returns
- True if successful
- Warning
- Buffer length must be at least 16 bytes
-
During periodic detection runs, an error is returned
◆ measureSingleshot() [2/2]
Measurement single shot.
- Parameters
-
[out] | data | Measuerd data |
| mode | Measurement mode |
- Warning
- During periodic detection runs, an error is returned
◆ readAvgFilterLevel()
bool m5::unit::UnitWeightI2C::readAvgFilterLevel |
( |
uint8_t & | level | ) |
|
Read the Averaging Filter level.
- Parameters
-
- Returns
- True if successful
◆ readEmaFilterAlpha()
bool m5::unit::UnitWeightI2C::readEmaFilterAlpha |
( |
uint8_t & | alpha | ) |
|
Read the Exponential Moving Average Filter alpha.
- Parameters
-
- Returns
- True if successful
◆ readGap()
bool m5::unit::UnitWeightI2C::readGap |
( |
float & | gap | ) |
|
Read the gap value.
- Parameters
-
- Returns
- True if successful
◆ readI2CAddress()
bool m5::unit::UnitWeightI2C::readI2CAddress |
( |
uint8_t & | i2c_address | ) |
|
Read the I2C address.
- Parameters
-
i2c_address[out] | I2C address |
- Returns
- True if successful
◆ readRawADC()
bool m5::unit::UnitWeightI2C::readRawADC |
( |
int32_t & | value | ) |
|
Read the Raw ADC.
- Parameters
-
- Returns
- True if successful
◆ resetOffset()
bool m5::unit::UnitWeightI2C::resetOffset |
( |
| ) |
|
Reset offset.
- Returns
- True if successful
◆ startPeriodicMeasurement()
bool m5::unit::UnitWeightI2C::startPeriodicMeasurement |
( |
const weighti2c::Mode | mode, |
|
|
const uint32_t | interval = 80 ) |
|
inline |
Start periodic measurement.
- Parameters
-
mode | Measurement mode |
interval | Measurement interval |
- Returns
- True if successful
◆ stopPeriodicMeasurement()
bool m5::unit::UnitWeightI2C::stopPeriodicMeasurement |
( |
| ) |
|
|
inline |
Stop periodic measurement.
- Returns
- True if successful
◆ weight()
float m5::unit::UnitWeightI2C::weight |
( |
| ) |
const |
|
inline |
Oldest measured weight (float)
- Warning
- Depends on Mode
◆ writeAvgFilterLevel()
bool m5::unit::UnitWeightI2C::writeAvgFilterLevel |
( |
const uint8_t | level | ) |
|
Write the Averaging Filter level.
- Parameters
-
- Returns
- True if successful
- Warning
- Valid values range from 0 to 50
◆ writeEmaFilterAlpha()
bool m5::unit::UnitWeightI2C::writeEmaFilterAlpha |
( |
const uint8_t | alpha | ) |
|
Write the Exponential Moving Average Filter alpha.
- Parameters
-
- Returns
- True if successful
- Warning
- Valid values range from 0 to 99
◆ writeGap()
bool m5::unit::UnitWeightI2C::writeGap |
( |
const float | gap, |
|
|
const uint32_t | duration = 100 ) |
Write the gap value.
- Parameters
-
gap | value @duration duration Max command duration(ms) |
- Returns
- True if successful