Compare commits

..

14 Commits

Author SHA1 Message Date
655ccee9af upm: v0.6.1
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-31 17:22:16 -07:00
102d86870a bme280: added missing return in non-void function
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-31 17:21:54 -07:00
a88ec4237d gfx: renamed GFX headers to avoid overlap on install
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-31 17:21:07 -07:00
cf2b8c9a6e ssd1351: Changed SPI to MODE0 for compatibilty and listed SPI PM issue in description
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-31 16:16:46 -07:00
68aa067f82 SWIG: Added include carrays_uint8_t.i for nrf24l01 python and js bindings
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2016-03-30 10:30:12 -07:00
24062f6a9d Java: Added examples for AM2315 and TSL2561
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2016-03-30 10:23:24 -07:00
db8d708798 cmake: node install path is now same for both package and .node
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-29 17:28:28 -07:00
edfdf6ec34 cmake: added include_directories(..) to python too, for consistency
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-29 17:08:12 -07:00
7c66d5c321 examples/c++: Fix syntax errors in ads1x15.cxx
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-29 16:59:38 -07:00
0e365590c4 cmake: Add parent directory to include path for UPM modules
This avoids using include files from a pre-existing UPM installation
as they can break the build if API changes are made.

Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-29 16:59:00 -07:00
ba127ec4d4 cmake: honor LIB_INSTALL_DIR and also for Node install path
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-28 17:51:54 -07:00
b6572e1f28 cmake: Add upm header files directory
Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-28 16:24:45 -07:00
02974f242e cmake: fix node modules install path when install prefix is given
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-28 16:22:49 -07:00
e809016152 cmake: added back PYTHON_VERSION_* when not building docs for install path
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-03-28 16:22:35 -07:00
32 changed files with 420 additions and 258 deletions

View File

@ -15,7 +15,12 @@ message (INFO " found mraa version: ${MRAA_VERSION}")
# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries")
# Older cmake might not pick CMAKE_INSTALL_LIBDIR right
if (CMAKE_INSTALL_LIBDIR)
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries")
else ()
set (LIB_INSTALL_DIR "lib" CACHE PATH "Installation path for libraries")
endif ()
# Set CMAKE_LIB_INSTALL_DIR if not defined
include(GNUInstallDirs)
@ -25,7 +30,7 @@ include (GetGitRevisionDescription)
git_describe (VERSION "--tags")
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_-128-NOTFOUND")
message (WARNING " - Install git to compile a production UPM!")
set (VERSION "v0.6.0-dirty")
set (VERSION "v0.6.1-dirty")
endif ()
message (INFO " - UPM Version ${VERSION}")
@ -126,7 +131,6 @@ if (BUILDDOC)
string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
set (SITE_PACKAGES ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/pydoc/conf.py @ONLY)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst COPYONLY)
add_custom_target (pydoc ALL

View File

@ -4,6 +4,15 @@ Changelog {#changelog}
Here's a list summarizing some of the key undergoing changes to our library
from earlier versions:
### v0.6.1
* Fixed library build process for different configurations across multiple
environments reported by users.
* Fixed multiple GFX library header clash and improved SSD1351 compatibility
by changing SPI mode
* Added Node and Python array typemaps for nrf24l01
* Added 2 new JAVA examples
### v0.6.0
* Introduced C++ Interfaces for several sensor categories that will help

View File

@ -286,7 +286,7 @@ int main()
else ads->setCompMode();
break;
case 18:
cout << ads->getCompLatch() << cout;
cout << ads->getCompLatch() << endl;
break;
case 19:
cout << "select one of the following:" << endl;
@ -296,7 +296,7 @@ int main()
else ads->setCompLatch();
break;
case 20:
cout << ads->getContinuous() << cout;
cout << ads->getContinuous() << endl;
break;
case 21:
cout << "select one of the following:" << endl;

View File

@ -0,0 +1,66 @@
/*
* Author: Abhishek Malik <abhishek.malik@intel.com>
* Copyright (c) 2016 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.
*/
import upm_am2315.AM2315;
public class AM2315Example {
static {
try {
System.loadLibrary("javaupm_am2315");
System.loadLibrary("mraajava");
} catch (UnsatisfiedLinkError e) {
System.err.println(
"Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
e);
System.exit(1);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
//! [Interesting]
float humidity = 0;
float temperature = 0;
// Instantiate the sensor
AM2315 sensor = new AM2315(0, upm_am2315.javaupm_am2315Constants.AM2315_I2C_ADDRESS);
sensor.testSensor();
while(true){
// retrieving the humidity and temperature values
humidity = sensor.getHumidity();
temperature = sensor.getTemperature();
System.out.println("Temperature : "+temperature+" Humidity: "+humidity);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
System.out.println("The following exception occured: "+e.getMessage());
}
}
//! [Interesting]
}
}

View File

@ -110,6 +110,8 @@ add_example(TEAMS_Example teams)
add_example(APA102Sample apa102)
add_example(TEX00_Example tex00)
add_example(BMI160_Example bmi160)
add_example(Tsl2561 tsl2561)
add_example(AM2315Example am2315)
if (MODBUS_FOUND)
add_example(H803X_Example h803x)
endif()

View File

@ -0,0 +1,61 @@
/*
* Author: Abhishek Malik <abhishek.malik@intel.com>
* Copyright (c) 2016 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.
*/
import upm_tsl2561.TSL2561;
public class Tsl2561 {
static {
try {
System.loadLibrary("javaupm_tsl2561");
System.loadLibrary("mraajava");
} catch (UnsatisfiedLinkError e) {
System.err.println(
"Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
e);
System.exit(1);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
//! [Interesting]
TSL2561 sensor = null;
int loopCount = 100;
// Instantiate the sensor object
sensor = new TSL2561();
for (int i=0; i<loopCount; i++){
// retrieving and displaying the Lux value
System.out.println("Lux: "+sensor.getLux());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
System.out.println("The following exception occured: "+e.getMessage());
}
}
//! [Interesting]
}
}

View File

@ -28,7 +28,11 @@ endmacro (upm_CREATE_INSTALL_PKGCONFIG)
macro(upm_SWIG_PYTHON)
if (BUILDSWIGPYTHON AND BUILDSWIG)
include_directories (
${CMAKE_CURRENT_SOURCE_DIR}/..
)
set_source_files_properties (pyupm_${libname}.i PROPERTIES CPLUSPLUS ON)
set_source_files_properties (pyupm_${libname}.i PROPERTIES SWIG_FLAGS "-I${CMAKE_CURRENT_BINARY_DIR}/..")
swig_add_module (pyupm_${libname} python pyupm_${libname}.i ${module_src})
@ -40,7 +44,7 @@ macro(upm_SWIG_PYTHON)
)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_pyupm_${libname}.so
${CMAKE_CURRENT_BINARY_DIR}/pyupm_${libname}.py
DESTINATION ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/
DESTINATION ${LIB_INSTALL_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/
COMPONENT ${libname})
endif()
endmacro()
@ -57,8 +61,10 @@ macro(upm_SWIG_NODE)
set (V8_VERSION_HEX "${V8_VERSION_HEX}0")
string (LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_length)
endwhile ()
# include_directories (${NODE_INCLUDE_DIRS})
include_directories (
${CMAKE_CURRENT_SOURCE_DIR}/..
)
set_property (SOURCE jsupm_${libname}.i PROPERTY SWIG_FLAGS "-node" "-DV8_VERSION=${V8_VERSION_HEX}")
set_source_files_properties (jsupm_${libname}.i PROPERTIES CPLUSPLUS ON)
@ -80,7 +86,7 @@ macro(upm_SWIG_NODE)
message(FATAL_ERROR " **ERROR** GCC 4.7 or above is required to compile jsupm_${libname} ")
endif()
endif()
if (NOT ENABLECXX11)
set_property (TARGET jsupm_${libname} PROPERTY CXX_STANDARD 11)
set_property (TARGET jsupm_${libname} PROPERTY CXX_STANDARD_REQUIRED ON)
@ -100,7 +106,6 @@ macro(upm_SWIG_NODE)
endif()
createpackagejson(${libname})
set (NODE_MODULE_INSTALL_PATH ${NODE_ROOT_DIR}/lib/node_modules/jsupm_${libname}/)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}.node
DESTINATION ${NODE_MODULE_INSTALL_PATH} COMPONENT ${libname})
endif()
@ -132,8 +137,8 @@ macro(upm_SWIG_JAVA)
PREFIX "lib"
SUFFIX ".so"
)
install (TARGETS javaupm_${libname} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/upm_${libname}.jar DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java)
install (TARGETS javaupm_${libname} LIBRARY DESTINATION ${LIB_INSTALL_DIR})
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/upm_${libname}.jar DESTINATION ${LIB_INSTALL_DIR}/../lib/java)
if (NOT DEFINED $ENV{JAVA_HOME_NATIVE})
set (JAVAC $ENV{JAVA_HOME}/bin/javac)
@ -174,8 +179,11 @@ if (SWIG_FOUND)
if (BUILDSWIGPYTHON)
if(NOT PYTHONLIBS_FOUND)
find_package (PythonLibs ${PYTHONBUILD_VERSION} REQUIRED)
string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
endif()
endif()
endif(BUILDSWIGPYTHON)
if (BUILDSWIGNODE)
if(NOT NODE_FOUND)
find_package(Node)
@ -191,14 +199,20 @@ if (SWIG_FOUND)
${NODE_ROOT_DIR}/include/deps/uv/include
)
macro(createpackagejson)
configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY)
set (NODE_MODULE_INSTALL_PATH ${NODE_ROOT_DIR}/lib/node_modules/jsupm_${libname}/)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/package.json
DESTINATION ${NODE_MODULE_INSTALL_PATH} COMPONENT ${libname})
configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY)
# If a CMAKE_INSTALL_PREFIX has NOT been provided, set NODE_MODULE_INSTALL_PATH
# base on the NODE_ROOT_DIR.
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (NODE_MODULE_INSTALL_PATH ${NODE_ROOT_DIR}/${LIB_INSTALL_DIR}/node_modules/jsupm_${libname}/)
# If a CMAKE_INSTALL_PREFIX has been provided, set NODE_MODULE_INSTALL_PATH
# relative to the provided install directory.
else ()
set (NODE_MODULE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/node_modules/jsupm_${libname}/)
endif ()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/package.json
DESTINATION ${NODE_MODULE_INSTALL_PATH} COMPONENT ${libname})
endmacro()
endif(BUILDSWIGNODE)
endif()
macro(upm_module_init)
@ -207,7 +221,7 @@ macro(upm_module_init)
foreach (linkflag ${ARGN})
target_link_libraries (${libname} ${linkflag})
endforeach ()
include_directories (${MRAA_INCLUDE_DIRS} .)
include_directories (${MRAA_INCLUDE_DIRS} . ..)
target_link_libraries (${libname} ${MRAA_LIBRARIES})
set_target_properties(
${libname}
@ -215,7 +229,7 @@ macro(upm_module_init)
SOVERSION ${upm_VERSION_MAJOR}
VERSION ${upm_VERSION_STRING}
)
upm_create_install_pkgconfig (upm-${libname}.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
upm_create_install_pkgconfig (upm-${libname}.pc ${LIB_INSTALL_DIR}/pkgconfig)
if (SWIG_FOUND)
if (NOT ";${PYTHONSWIG_BLACKLIST};" MATCHES ";${libname};")
upm_swig_python()
@ -230,7 +244,7 @@ macro(upm_module_init)
if (BUILDDOC)
upm_doxygen()
endif()
install(TARGETS ${libname} DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${libname} DESTINATION ${LIB_INSTALL_DIR})
install (FILES ${module_h} DESTINATION include/upm COMPONENT ${libname})
if (IPK)

View File

@ -31,7 +31,7 @@
#include "bme280.h"
#include "bme280driver.h"
/************** I2C buffer length ******/
#define I2C_BUFFER_LEN 26
#define I2C_BUFFER_LEN 26
@ -41,13 +41,13 @@ using namespace upm;
/*----------------------------------------------------------------------------*
* struct bme280_t parameters can be accessed by using bme280
* bme280_t having the following parameters
* Bus write function pointer: BME280_WR_FUNC_PTR
Bus read function pointer: BME280_RD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
* Chip id of the sensor: chip_id
* struct bme280_t parameters can be accessed by using bme280
* bme280_t having the following parameters
* Bus write function pointer: BME280_WR_FUNC_PTR
Bus read function pointer: BME280_RD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
* Chip id of the sensor: chip_id
*---------------------------------------------------------------------------*/
struct bme280_t bme280;
@ -57,23 +57,23 @@ mraa::I2c* BME280::m_i2c = NULL;
int BME280::m_bus = 0;
BME280::BME280 (int bus, int devAddr) {
m_bus = bus;
if( m_i2c == NULL)
{
m_i2c = new mraa::I2c(m_bus);
m_i2c->address(BME280_I2C_ADDRESS1);
//Based on the requirement, configure I2C interface.
I2C_routine();
/*--------------------------------------------------------------------------*
* This function used to assign the value/reference of
* the following parameters
* I2C address
* Bus Write
* Bus read
* Chip id
*-------------------------------------------------------------------------*/
bme280_init(&bme280);
}
m_bus = bus;
if( m_i2c == NULL)
{
m_i2c = new mraa::I2c(m_bus);
m_i2c->address(BME280_I2C_ADDRESS1);
//Based on the requirement, configure I2C interface.
I2C_routine();
/*--------------------------------------------------------------------------*
* This function used to assign the value/reference of
* the following parameters
* I2C address
* Bus Write
* Bus read
* Chip id
*-------------------------------------------------------------------------*/
bme280_init(&bme280);
}
}
BME280::~BME280() {
@ -81,21 +81,21 @@ BME280::~BME280() {
}
/* This function is an example for reading sensor temperature
* \param: None
* \return: compensated temperature
* \param: None
* \return: compensated temperature
*/
int32_t BME280::getTemperatureInternal(void)
{
/* The variable used to read uncompensated temperature*/
int32_t v_data_uncomp_tem_int32 = getTemperatureRawInternal();
/* The variable used to read uncompensated temperature*/
int32_t v_data_uncomp_tem_int32 = getTemperatureRawInternal();
/*------------------------------------------------------------------*
************ START READ TRUE PRESSURE, TEMPERATURE AND HUMIDITY DATA ********
*---------------------------------------------------------------------*/
/* API is used to read the true temperature*/
/* Input value as uncompensated temperature and output format*/
int32_t v_actual_temp_int32 = bme280_compensate_temperature_int32(v_data_uncomp_tem_int32);
/* API is used to read the true temperature*/
/* Input value as uncompensated temperature and output format*/
int32_t v_actual_temp_int32 = bme280_compensate_temperature_int32(v_data_uncomp_tem_int32);
/*--------------------------------------------------------------------*
************ END READ TRUE TEMPERATURE ********
*-------------------------------------------------------------------------*/
@ -104,22 +104,22 @@ return v_actual_temp_int32;
}
/* This function is an example for reading sensor pressure
* \param: None
* \return: compensated pressure
* \param: None
* \return: compensated pressure
*/
int32_t BME280::getPressureInternal(void)
{
/* The variable used to read uncompensated pressure*/
int32_t v_data_uncomp_pres_int32 = getPressureRawInternal();
/* The variable used to read uncompensated pressure*/
int32_t v_data_uncomp_pres_int32 = getPressureRawInternal();
/*------------------------------------------------------------------*
************ START READ TRUE PRESSURE DATA ********
*---------------------------------------------------------------------*/
/* API is used to read the true pressure*/
/* Input value as uncompensated pressure */
uint32_t v_actual_press_uint32 = bme280_compensate_pressure_int32(v_data_uncomp_pres_int32);
/* API is used to read the true pressure*/
/* Input value as uncompensated pressure */
uint32_t v_actual_press_uint32 = bme280_compensate_pressure_int32(v_data_uncomp_pres_int32);
/*--------------------------------------------------------------------*
************ END READ TRUE PRESSURE ********
@ -130,21 +130,21 @@ return v_actual_press_uint32;
/* This function is an example for reading sensor humidity
* \param: None
* \return: compensated humidity
* \param: None
* \return: compensated humidity
*/
int32_t BME280::getHumidityInternal(void)
{
/* The variable used to read uncompensated pressure*/
int32_t v_data_uncomp_hum_int32 = getHumidityRawInternal();
/* The variable used to read uncompensated pressure*/
int32_t v_data_uncomp_hum_int32 = getHumidityRawInternal();
/*------------------------------------------------------------------*
************ START READ TRUE HUMIDITY DATA ********
*---------------------------------------------------------------------*/
/* API is used to read the true humidity*/
/* Input value as uncompensated humidity and output format*/
uint32_t v_actual_humity_uint32 = bme280_compensate_humidity_int32(v_data_uncomp_hum_int32);
/* API is used to read the true humidity*/
/* Input value as uncompensated humidity and output format*/
uint32_t v_actual_humity_uint32 = bme280_compensate_humidity_int32(v_data_uncomp_hum_int32);
/*--------------------------------------------------------------------*
************ END READ TRUE HUMIDITY ********
@ -156,37 +156,37 @@ return v_actual_humity_uint32;
/* This function is an example for reading sensor temperature
* \param: None
* \return: uncompensated temperature
* \param: None
* \return: uncompensated temperature
*/
int32_t BME280::getTemperatureRawInternal(void)
{
/* The variable used to read uncompensated temperature*/
int32_t v_data_uncomp_tem_int32 = BME280_INIT_VALUE;
/* The variable used to read uncompensated temperature*/
int32_t v_data_uncomp_tem_int32 = BME280_INIT_VALUE;
/* For initialization it is required to set the mode of
* the sensor as "NORMAL"
* data acquisition/read/write is possible in this mode
* by using the below API able to set the power mode as NORMAL*/
/* Set the power mode as NORMAL*/
bme280_set_power_mode(BME280_NORMAL_MODE);
/* For reading the temperature data it is required to
* set the OSS setting of temperature
* In the code automated reading and writing of "BME280_CTRLHUM_REG_OSRSH"
* register first set the "BME280_CTRLHUM_REG_OSRSH" and then read and write
* the "BME280_CTRLMEAS_REG" register in the function*/
/* For initialization it is required to set the mode of
* the sensor as "NORMAL"
* data acquisition/read/write is possible in this mode
* by using the below API able to set the power mode as NORMAL*/
/* Set the power mode as NORMAL*/
bme280_set_power_mode(BME280_NORMAL_MODE);
/* For reading the temperature data it is required to
* set the OSS setting of temperature
* In the code automated reading and writing of "BME280_CTRLHUM_REG_OSRSH"
* register first set the "BME280_CTRLHUM_REG_OSRSH" and then read and write
* the "BME280_CTRLMEAS_REG" register in the function*/
/* set the temperature oversampling*/
bme280_set_oversamp_temperature(BME280_OVERSAMP_4X);
/* set the temperature oversampling*/
bme280_set_oversamp_temperature(BME280_OVERSAMP_4X);
/************************* END INITIALIZATION *************************/
/*------------------------------------------------------------------*
************ START READ UNCOMPENSATED TEMPERATURE DATA ********
*---------------------------------------------------------------------*/
/* API is used to read the uncompensated temperature*/
bme280_read_uncomp_temperature(&v_data_uncomp_tem_int32);
/* API is used to read the uncompensated temperature*/
bme280_read_uncomp_temperature(&v_data_uncomp_tem_int32);
/*--------------------------------------------------------------------*
@ -196,14 +196,14 @@ int32_t BME280::getTemperatureRawInternal(void)
/*-----------------------------------------------------------------------*
************************* START DE-INITIALIZATION ***********************
*-------------------------------------------------------------------------*/
/* For de-initialization it is required to set the mode of
* the sensor as "SLEEP"
* the device reaches the lowest power consumption only
* In SLEEP mode no measurements are performed
* All registers are accessible
* by using the below API able to set the power mode as SLEEP*/
/* Set the power mode as SLEEP*/
bme280_set_power_mode(BME280_SLEEP_MODE);
/* For de-initialization it is required to set the mode of
* the sensor as "SLEEP"
* the device reaches the lowest power consumption only
* In SLEEP mode no measurements are performed
* All registers are accessible
* by using the below API able to set the power mode as SLEEP*/
/* Set the power mode as SLEEP*/
bme280_set_power_mode(BME280_SLEEP_MODE);
/*---------------------------------------------------------------------*
************************* END DE-INITIALIZATION **********************
*---------------------------------------------------------------------*/
@ -211,34 +211,34 @@ return v_data_uncomp_tem_int32;
}
/* This function is an example for reading sensor pressure
* \param: None
* \return: uncompensated pressure
* \param: None
* \return: uncompensated pressure
*/
int32_t BME280::getPressureRawInternal(void)
{
/* The variable used to read uncompensated pressure*/
int32_t v_data_uncomp_pres_int32 = BME280_INIT_VALUE;
/* The variable used to read uncompensated pressure*/
int32_t v_data_uncomp_pres_int32 = BME280_INIT_VALUE;
/* For initialization it is required to set the mode of
* the sensor as "NORMAL"
* data acquisition/read/write is possible in this mode
* by using the below API able to set the power mode as NORMAL*/
/* Set the power mode as NORMAL*/
bme280_set_power_mode(BME280_NORMAL_MODE);
/* For reading the pressure data it is required to
* set the OSS setting of humidity, pressure and temperature
* The "BME280_CTRLHUM_REG_OSRSH" register sets the humidity
* data acquisition options of the device.
* changes to this registers only become effective after a write operation to
* "BME280_CTRLMEAS_REG" register.
* In the code automated reading and writing of "BME280_CTRLHUM_REG_OSRSH"
* register first set the "BME280_CTRLHUM_REG_OSRSH" and then read and write
* the "BME280_CTRLMEAS_REG" register in the function*/
/* For initialization it is required to set the mode of
* the sensor as "NORMAL"
* data acquisition/read/write is possible in this mode
* by using the below API able to set the power mode as NORMAL*/
/* Set the power mode as NORMAL*/
bme280_set_power_mode(BME280_NORMAL_MODE);
/* For reading the pressure data it is required to
* set the OSS setting of humidity, pressure and temperature
* The "BME280_CTRLHUM_REG_OSRSH" register sets the humidity
* data acquisition options of the device.
* changes to this registers only become effective after a write operation to
* "BME280_CTRLMEAS_REG" register.
* In the code automated reading and writing of "BME280_CTRLHUM_REG_OSRSH"
* register first set the "BME280_CTRLHUM_REG_OSRSH" and then read and write
* the "BME280_CTRLMEAS_REG" register in the function*/
/* set the pressure oversampling*/
bme280_set_oversamp_pressure(BME280_OVERSAMP_2X);
/* set the pressure oversampling*/
bme280_set_oversamp_pressure(BME280_OVERSAMP_2X);
/************************* END INITIALIZATION *************************/
@ -246,8 +246,8 @@ int32_t BME280::getPressureRawInternal(void)
************ START READ UNCOMPENSATED PRESSURE DATA ********
*---------------------------------------------------------------------*/
/* API is used to read the uncompensated pressure*/
bme280_read_uncomp_pressure(&v_data_uncomp_pres_int32);
/* API is used to read the uncompensated pressure*/
bme280_read_uncomp_pressure(&v_data_uncomp_pres_int32);
/*--------------------------------------------------------------------*
************ END READ UNCOMPENSATED PRESSURE ********
@ -257,14 +257,14 @@ int32_t BME280::getPressureRawInternal(void)
/*-----------------------------------------------------------------------*
************************* START DE-INITIALIZATION ***********************
*-------------------------------------------------------------------------*/
/* For de-initialization it is required to set the mode of
* the sensor as "SLEEP"
* the device reaches the lowest power consumption only
* In SLEEP mode no measurements are performed
* All registers are accessible
* by using the below API able to set the power mode as SLEEP*/
/* Set the power mode as SLEEP*/
bme280_set_power_mode(BME280_SLEEP_MODE);
/* For de-initialization it is required to set the mode of
* the sensor as "SLEEP"
* the device reaches the lowest power consumption only
* In SLEEP mode no measurements are performed
* All registers are accessible
* by using the below API able to set the power mode as SLEEP*/
/* Set the power mode as SLEEP*/
bme280_set_power_mode(BME280_SLEEP_MODE);
/*---------------------------------------------------------------------*
************************* END DE-INITIALIZATION **********************
*---------------------------------------------------------------------*/
@ -273,31 +273,31 @@ return v_data_uncomp_pres_int32;
/* This function is an example for reading sensor humidity
* \param: None
* \return: uncompensated humidity
* \param: None
* \return: uncompensated humidity
*/
int32_t BME280::getHumidityRawInternal(void)
{
/* The variable used to read uncompensated pressure*/
int32_t v_data_uncomp_hum_int32 = BME280_INIT_VALUE;
/* The variable used to read uncompensated pressure*/
int32_t v_data_uncomp_hum_int32 = BME280_INIT_VALUE;
/* For initialization it is required to set the mode of
* the sensor as "NORMAL"
* data acquisition/read/write is possible in this mode
* by using the below API able to set the power mode as NORMAL*/
/* Set the power mode as NORMAL*/
bme280_set_power_mode(BME280_NORMAL_MODE);
/* For reading humidity data it is required to
* set the OSS setting of humidity
* The "BME280_CTRLHUM_REG_OSRSH" register sets the humidity
* data acquisition options of the device.
* changes to this registers only become effective after a write operation to
* "BME280_CTRLMEAS_REG" register.
* In the code automated reading and writing of "BME280_CTRLHUM_REG_OSRSH"
* register first set the "BME280_CTRLHUM_REG_OSRSH" and then read and write
* the "BME280_CTRLMEAS_REG" register in the function*/
bme280_set_oversamp_humidity(BME280_OVERSAMP_1X);
/* For initialization it is required to set the mode of
* the sensor as "NORMAL"
* data acquisition/read/write is possible in this mode
* by using the below API able to set the power mode as NORMAL*/
/* Set the power mode as NORMAL*/
bme280_set_power_mode(BME280_NORMAL_MODE);
/* For reading humidity data it is required to
* set the OSS setting of humidity
* The "BME280_CTRLHUM_REG_OSRSH" register sets the humidity
* data acquisition options of the device.
* changes to this registers only become effective after a write operation to
* "BME280_CTRLMEAS_REG" register.
* In the code automated reading and writing of "BME280_CTRLHUM_REG_OSRSH"
* register first set the "BME280_CTRLHUM_REG_OSRSH" and then read and write
* the "BME280_CTRLMEAS_REG" register in the function*/
bme280_set_oversamp_humidity(BME280_OVERSAMP_1X);
/************************* END INITIALIZATION *************************/
@ -305,7 +305,7 @@ int32_t BME280::getHumidityRawInternal(void)
/*------------------------------------------------------------------*
************ START READ HUMIDITY DATA ********
*---------------------------------------------------------------------*/
/* API is used to read the uncompensated humidity*/
/* API is used to read the uncompensated humidity*/
bme280_read_uncomp_humidity(&v_data_uncomp_hum_int32);
/*--------------------------------------------------------------------*
@ -316,14 +316,14 @@ int32_t BME280::getHumidityRawInternal(void)
/*-----------------------------------------------------------------------*
************************* START DE-INITIALIZATION ***********************
*-------------------------------------------------------------------------*/
/* For de-initialization it is required to set the mode of
* the sensor as "SLEEP"
* the device reaches the lowest power consumption only
* In SLEEP mode no measurements are performed
* All registers are accessible
* by using the below API able to set the power mode as SLEEP*/
/* Set the power mode as SLEEP*/
bme280_set_power_mode(BME280_SLEEP_MODE);
/* For de-initialization it is required to set the mode of
* the sensor as "SLEEP"
* the device reaches the lowest power consumption only
* In SLEEP mode no measurements are performed
* All registers are accessible
* by using the below API able to set the power mode as SLEEP*/
/* Set the power mode as SLEEP*/
bme280_set_power_mode(BME280_SLEEP_MODE);
/*---------------------------------------------------------------------*
************************* END DE-INITIALIZATION **********************
*---------------------------------------------------------------------*/
@ -335,120 +335,118 @@ return v_data_uncomp_hum_int32;
/*--------------------------------------------------------------------------*
* The following function is used to map the I2C bus read, write, delay and
* device address with global structure bme280
* The following function is used to map the I2C bus read, write, delay and
* device address with global structure bme280
*-------------------------------------------------------------------------*/
int8_t BME280::I2C_routine()
{
{
/*--------------------------------------------------------------------------*
* By using bme280 the following structure parameter can be accessed
* Bus write function pointer: BME280_WR_FUNC_PTR
* Bus read function pointer: BME280_RD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
* Bus write function pointer: BME280_WR_FUNC_PTR
* Bus read function pointer: BME280_RD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
*--------------------------------------------------------------------------*/
// bme280.bus_write = &BME280::BME280_I2C_bus_write;
bme280.bus_write = BME280_I2C_bus_write;
// bme280.bus_write = &BME280::BME280_I2C_bus_write;
bme280.bus_write = BME280_I2C_bus_write;
//bme280.bus_write = BME280_I2C_bus_write_dummy;
bme280.bus_read = BME280_I2C_bus_read;
bme280.dev_addr = BME280_I2C_ADDRESS1;
bme280.delay_msec = BME280_delay_msek;
//bme280.bus_write = BME280_I2C_bus_write_dummy;
bme280.bus_read = BME280_I2C_bus_read;
bme280.dev_addr = BME280_I2C_ADDRESS1;
bme280.delay_msec = BME280_delay_msek;
return BME280_INIT_VALUE;
return BME280_INIT_VALUE;
}
/*-------------------------------------------------------------------*
* The device address defined in the bme280.h file
* The device address defined in the bme280.h file
*-----------------------------------------------------------------------*/
int32_t BME280::i2c_write_string(uint8_t dev_addr,uint8_t* ptr, uint8_t cnt)
{
mraa::Result ret;
m_i2c->address(dev_addr);
if((ret = m_i2c->write((const uint8_t*) (ptr), cnt)) != 0)
{
UPM_THROW("I2C write error");
}
mraa::Result ret;
m_i2c->address(dev_addr);
if((ret = m_i2c->write((const uint8_t*) (ptr), cnt)) != 0)
{
UPM_THROW("I2C write error");
}
return 0;
}
/* \Brief: The function is used as I2C bus write
* \Return : Status of the I2C write
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register, will data is going to be written
* \param reg_data : It is a value hold in the array,
* will be used for write the value into the register
* \param cnt : The no of byte of data to be write
/* \Brief: The function is used as I2C bus write
* \Return : Status of the I2C write
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register, will data is going to be written
* \param reg_data : It is a value hold in the array,
* will be used for write the value into the register
* \param cnt : The no of byte of data to be write
*/
int8_t BME280::BME280_I2C_bus_write(uint8_t dev_addr, uint8_t reg_addr, uint8_t *reg_data, uint8_t cnt)
{
int32_t iError = BME280_INIT_VALUE;
static uint8_t array[I2C_BUFFER_LEN];
int32_t iError = BME280_INIT_VALUE;
static uint8_t array[I2C_BUFFER_LEN];
for (int i=0; i<I2C_BUFFER_LEN; i++) array[i]=0;
uint8_t stringpos = BME280_INIT_VALUE;
array[BME280_INIT_VALUE] = reg_addr;
for (stringpos = BME280_INIT_VALUE; stringpos < cnt; stringpos++) {
array[stringpos + BME280_ONE_U8X] = *(reg_data + stringpos);
}
iError = i2c_write_string(dev_addr,array, cnt+1);
return (int8_t)iError;
uint8_t stringpos = BME280_INIT_VALUE;
array[BME280_INIT_VALUE] = reg_addr;
for (stringpos = BME280_INIT_VALUE; stringpos < cnt; stringpos++) {
array[stringpos + BME280_ONE_U8X] = *(reg_data + stringpos);
}
iError = i2c_write_string(dev_addr,array, cnt+1);
return (int8_t)iError;
}
int32_t BME280::i2c_write_read_string(uint8_t dev_addr,uint8_t reg_addr , uint8_t * ptr, uint8_t cnt)
{
mraa::Result ret;
mraa::Result ret;
m_i2c->address(dev_addr);
m_i2c->address(dev_addr);
if( m_i2c->readBytesReg(reg_addr, ptr, cnt) != cnt)
{
UPM_THROW("bme280 register read failed");
if( m_i2c->readBytesReg(reg_addr, ptr, cnt) != cnt)
{
UPM_THROW("bme280 register read failed");
}
return 0;
}
return 0;
}
/* \Brief: The function is used as I2C bus read
* \Return : Status of the I2C read
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register, will data is going to be read
* \param reg_data : This data read from the sensor, which is hold in an array
* \param cnt : The no of data byte of to be read
/* \Brief: The function is used as I2C bus read
* \Return : Status of the I2C read
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register, will data is going to be read
* \param reg_data : This data read from the sensor, which is hold in an array
* \param cnt : The no of data byte of to be read
*/
int8_t BME280::BME280_I2C_bus_read(uint8_t dev_addr, uint8_t reg_addr, uint8_t *reg_data, uint8_t cnt)
{
int32_t iError = BME280_INIT_VALUE;
uint8_t array[I2C_BUFFER_LEN] = {BME280_INIT_VALUE};
uint8_t stringpos = BME280_INIT_VALUE;
array[BME280_INIT_VALUE] = reg_addr;
i2c_write_read_string(dev_addr,reg_addr,array,cnt);
for (stringpos = BME280_INIT_VALUE; stringpos < cnt; stringpos++) {
*(reg_data + stringpos) = array[stringpos];
}
return (int8_t)iError;
int32_t iError = BME280_INIT_VALUE;
uint8_t array[I2C_BUFFER_LEN] = {BME280_INIT_VALUE};
uint8_t stringpos = BME280_INIT_VALUE;
array[BME280_INIT_VALUE] = reg_addr;
i2c_write_read_string(dev_addr,reg_addr,array,cnt);
for (stringpos = BME280_INIT_VALUE; stringpos < cnt; stringpos++) {
*(reg_data + stringpos) = array[stringpos];
}
return (int8_t)iError;
}
/* Brief : The delay routine
* \param : delay in ms
/* Brief : The delay routine
* \param : delay in ms
*/
void BME280::BME280_delay_msek(uint16_t mseconds)
{
struct timespec sleepTime;
struct timespec sleepTime;
sleepTime.tv_sec = mseconds / 1000; // Number of seconds
sleepTime.tv_nsec = ( mseconds % 1000 ) * 1000000; // Convert fractional seconds to nanoseconds
// Iterate nanosleep in a loop until the total sleep time is the original
// value of the seconds parameter
while ( ( nanosleep( &sleepTime, &sleepTime ) != 0 ) && ( errno == EINTR ) );
sleepTime.tv_sec = mseconds / 1000; // Number of seconds
sleepTime.tv_nsec = ( mseconds % 1000 ) * 1000000; // Convert fractional seconds to nanoseconds
// Iterate nanosleep in a loop until the total sleep time is the original
// value of the seconds parameter
while ( ( nanosleep( &sleepTime, &sleepTime ) != 0 ) && ( errno == EINTR ) );
}

View File

@ -1,5 +1,5 @@
set (libname "ili9341")
set (libdescription "libupm ILI9341 SPI LCD")
set (module_src gfx.cxx ili9341.cxx)
set (module_h gfx.h ili9341.h)
set (module_src ili9341_gfx.cxx ili9341.cxx)
set (module_h ili9341_gfx.h ili9341.h)
upm_module_init()

View File

@ -32,7 +32,7 @@
#include <mraa/common.hpp>
#include <mraa/gpio.hpp>
#include <mraa/spi.hpp>
#include "gfx.h"
#include "ili9341_gfx.h"
// Defines
#define ILI9341_TFTWIDTH 240

View File

@ -24,7 +24,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "gfx.h"
#include "ili9341_gfx.h"
using namespace upm;

View File

@ -5,9 +5,9 @@
%apply uint8_t *INPUT { uint8_t *addr }
%include "gfx.h"
%include "ili9341_gfx.h"
%{
#include "gfx.h"
#include "ili9341_gfx.h"
%}
%{

View File

@ -1,9 +1,9 @@
%module jsupm_ili9341
%include "../upm.i"
%include "gfx.h"
%include "ili9341_gfx.h"
%{
#include "gfx.h"
#include "ili9341_gfx.h"
%}
%include "ili9341.h"

View File

@ -6,9 +6,9 @@
%feature("autodoc", "3");
%rename("printString") print(std::string msg);
%include "gfx.h"
%include "ili9341_gfx.h"
%{
#include "gfx.h"
#include "ili9341_gfx.h"
%}
%include "ili9341.h"

View File

@ -1,5 +1,6 @@
%module jsupm_nrf24l01
%include "../upm.i"
%include "../carrays_uint8_t.i"
%{
#include "nrf24l01.h"

View File

@ -2,6 +2,7 @@
%include "pyupm_doxy2swig.i"
%module pyupm_nrf24l01
%include "../upm.i"
%include "../carrays_uint8_t.i"
%feature("autodoc", "3");

View File

@ -1,5 +1,5 @@
set (libname "ssd1351")
set (libdescription "libupm SSD1351 SPI LCD")
set (module_src gfx.cxx ssd1351.cxx)
set (module_h gfx.h ssd1351.h)
set (module_src ssd1351_gfx.cxx ssd1351.cxx)
set (module_h ssd1351_gfx.h ssd1351.h)
upm_module_init()

View File

@ -6,9 +6,9 @@
%ignore m_map;
%ignore font;
%include "gfx.h"
%include "ssd1351_gfx.h"
%{
#include "gfx.h"
#include "ssd1351_gfx.h"
%}
%include "ssd1351.h"

View File

@ -1,9 +1,9 @@
%module jsupm_ssd1351
%include "../upm.i"
%include "gfx.h"
%include "ssd1351_gfx.h"
%{
#include "gfx.h"
#include "ssd1351_gfx.h"
%}
%include "ssd1351.h"

View File

@ -6,9 +6,9 @@
%feature("autodoc", "3");
%rename("printString") print(std::string msg);
%include "gfx.h"
%include "ssd1351_gfx.h"
%{
#include "gfx.h"
#include "ssd1351_gfx.h"
%}
%include "ssd1351.h"

View File

@ -44,7 +44,7 @@ SSD1351::SSD1351 (uint8_t oc, uint8_t dc, uint8_t rst) :
// Setup SPI bus
m_spi.frequency(8 * 1000000);
m_spi.mode(mraa::SPI_MODE3);
m_spi.mode(mraa::SPI_MODE0);
m_spi.writeByte(0x00); // Need to bring clk high before init
// Init pins

View File

@ -30,7 +30,7 @@
#include <mraa/common.hpp>
#include <mraa/gpio.hpp>
#include <mraa/spi.hpp>
#include "gfx.h"
#include "ssd1351_gfx.h"
// Display Size
#define SSD1351WIDTH 128
@ -92,7 +92,13 @@ namespace upm {
*
* @brief API for SSD1351 OLED displays
*
* This module defines the interface for the SSD1351 display library
* This module defines the interface for the SSD1351 display library. It was
* tested with the Adafruit 1.5" OLED Display, but should work with any SSD1351
* display running in SPI mode.
*
* On the Intel Edison don't forget to disable SPI Power Management (PM) for
* this driver to work, you can find more details on this topic here:
* http://iotdk.intel.com/docs/master/mraa/edison.html
*
* @image html ssd1351.jpg
* @snippet ssd1351.cxx Interesting

View File

@ -28,7 +28,7 @@
#include <unistd.h>
#include <stdlib.h>
#include "gfx.h"
#include "ssd1351_gfx.h"
using namespace upm;

View File

@ -1,5 +1,5 @@
set (libname "st7735")
set (libdescription "libupm SPI LCD")
set (module_src gfx.cxx st7735.cxx)
set (module_h gfx.h st7735.h)
set (module_src st7735_gfx.cxx st7735.cxx)
set (module_h st7735_gfx.h st7735.h)
upm_module_init()

View File

@ -35,9 +35,9 @@
$1 = (unsigned char *)JCALL2(GetByteArrayElements, jenv, $input, NULL);
}
%include "gfx.h"
%include "st7735_gfx.h"
%{
#include "gfx.h"
#include "st7735_gfx.h"
%}
%include "st7735.h"

View File

@ -1,9 +1,9 @@
%module jsupm_st7735
%include "../upm.i"
%include "gfx.h"
%include "st7735_gfx.h"
%{
#include "gfx.h"
#include "st7735_gfx.h"
%}
%include "st7735.h"

View File

@ -6,9 +6,9 @@
%feature("autodoc", "3");
%rename("printString") print(std::string msg);
%include "gfx.h"
%include "st7735_gfx.h"
%{
#include "gfx.h"
#include "st7735_gfx.h"
%}
%include "st7735.h"

View File

@ -33,7 +33,7 @@
#include <mraa/gpio.hpp>
#include <mraa/spi.hpp>
#include "gfx.h"
#include "st7735_gfx.h"
#define INITR_GREENTAB 0x0
#define INITR_REDTAB 0x1

View File

@ -26,7 +26,7 @@
#include <unistd.h>
#include <stdlib.h>
#include "gfx.h"
#include "st7735_gfx.h"
using namespace upm;