upm  0.8.0
Sensor/Actuator repository for libmraa (v1.1.1)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 "upm/iLightSensor.hpp"
29 
30 
31 namespace upm {
32 
57 class SI1132 : public ILightSensor {
58  public:
65  SI1132 (int bus);
66 
70  ~SI1132 ();
71 
75  uint16_t getVisibleRaw();
76 
80  double getVisibleLux();
81 
82  const char* getModuleName() { return "si1132"; }
83 
84  private:
85  mraa::Result reset();
86  mraa::Result clearResponseRegister();
87  mraa::Result runCommand(uint8_t command);
88  mraa::Result readParam(uint8_t param, uint8_t* value);
89  mraa::Result writeParam(uint8_t param, uint8_t value);
90  void sleepMs(int mseconds);
91 
92  mraa::I2c* i2c;
93  mraa::Result status;
94 };
95 
96 }
double getVisibleLux()
Definition: si1132.cxx:148
const char * getModuleName()
Definition: si1132.hpp:82
API for Si1132 UV and Visible Light Sensor.
Definition: si1132.hpp:57
ILightSensor Interface for Light Sensors.
Definition: iLightSensor.hpp:46
uint16_t getVisibleRaw()
Definition: si1132.cxx:140
SI1132(int bus)
Definition: si1132.cxx:77
~SI1132()
Definition: si1132.cxx:87