2 * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
3 * Copyright (c) 2014 Intel Corporation.
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:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
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.
29 #define ADDR 0x4A // device address
32 #define ALSDATA_HIGH 0x04 // ambient sensor data high byte
33 #define ALSDATA_LOW 0x05 // ambient sensor data low byte
34 #define PRXDATA 0x15 // proximity sensor data
35 #define MCR 0x01 // Main Configuration Register
36 #define RCR 0x02 // Receive Configuration Register
37 #define TCR 0x03 // Transmit Configuration Register
45 * @brief C++ API for MAX44000 chip (Ambient and Infrared Proximity Sensor)
47 * This file defines the MAX44000 C++ interface for libmax44000
49 * @snippet proximity.cxx Interesting
51 * PMOD pins for MAX44000PMB1 board
65 * Instanciates a MAX44000 object
67 * @param bus number of used bus
68 * @param devAddr addres of used i2c device
70 MAX44000 (int bus, int devAddr);
73 * MAX44000 object destructor, basicaly it close i2c connection.
78 * Read the proximity value from the chip (based on ambient data).
80 uint16_t getProximity ();
82 * Read the ambient value from the chip (based on ambient data).
84 uint16_t getAmbient ();
87 * Return name of the component
94 uint16_t getALSData ();
95 uint16_t getPRXData ();
97 uint8_t i2cReadReg_8 (int reg);
98 uint16_t i2cReadReg_16 (int reg);
99 maa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
103 int m_maxControlAddr;
105 maa_i2c_context m_i2cMaxControlCtx;