#include <src/sensors/AtlasParent.h>
AtlasParent
class
A parent class for Atlas EZO circuits and sensors.
- Reference
- Detailed Descriptions
This contains the main I2C functionality for all Atlas EZO circuits.
Base classes
- class Sensor
- The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.
Derived classes
- class AtlasScientificCO2
- The Sensor sub-class for the Atlas Scientific gaseous CO2 and temperature sensor.
- class AtlasScientificDO
- The Sensor sub-class for the Atlas Scientific EZO dissolved oxygen circuit.
- class AtlasScientificEC
- The Sensor sub-class for the Atlas Scientific conductivity circuit and sensor.
- class AtlasScientificORP
- The Sensor sub-class for the Atlas Scientific ORP (oxidation/reduction potential) sensor.
- class AtlasScientificRTD
- The Sensor sub-class for the Atlas Scientific RTD temperature sensor.
- class AtlasScientificpH
- The Sensor sub-class for the Atlas Scientific pH sensor.
Constructors, destructors, conversion operators
- AtlasParent(TwoWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex, uint8_t measurementsToAverage = 1, const char* sensorName = "AtlasSensor", const uint8_t totalReturnedValues = 1, uint32_t warmUpTime_ms = 0, uint32_t stabilizationTime_ms = 0, uint32_t measurementTime_ms = 0, uint8_t incCalcValues = 0)
- Construct a new Atlas Parent object using a secondary hardware I2C instance.
- AtlasParent(int8_t powerPin, uint8_t i2cAddressHex, uint8_t measurementsToAverage = 1, const char* sensorName = "AtlasSensor", const uint8_t totalReturnedValues = 1, uint32_t warmUpTime_ms = 0, uint32_t stabilizationTime_ms = 0, uint32_t measurementTime_ms = 0, uint8_t incCalcValues = 0)
- Construct a new Atlas Parent object using the primary hardware I2C instance.
- ~AtlasParent() virtual
- Destroy the Atlas Parent object. Also destroy the software I2C instance if one was created.
Public functions
- String getSensorLocation(void) -> String override
- Return the I2C address of the EZO circuit.
- bool setup(void) -> bool override
- Do any one-time preparations needed before the sensor will be able to take readings.
- bool sleep(void) -> bool override
- Puts the sensor to sleep, if necessary.
- bool startSingleMeasurement(void) -> bool override
- Tell the sensor to start a single measurement, if needed.
- bool addSingleMeasurementResult(void) -> bool override
- Get the results from a single measurement.
Protected functions
- bool waitForProcessing(uint32_t timeout = 1000L) -> bool
- Wait for a command to process.
Protected variables
- int8_t _i2cAddressHex
- The I2C address of the Atlas circuit.
- TwoWire* _i2c
- An internal reference to the hardware Wire instance.
Function documentation
AtlasParent:: AtlasParent(TwoWire* theI2C,
int8_t powerPin,
uint8_t i2cAddressHex,
uint8_t measurementsToAverage = 1,
const char* sensorName = "AtlasSensor",
const uint8_t totalReturnedValues = 1,
uint32_t warmUpTime_ms = 0,
uint32_t stabilizationTime_ms = 0,
uint32_t measurementTime_ms = 0,
uint8_t incCalcValues = 0)
Construct a new Atlas Parent object using a secondary hardware I2C instance.
Parameters | |
---|---|
theI2C | A TwoWire instance for I2C communication. Due to the limitations of the Arduino core, only a hardware I2C instance can be used. For an AVR board, there is only one I2C instance possible and this form of the constructor should not be used. For a SAMD board, this can be used if a secondary I2C port is created on one of the extra SERCOMs. |
powerPin | The pin on the mcu controlling power to the Atlas circuit. Use -1 if it is continuously powered. |
i2cAddressHex | The I2C address of the Atlas circuit |
measurementsToAverage | The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1. |
sensorName | The name of the sensor, defaults to AtlasSensor. |
totalReturnedValues | The number of results returned by the sensor. Defaults to 1. |
warmUpTime_ms | The time needed from the when a sensor has power until it's ready to talk (_warmUpTime_ms). |
stabilizationTime_ms | The time needed from the when a sensor is activated until the readings are stable (_stabilizationTime_ms). |
measurementTime_ms | The time needed from the when a sensor is told to take a single reading until that reading is expected to be complete (_measurementTime_ms) |
incCalcValues | The number of included calculated variables from the sensor, if any. These are used for values that we would always calculate for a sensor and depend only on the raw results of that single sensor; optional with a default value of 0. |
AtlasParent:: AtlasParent(int8_t powerPin,
uint8_t i2cAddressHex,
uint8_t measurementsToAverage = 1,
const char* sensorName = "AtlasSensor",
const uint8_t totalReturnedValues = 1,
uint32_t warmUpTime_ms = 0,
uint32_t stabilizationTime_ms = 0,
uint32_t measurementTime_ms = 0,
uint8_t incCalcValues = 0)
Construct a new Atlas Parent object using the primary hardware I2C instance.
Parameters | |
---|---|
powerPin | The pin on the mcu controlling power to the Atlas circuit. Use -1 if it is continuously powered. |
i2cAddressHex | The I2C address of the Atlas circuit |
measurementsToAverage | The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1. |
sensorName | The name of the sensor, defaults to AtlasSensor. |
totalReturnedValues | The number of results returned by the sensor. Defaults to 1. |
warmUpTime_ms | The time needed from the when a sensor has power until it's ready to talk (_warmUpTime_ms). |
stabilizationTime_ms | The time needed from the when a sensor is activated until the readings are stable (_stabilizationTime_ms). |
measurementTime_ms | The time needed from the when a sensor is told to take a single reading until that reading is expected to be complete (_measurementTime_ms) |
incCalcValues | The number of included calculated variables from the sensor, if any. These are used for values that we would always calculate for a sensor and depend only on the raw results of that single sensor; optional with a default value of 0. |
String AtlasParent:: getSensorLocation(void) override
Return the I2C address of the EZO circuit.
Returns | String Text describing how the sensor is attached to the mcu. |
---|
bool AtlasParent:: setup(void) override
Do any one-time preparations needed before the sensor will be able to take readings.
Returns | bool True if the setup was successful. |
---|
This sets the _
bool AtlasParent:: sleep(void) override
Puts the sensor to sleep, if necessary.
Returns | bool True if the sleep function completed successfully. |
---|
This also un-sets the _
bool AtlasParent:: startSingleMeasurement(void) override
Tell the sensor to start a single measurement, if needed.
Returns | bool True if the start measurement function completed successfully. |
---|
This also sets the _
bool AtlasParent:: addSingleMeasurementResult(void) override
Get the results from a single measurement.
Returns | bool True if the function completed successfully. |
---|
This asks the sensor for a new result, verifies that it passes sanity range checks, and then adds the value to the result array.
This also un-sets the _
bool AtlasParent:: waitForProcessing(uint32_t timeout = 1000L) protected
Wait for a command to process.
Parameters | |
---|---|
timeout | The maximum amout of time to wait in ms. |
Returns | bool True processing completed and a status code was returned within the wait period. |
Most Atlas I2C commands have a 300ms processing time from the time the command is written until it is possible to request a response or result, except for the commands to take a calibration point or a reading which have a 600ms processing/response time.