upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
si1132.hpp
1 /*
2  * Author: Henry Bruce <henry.bruce@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 #pragma once
25 
26 #include <string>
27 #include "mraa/i2c.hpp"
28 #include "interfaces/iLightSensor.hpp"
29 
30 
31 namespace upm {
32 
59 class SI1132 : public ILightSensor {
60  public:
66  SI1132 (int bus);
67 
71  ~SI1132 ();
72 
76  uint16_t getVisibleRaw();
77 
81  double getVisibleLux();
82 
83  virtual const char* getModuleName() { return "si1132"; }
84 
85  private:
86  /* Disable implicit copy and assignment operators */
87  SI1132(const SI1132&) = delete;
88  SI1132 &operator=(const SI1132&) = delete;
89 
90  mraa::Result reset();
91  mraa::Result clearResponseRegister();
92  mraa::Result runCommand(uint8_t command);
93  mraa::Result readParam(uint8_t param, uint8_t* value);
94  mraa::Result writeParam(uint8_t param, uint8_t value);
95  void sleepMs(int mseconds);
96 
97  mraa::I2c* i2c;
98  mraa::Result status;
99 };
100 
101 }
double getVisibleLux()
Definition: si1132.cxx:146
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
API for Si1132 UV and Visible Light Sensor.
Definition: si1132.hpp:59
ILightSensor Interface for Light Sensors.
Definition: iLightSensor.hpp:46
uint16_t getVisibleRaw()
Definition: si1132.cxx:138
SI1132(int bus)
Definition: si1132.cxx:77
virtual const char * getModuleName()
Definition: si1132.hpp:83
~SI1132()
Definition: si1132.cxx:87