|
upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
UPM API for the MS5803 Pressure and Temperature sensor. More...
The MS5803-14BA is a new generation of high resolution pressure sensors with SPI and I2C bus interface. It is optimized for depth measurement systems with a water depth resolution of 1cm and below. The sensor module includes a high linear pressure sensor and an ultra low power 24 bit delta-sigma ADC with internal factory calibrated coefficients. It provides a precise digital 24 bit pressure and temperature value and different operation modes that allow the user to optimize for conversion speed and current consumption. A high resolution temperature output allows the implementation of a depth measurement systems and thermometer function without any additional sensor.
The device is driven at 3.3vdc, and has a pressure range of between 0 and 14 Bar, and a temperature range of between -40 and +85C.
Public Member Functions | |
| MS5803 (int bus, int address=MS5803_DEFAULT_I2C_ADDR, int csPin=-1) | |
| ~MS5803 () | |
| void | reset () |
| void | update () |
| void | setTemperatureOSR (MS5803_OSR_T osr) |
| void | setPressureOSR (MS5803_OSR_T osr) |
| float | getTemperature () |
| float | getPressure () |
Protected Member Functions | |
| void | loadCoefficients () |
| std::string | busRead (int cmd, int len) |
| void | busWrite (int cmd, std::string data) |
Protected Attributes | |
| ms5803_context | m_ms5803 |
| MS5803 | ( | int | bus, |
| int | address = MS5803_DEFAULT_I2C_ADDR, |
||
| int | csPin = -1 |
||
| ) |
MS5803 constructor. The default arguments inititialize I2C operation and the default I2C address.
| bus | i2c/spi bus to use |
| address | The address for this device if using I2C. If using SPI, supply -1 for this parameter. |
| csPin | The GPIO pin to use for Chip Select (CS). This is only needed for SPI, and only if your SPI implementation requires it. Otherwise, just pass -1 if not using SPI, or your CS is handled automatically by your SPI implementation. |
| void reset | ( | ) |
Reset the device.
| void update | ( | void | ) |
Take a measurement and store the current sensor values internally. This function must be called prior to retrieving any sensor values, for example getTemperature().
| void setTemperatureOSR | ( | MS5803_OSR_T | osr | ) |
Set the output sampling resolution of the temperature measurement. Higher values provide a more precise value. In addition, more precise values require more time to measure. The default set at device intialization is the highest precision supported: MS5803_OSR_4096
| osr | One of the MS5803_OSR_T values. |
| void setPressureOSR | ( | MS5803_OSR_T | osr | ) |
Set the output sampling resolution of the pressure measurement. Higher values provide a more precise value. In addition, more precise values require more time to measure. The default set at device intialization is the highest precision supported: MS5803_OSR_4096
| osr | One of the MS5803_OSR_T values. |
| float getTemperature | ( | void | ) |
Return the latest measured temperature. update() must have been called prior to calling this function. The returned value is in degrees Celsius.
| float getPressure | ( | ) |
Return the latest measured pressure. update() must have been called prior to calling this function. The returned value is in millibars.
|
protected |
Load a series of factory installed compensation coefficients. This function is called during ms5803_init(), so it should never need to be called again. It is provided here anyway "just in case".
| dev | Device context. |
|
protected |
Perform a bus read. This function is bus agnostic. It is exposed here for those users wishing to perform their own low level accesses. This is a low level function, and should not be used unless you know what you are doing.
| cmd | The command or register to access. |
| cnt | The number of bytes to read. |
|
protected |
Perform a bus write. This function is bus agnostic. It is exposed here for those users wishing to perform their own low level accesses. This is a low level function, and should not be used unless you know what you are doing.
| cmd | The command or register to access. |
| data | The string containing the data to write |

1.8.11