upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
ms5803.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #pragma once
25 
26 #include <string>
27 
28 #include "ms5803.h"
29 
30 namespace upm {
31 
67  class MS5803 {
68  public:
69 
82  MS5803(int bus, int address=MS5803_DEFAULT_I2C_ADDR,
83  int csPin=-1);
84 
88  ~MS5803();
89 
94  void reset();
95 
102  void update();
103 
113  void setTemperatureOSR(MS5803_OSR_T osr);
114 
124  void setPressureOSR(MS5803_OSR_T osr);
125 
133  float getTemperature();
134 
142  float getPressure();
143 
144  protected:
145  ms5803_context m_ms5803;
146 
156  void loadCoefficients();
157 
168  std::string busRead(int cmd, int len);
169 
179  void busWrite(int cmd, std::string data);
180 
181  private:
182  /* Disable implicit copy and assignment operators */
183  MS5803(const MS5803&) = delete;
184  MS5803 &operator=(const MS5803&) = delete;
185  };
186 }
float getPressure()
Definition: ms5803.cxx:78
Definition: ms5803.h:52
~MS5803()
Definition: ms5803.cxx:43
void setPressureOSR(MS5803_OSR_T osr)
Definition: ms5803.cxx:67
void reset()
Definition: ms5803.cxx:55
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
void loadCoefficients()
Definition: ms5803.cxx:83
UPM API for the MS5803 Pressure and Temperature sensor.
Definition: ms5803.hpp:67
void busWrite(int cmd, std::string data)
Definition: ms5803.cxx:110
void update()
Definition: ms5803.cxx:48
std::string busRead(int cmd, int len)
Definition: ms5803.cxx:90
void setTemperatureOSR(MS5803_OSR_T osr)
Definition: ms5803.cxx:62
float getTemperature()
Definition: ms5803.cxx:73
MS5803(int bus, int address=MS5803_DEFAULT_I2C_ADDR, int csPin=-1)
Definition: ms5803.cxx:35