|
@@ -0,0 +1,82 @@
|
|
1
|
+/*
|
|
2
|
+ * Author: Lay, Kuan Loon <kuan.loon.lay@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/iio.h>
|
|
28
|
+
|
|
29
|
+namespace upm
|
|
30
|
+{
|
|
31
|
+/**
|
|
32
|
+ * @brief APDS9930 Digital Proximity and Ambient Light Sensor library
|
|
33
|
+ * @defgroup apds9930 libupm-apds9930
|
|
34
|
+ * @ingroup Avago Technologies iio i2c proximity and ambient light sensor
|
|
35
|
+ */
|
|
36
|
+
|
|
37
|
+/**
|
|
38
|
+ * @library apds9930
|
|
39
|
+ * @sensor apds9930
|
|
40
|
+ * @comname APDS9930 Digital Proximity and Ambient Light Sensor
|
|
41
|
+ * @type light proximity
|
|
42
|
+ * @man Avago Technologies
|
|
43
|
+ * @con iio i2c
|
|
44
|
+ *
|
|
45
|
+ * @brief APDS9930 Digital Proximity and Ambient Light Sensor
|
|
46
|
+ *
|
|
47
|
+ * This sensor provides digital ambient light sensing (ALS),
|
|
48
|
+ * IR LED and a complete proximity detection system.
|
|
49
|
+ *
|
|
50
|
+ * @snippet apds9930.cxx Interesting
|
|
51
|
+ */
|
|
52
|
+
|
|
53
|
+class APDS9930
|
|
54
|
+{
|
|
55
|
+ public:
|
|
56
|
+ /**
|
|
57
|
+ * APDS-9930 digital proximity and ambient light sensor constructor
|
|
58
|
+ *
|
|
59
|
+ * @param iio device number
|
|
60
|
+ */
|
|
61
|
+ APDS9930(int device);
|
|
62
|
+ /**
|
|
63
|
+ * APDS9930 destructor
|
|
64
|
+ */
|
|
65
|
+ ~APDS9930();
|
|
66
|
+ /**
|
|
67
|
+ * Gets the ambient luminance value from the sensor
|
|
68
|
+ *
|
|
69
|
+ * @return Ambient Luminance value
|
|
70
|
+ */
|
|
71
|
+ int getAmbient();
|
|
72
|
+ /**
|
|
73
|
+ * Gets the proximity value from the sensor
|
|
74
|
+ *
|
|
75
|
+ * @return Proximity value
|
|
76
|
+ */
|
|
77
|
+ int getProximity();
|
|
78
|
+
|
|
79
|
+ private:
|
|
80
|
+ mraa_iio_context m_iio;
|
|
81
|
+};
|
|
82
|
+}
|