|
M5Unit-WEIGHT 0.1.1 git rev:97a7989
|
WeightI2C unit. More...
#include <unit_WeightI2C.hpp>
Classes | |
| struct | config_t |
| Settings for begin. More... | |
Public Member Functions | |
| UnitWeightI2C (const uint8_t addr=DEFAULT_ADDRESS) | |
| virtual bool | begin () override |
| Initialize the unit and apply the current configuration. | |
| virtual void | update (const bool force=false) override |
| Update the cached periodic measurement data. | |
| bool | resetOffset () |
| Reset offset. | |
| bool | readRawADC (int32_t &value) |
| Read the Raw ADC. | |
Settings for begin | |
| config_t | config () |
| Gets the configuration. | |
| void | config (const config_t &cfg) |
| Set the configuration. | |
Measurement data by periodic | |
| float | weight () const |
| Oldest measured weight (float) | |
| int32_t | iweight () const |
| Oldest measured weight (integer) | |
Periodic measurement | |
| bool | startPeriodicMeasurement (const weighti2c::Mode mode, const uint32_t interval=80) |
| Start periodic measurement. | |
| bool | stopPeriodicMeasurement () |
| Stop periodic measurement. | |
Single shot measurement | |
| bool | measureSingleshot (weighti2c::Data &data, const weighti2c::Mode mode) |
| Measurement single shot. | |
| bool | measureSingleshot (char *buf) |
| Measurement single shot return as string. | |
Setting gap to calibration | |
| bool | readGap (float &gap) |
| Read the gap value. | |
| bool | writeGap (const float gap, const uint32_t duration=100) |
| Write the gap value. | |
Filter | |
| bool | isEnabledLPFilter (bool &enabled) |
| Is enabled the Low-Pass Filter? | |
| bool | enableLPFilter (const bool enable) |
| Enable the Low-Pass Filter. | |
| bool | readAvgFilterLevel (uint8_t &level) |
| Read the Averaging Filter level. | |
| bool | writeAvgFilterLevel (const uint8_t level) |
| Write the Averaging Filter level. | |
| bool | readEmaFilterAlpha (uint8_t &alpha) |
| Read the Exponential Moving Average Filter alpha. | |
| bool | writeEmaFilterAlpha (const uint8_t alpha) |
| Write the Exponential Moving Average Filter alpha. | |
I2C Address | |
| |
| bool | readI2CAddress (uint8_t &i2c_address) |
| Read the I2C address. | |
| bool | changeI2CAddress (const uint8_t i2c_address) |
| Change unit I2C address. | |
Protected Member Functions | |
| 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) |
| M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitWeightI2C, weighti2c::Data) | |
Protected Attributes | |
| weighti2c::Mode | _mode {} |
| std::unique_ptr< m5::container::CircularBuffer< weighti2c::Data > > | _data {} |
| config_t | _cfg {} |
WeightI2C unit.
|
overridevirtual |
Initialize the unit and apply the current configuration.
| bool m5::unit::UnitWeightI2C::changeI2CAddress | ( | const uint8_t | i2c_address | ) |
Change unit I2C address.
| i2c_address | I2C address |
| bool m5::unit::UnitWeightI2C::enableLPFilter | ( | const bool | enable | ) |
Enable the Low-Pass Filter.
| enable | True:enable False:disable |
| bool m5::unit::UnitWeightI2C::isEnabledLPFilter | ( | bool & | enabled | ) |
Is enabled the Low-Pass Filter?
| [out] | enabled | True if enabled |
|
inline |
Oldest measured weight (integer)
weight() for Float mode. | bool m5::unit::UnitWeightI2C::measureSingleshot | ( | char * | buf | ) |
Measurement single shot return as string.
| [out] | buf | string buffer |
| bool m5::unit::UnitWeightI2C::measureSingleshot | ( | weighti2c::Data & | data, |
| const weighti2c::Mode | mode ) |
Measurement single shot.
| [out] | data | Measured data |
| mode | Measurement mode |
| bool m5::unit::UnitWeightI2C::readAvgFilterLevel | ( | uint8_t & | level | ) |
Read the Averaging Filter level.
| [out] | level | value |
| bool m5::unit::UnitWeightI2C::readEmaFilterAlpha | ( | uint8_t & | alpha | ) |
Read the Exponential Moving Average Filter alpha.
| [out] | alpha | value |
| bool m5::unit::UnitWeightI2C::readGap | ( | float & | gap | ) |
Read the gap value.
| [out] | gap | Calibration gap value in device-defined weight units |
| bool m5::unit::UnitWeightI2C::readI2CAddress | ( | uint8_t & | i2c_address | ) |
Read the I2C address.
| [out] | i2c_address | I2C address |
| bool m5::unit::UnitWeightI2C::readRawADC | ( | int32_t & | value | ) |
Read the Raw ADC.
| [out] | value | Raw ADC |
| bool m5::unit::UnitWeightI2C::resetOffset | ( | ) |
Reset offset.
|
inline |
Start periodic measurement.
| mode | Measurement mode |
| interval | Measurement interval |
|
inline |
Stop periodic measurement.
|
overridevirtual |
Update the cached periodic measurement data.
| force | Force the update even when the normal timing check would skip it |
Reimplemented in m5::unit::UnitMiniScales.
|
inline |
Oldest measured weight (float)
iweight() for Int mode. | bool m5::unit::UnitWeightI2C::writeAvgFilterLevel | ( | const uint8_t | level | ) |
Write the Averaging Filter level.
| level | value |
| bool m5::unit::UnitWeightI2C::writeEmaFilterAlpha | ( | const uint8_t | alpha | ) |
Write the Exponential Moving Average Filter alpha.
| alpha | value |
| bool m5::unit::UnitWeightI2C::writeGap | ( | const float | gap, |
| const uint32_t | duration = 100 ) |
Write the gap value.
| gap | Calibration gap value in device-defined weight units |
| duration | Max command duration(ms) |