mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 09:21:12 +03:00
ANDROID: CMake/src changes to build on android-24
* Updated pom file generation: Generate pom files after all sensor library targets have been created - allows for dependencies * Changes for compiling on Android * Check for mraa build options: Look at symbols in mraa library to determine UPM build options (example: mraa_iio_init, mraa_firmata_init) * Add per target summary for C/C++/java/nodejs/python * Added hierarchy to fti include directory... old: #include "upm_voltage.h" new: #include "fti/upm_voltage.h" * Removed unimplemented methods from mpu9150 library and java example * Add utilities-c target for all c examples. Most of the C examples rely on the upm_delay methods. Add a dependency on the utilities-c target for all c examples. * Updated the examples/CMakeLists.txt to add dependencies passed via TARGETS to the target name parsed from the example name. Also updated the interface example names to start with 'interfaces'. * Updated src/examples/CMakeLists.txt to ALWAYS remove examples from the example_src_list (moved this from end of function to beginning). Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@ -50,6 +50,11 @@ function (add_example example_src)
|
||||
# Parse function parameters
|
||||
cmake_parse_arguments(add_example "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
# Attempt to remove this example source file from a list of example
|
||||
# sources. This allows for handling special case examples.
|
||||
list (REMOVE_ITEM example_src_list ${example_src})
|
||||
set (example_src_list ${example_src_list} PARENT_SCOPE)
|
||||
|
||||
# Get the base filename from the full filename
|
||||
# For file /some/path/to/sensorfoo-bar.c, example_name = sensorfoo-bar
|
||||
get_filename_component(example_name ${example_src} NAME_WE)
|
||||
@ -84,7 +89,7 @@ function (add_example example_src)
|
||||
# If a dependency target does NOT exist, print a warning and skip
|
||||
foreach(_dep_target ${lib_target_names})
|
||||
if (NOT TARGET ${_dep_target})
|
||||
message(STATUS "Missing CMake target (${_dep_target}), skipping example ${example_src}")
|
||||
message(STATUS "Example ${example_src} is missing a required CMake target (${_dep_target}), skipping...")
|
||||
return()
|
||||
endif ()
|
||||
endforeach ()
|
||||
@ -96,10 +101,6 @@ function (add_example example_src)
|
||||
foreach(_dep_target ${lib_target_names})
|
||||
target_link_libraries(${this_target_name} ${_dep_target} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endforeach ()
|
||||
|
||||
# Special case...
|
||||
list (REMOVE_ITEM example_src_list ${example_src})
|
||||
set (example_src_list ${example_src_list} PARENT_SCOPE)
|
||||
endfunction (add_example example_src)
|
||||
|
||||
# Add subdirectories if BUILDEXAMPLES=on
|
||||
|
@ -23,7 +23,10 @@
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include <string>
|
||||
|
||||
#include "jhd1313m1.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
@ -64,7 +67,7 @@ main(int argc, char **argv)
|
||||
// Echo via printf
|
||||
printf("Hello World %d rgb: 0x%02x%02x%02x\n", ndx++, r, g, b);
|
||||
|
||||
sleep(1);
|
||||
upm_delay(1);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
@ -7,5 +7,5 @@ file (GLOB example_src_list RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
|
||||
|
||||
# - Create an executable for all other src files in this directory -------------
|
||||
foreach (_example_src ${example_src_list})
|
||||
add_example(${_example_src} SUFFIX "-c")
|
||||
add_example(${_example_src} TARGETS utilities-c SUFFIX "-c")
|
||||
endforeach ()
|
||||
|
@ -111,7 +111,9 @@ add_example(RotaryEncoderSample rotaryencoder)
|
||||
add_example(RPR220_intrSample rpr220)
|
||||
add_example(RPR220Sample rpr220)
|
||||
add_example(ST7735Sample st7735)
|
||||
add_example(StepMotorSample stepmotor)
|
||||
if (NOT ANDROID)
|
||||
add_example(StepMotorSample stepmotor)
|
||||
endif ()
|
||||
add_example(TM1637Sample tm1637)
|
||||
add_example(TP401Sample gas)
|
||||
add_example(TSL2561Sample tsl2561)
|
||||
@ -145,7 +147,9 @@ if (BACNET_FOUND)
|
||||
add_example(T8100_Example t8100)
|
||||
add_example(TB7300_Example tb7300)
|
||||
endif()
|
||||
add_example(VCAP_Example vcap)
|
||||
if (JPEG_FOUND)
|
||||
add_example(VCAP_Example vcap)
|
||||
endif()
|
||||
add_example(BMP280_Example bmp280)
|
||||
add_example(BNO055_Example bno055)
|
||||
add_example(BMX055_Example bmx055)
|
||||
|
@ -34,13 +34,14 @@ public class MPU9150Sample {
|
||||
while (true) {
|
||||
sensor.update();
|
||||
|
||||
float[] accel = sensor.getAccelerometer();
|
||||
System.out.println("Accelerometer: " + "AX: " + accel[0] + " AY: " + accel[1] + " AZ: "
|
||||
+ accel[2]);
|
||||
|
||||
float[] gyro = sensor.getGyroscope();
|
||||
System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
|
||||
+ gyro[2]);
|
||||
// These don't exist
|
||||
// float[] accel = sensor.getAccelerometer();
|
||||
// System.out.println("Accelerometer: " + "AX: " + accel[0] + " AY: " + accel[1] + " AZ: "
|
||||
// + accel[2]);
|
||||
//
|
||||
// float[] gyro = sensor.getGyroscope();
|
||||
// System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
|
||||
// + gyro[2]);
|
||||
|
||||
float[] magn = sensor.getMagnetometer();
|
||||
System.out.println("Magnetometer: " + "MX: " + magn[0] + " MY: " + magn[1] + " MZ: "
|
||||
@ -50,4 +51,4 @@ public class MPU9150Sample {
|
||||
}
|
||||
// ! [Interesting]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user