android-things: Peripheralmanager target build
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Noel Eck
parent
4c7616fe91
commit
69fcd861a7
@@ -187,6 +187,9 @@ cmake -DRPM=ON -DCMAKE_INSTALL_PREFIX=/usr ..
|
|||||||
|
|
||||||
## Building for Peripheralmanager Android Things
|
## Building for Peripheralmanager Android Things
|
||||||
|
|
||||||
|
Change src/CMakeLists.txt:146 to the location of libperipheralman.so on your
|
||||||
|
machine or have it in your Android NDK
|
||||||
|
|
||||||
~~~~~~~~~~~~~{.sh}
|
~~~~~~~~~~~~~{.sh}
|
||||||
cmake -DBUILDSWIG=OFF -DBUILDARCH=PERIPHERALMAN -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk-r13b/build/cmake/android.toolchain.cmake ..
|
cmake -DBUILDSWIG=OFF -DBUILDARCH=PERIPHERALMAN -DANDROID_TOOLCHAIN_NAME=x86-i686 -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk-r13b/build/cmake/android.toolchain.cmake ..
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ add_executable (uart uart.c)
|
|||||||
add_executable (mraa-gpio mraa-gpio.c)
|
add_executable (mraa-gpio mraa-gpio.c)
|
||||||
add_executable (mraa-i2c mraa-i2c.c)
|
add_executable (mraa-i2c mraa-i2c.c)
|
||||||
add_executable (spi_max7219 spi_max7219.c)
|
add_executable (spi_max7219 spi_max7219.c)
|
||||||
|
if (NOT ANDROID_TOOLCHAIN)
|
||||||
add_executable (iio_driver iio_driver.c)
|
add_executable (iio_driver iio_driver.c)
|
||||||
|
endif ()
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/api)
|
include_directories(${PROJECT_SOURCE_DIR}/api)
|
||||||
# FIXME Hack to access mraa internal types used by mraa-i2c
|
# FIXME Hack to access mraa internal types used by mraa-i2c
|
||||||
@@ -33,8 +35,9 @@ target_link_libraries (uart mraa)
|
|||||||
target_link_libraries (mraa-gpio mraa)
|
target_link_libraries (mraa-gpio mraa)
|
||||||
target_link_libraries (mraa-i2c mraa)
|
target_link_libraries (mraa-i2c mraa)
|
||||||
target_link_libraries (spi_max7219 mraa)
|
target_link_libraries (spi_max7219 mraa)
|
||||||
|
if (NOT ANDROID_TOOLCHAIN)
|
||||||
target_link_libraries (iio_driver mraa)
|
target_link_libraries (iio_driver mraa)
|
||||||
|
endif ()
|
||||||
if (ONEWIRE)
|
if (ONEWIRE)
|
||||||
add_executable (uart_ow uart_ow.c)
|
add_executable (uart_ow uart_ow.c)
|
||||||
target_link_libraries (uart_ow mraa)
|
target_link_libraries (uart_ow mraa)
|
||||||
@@ -47,7 +50,9 @@ if (FIRMATA)
|
|||||||
target_link_libraries (i2c_firmata mraa)
|
target_link_libraries (i2c_firmata mraa)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (NOT ANDROID_TOOLCHAIN)
|
||||||
add_subdirectory (c++)
|
add_subdirectory (c++)
|
||||||
|
endif ()
|
||||||
|
|
||||||
install (DIRECTORY ${PROJECT_SOURCE_DIR}/examples/ DESTINATION ${CMAKE_INSTALL_DATADIR}/mraa/examples)
|
install (DIRECTORY ${PROJECT_SOURCE_DIR}/examples/ DESTINATION ${CMAKE_INSTALL_DATADIR}/mraa/examples)
|
||||||
|
|
||||||
|
|||||||
@@ -104,12 +104,12 @@ set (mraa_LIB_MOCK_SRCS_NOAUTO
|
|||||||
|
|
||||||
set (mraa_LIB_PERIPHERALMAN_SRCS_NOAUTO
|
set (mraa_LIB_PERIPHERALMAN_SRCS_NOAUTO
|
||||||
${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman.c
|
${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman.c
|
||||||
${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_aio.c
|
# ${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_aio.c
|
||||||
${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_gpio.c
|
# ${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_gpio.c
|
||||||
${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_i2c.c
|
# ${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_i2c.c
|
||||||
${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_pwm.c
|
# ${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_pwm.c
|
||||||
${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_spi.c
|
# ${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_spi.c
|
||||||
${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_uart.c
|
# ${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman_uart.c
|
||||||
)
|
)
|
||||||
|
|
||||||
if (JSONPLAT)
|
if (JSONPLAT)
|
||||||
@@ -145,6 +145,7 @@ endif()
|
|||||||
if (PERIPHERALMAN)
|
if (PERIPHERALMAN)
|
||||||
add_subdirectory(peripheralman)
|
add_subdirectory(peripheralman)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPERIPHERALMAN=1")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPERIPHERALMAN=1")
|
||||||
|
set (mraa_LIBS ${mraa_LIBS} -l/home/brendan/git/mraa/libperipheralman.so)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USBPLAT)
|
if (USBPLAT)
|
||||||
|
|||||||
12
src/mraa.c
12
src/mraa.c
@@ -68,12 +68,13 @@
|
|||||||
#elif
|
#elif
|
||||||
#define IIO_DEVICE_WILDCARD "iio:device*"
|
#define IIO_DEVICE_WILDCARD "iio:device*"
|
||||||
|
|
||||||
mraa_board_t* plat = NULL;
|
|
||||||
mraa_iio_info_t* plat_iio = NULL;
|
mraa_iio_info_t* plat_iio = NULL;
|
||||||
|
|
||||||
static int num_i2c_devices = 0;
|
static int num_i2c_devices = 0;
|
||||||
static int num_iio_devices = 0;
|
static int num_iio_devices = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mraa_board_t* plat = NULL;
|
||||||
mraa_lang_func_t* lang_func = NULL;
|
mraa_lang_func_t* lang_func = NULL;
|
||||||
|
|
||||||
char* platform_name = NULL;
|
char* platform_name = NULL;
|
||||||
@@ -190,7 +191,7 @@ imraa_init()
|
|||||||
mraa_add_from_lockfile(subplatform_lockfile);
|
mraa_add_from_lockfile(subplatform_lockfile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(PLATFORMAN)
|
#if !defined(PERIPHERALMAN)
|
||||||
// Look for IIO devices
|
// Look for IIO devices
|
||||||
mraa_iio_detect();
|
mraa_iio_detect();
|
||||||
|
|
||||||
@@ -305,7 +306,6 @@ mraa_set_priority(const int priority)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PERIPHERALMAN)
|
#if !defined(PERIPHERALMAN)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mraa_count_iio_devices(const char* path, const struct stat* sb, int flag, struct FTW* ftwb)
|
mraa_count_iio_devices(const char* path, const struct stat* sb, int flag, struct FTW* ftwb)
|
||||||
{
|
{
|
||||||
@@ -521,6 +521,12 @@ mraa_setup_mux_mapped(mraa_pin_t meta)
|
|||||||
|
|
||||||
return MRAA_SUCCESS;
|
return MRAA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
mraa_result_t
|
||||||
|
mraa_setup_mux_mapped(mraa_pin_t meta)
|
||||||
|
{
|
||||||
|
return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -626,8 +626,10 @@ mraa_uart_data_available(mraa_uart_context dev, unsigned int millis)
|
|||||||
|
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
|
|
||||||
|
#if !defined(PERIPHERALMAN)
|
||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
FD_SET(dev->fd, &readfds);
|
FD_SET(dev->fd, &readfds);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (select(dev->fd + 1, &readfds, NULL, NULL, &timeout) > 0) {
|
if (select(dev->fd + 1, &readfds, NULL, NULL, &timeout) > 0) {
|
||||||
return 1; // data is ready
|
return 1; // data is ready
|
||||||
|
|||||||
Reference in New Issue
Block a user