upm  1.6.0
Sensor/Actuator repository for libmraa (v1.9.0)
ims.hpp
1 /*
2  * Author: Noel Eck <noel.eck@intel.com>
3  * Copyright (c) 2015 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 
25 #pragma once
26 
27 #include "ims.h"
28 
29 namespace upm {
58 class IMS {
59  public:
69  IMS(int16_t i2c_bus, int16_t i2c_address = IMS_ADDRESS_DEFAULT);
70 
74  virtual ~IMS() {};
75 
82  void write(IMS_WR_COMMAND cmd, uint8_t wr_data);
83 
90  uint16_t read(IMS_RD_COMMAND cmd);
91 
97  uint16_t get_version();
98 
104  uint16_t get_moisture();
105 
116  uint16_t get_light();
117 
123  float get_temperature();
124 
129  void reset();
130 
136  void reset_i2c_address(uint8_t address_new);
137 
142  void sleep();
143  private:
144  /* device context struct */
145  ims_context* _dev;
146 };
147 }
API for the Catnip Electronics I2C moisture sensor.
Definition: ims.hpp:58
void sleep()
Definition: ims.cxx:106
void reset_i2c_address(uint8_t address_new)
Definition: ims.cxx:76
uint16_t read(IMS_RD_COMMAND cmd)
Definition: ims.cxx:90
C++ API for the kxtj3 driver.
Definition: a110x.hpp:29
uint16_t get_moisture()
Definition: ims.cxx:49
uint16_t get_version()
Definition: ims.cxx:40
void write(IMS_WR_COMMAND cmd, uint8_t wr_data)
Definition: ims.cxx:99
uint16_t get_light()
Definition: ims.cxx:58
void reset()
Definition: ims.cxx:83
C API for the Catnip Electronics I2C moisture sensor. This sensor must run at 100 kHz...
float get_temperature()
Definition: ims.cxx:67
IMS(int16_t i2c_bus, int16_t i2c_address=IMS_ADDRESS_DEFAULT)
Definition: ims.cxx:32
virtual ~IMS()
Definition: ims.hpp:74
Definition: ims.h:51