max44000: Added new sensor module

Signed-off-by: Kiveisha Yevgeniy <yevgeniy.kiveisha@intel.com>
This commit is contained in:
Kiveisha Yevgeniy
2014-06-09 15:37:33 +00:00
parent fa1753f4ef
commit 38efe2d7a3
7 changed files with 293 additions and 0 deletions

View File

@ -12,6 +12,7 @@ add_executable (es08a es08a.cxx)
add_executable (son-hcsr04 hcsr04.cxx)
add_executable (oled-1308 oled-1308.cxx)
add_executable (oled-1327 oled-1327.cxx)
add_executable (proximity max44000.cxx)
include_directories (${PROJECT_SOURCE_DIR}/src/hmc5883l)
include_directories (${PROJECT_SOURCE_DIR}/src/grove)
@ -22,6 +23,7 @@ include_directories (${PROJECT_SOURCE_DIR}/src/4digitdisplay)
include_directories (${PROJECT_SOURCE_DIR}/src/nrf24l01)
include_directories (${PROJECT_SOURCE_DIR}/src/servo)
include_directories (${PROJECT_SOURCE_DIR}/src/hcsr04)
include_directories (${PROJECT_SOURCE_DIR}/src/max44000)
target_link_libraries (compass hmc5883l ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (groveled grove ${CMAKE_THREAD_LIBS_INIT})
@ -37,3 +39,4 @@ target_link_libraries (es08a servo ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (son-hcsr04 hcsr04 ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (oled-1308 i2clcd ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (oled-1327 i2clcd ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (proximity max44000 ${CMAKE_THREAD_LIBS_INIT})

42
examples/max44000.cxx Normal file
View File

@ -0,0 +1,42 @@
/*
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
* Copyright (c) 2014 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include "max44000.h"
int
main(int argc, char **argv)
{
//! [Interesting]
upm::MAX44000 *sensor = new upm::MAX44000(0, ADDR);
std::cout << "proximity value = " << sensor->getAmbient () << std::endl;
//! [Interesting]
std::cout << "exiting application" << std::endl;
delete sensor;
return 0;
}