2015-11-19 15:49:18 -08:00
|
|
|
# Extract module name from non-standard example name
|
|
|
|
macro(get_module_name example_name module_name)
|
|
|
|
string(LENGTH ${example_name} length)
|
|
|
|
string(FIND ${example_name} "-" index)
|
|
|
|
if (${index} GREATER 1)
|
|
|
|
string(SUBSTRING ${example_name} 0 ${index} substr)
|
|
|
|
set(${module_name} ${substr})
|
|
|
|
elseif (${example_name} MATCHES "^grove")
|
|
|
|
set (${module_name} "grove")
|
|
|
|
elseif ((${example_name} MATCHES "^mq" AND ${length} EQUAL 3) OR ${example_name} STREQUAL "tp401")
|
|
|
|
set (${module_name} "gas")
|
|
|
|
else()
|
2016-03-03 17:22:12 -08:00
|
|
|
set(${module_name} ${example_name})
|
2015-11-19 15:49:18 -08:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
# Set source file, include and linker settings for an example
|
|
|
|
# If example cannot be built, example_bin is cleared
|
|
|
|
macro(add_custom_example example_bin example_src example_module_list)
|
|
|
|
set(found_all_modules TRUE)
|
|
|
|
foreach (module ${example_module_list})
|
|
|
|
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/src/${module}")
|
|
|
|
set(found_all_modules FALSE)
|
|
|
|
endif()
|
|
|
|
if (MODULE_LIST)
|
|
|
|
list(FIND MODULE_LIST ${module} index)
|
|
|
|
if (${index} EQUAL -1)
|
2016-03-03 17:22:12 -08:00
|
|
|
set(found_all_modules FALSE)
|
2015-11-19 15:49:18 -08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if (found_all_modules)
|
|
|
|
add_executable (${example_bin} ${example_src})
|
2016-03-03 17:22:12 -08:00
|
|
|
target_link_libraries (${example_bin} ${CMAKE_THREAD_LIBS_INIT})
|
2015-11-19 15:49:18 -08:00
|
|
|
foreach (module ${example_module_list})
|
|
|
|
set(module_dir "${PROJECT_SOURCE_DIR}/src/${module}")
|
|
|
|
include_directories (${module_dir})
|
|
|
|
if (${module} STREQUAL "lcd")
|
2016-03-03 17:22:12 -08:00
|
|
|
set(module "i2clcd")
|
2015-11-19 15:49:18 -08:00
|
|
|
endif()
|
2016-03-03 17:22:12 -08:00
|
|
|
target_link_libraries (${example_bin} ${module})
|
2015-11-19 15:49:18 -08:00
|
|
|
endforeach()
|
|
|
|
else()
|
|
|
|
MESSAGE(INFO " Ignored ${example_bin}")
|
|
|
|
set (example_bin "")
|
2016-03-03 17:22:12 -08:00
|
|
|
endif()
|
2015-11-19 15:49:18 -08:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
|
|
|
# Add specified example by name
|
|
|
|
# Note special case for grove based examples
|
|
|
|
macro(add_example example_name)
|
|
|
|
set(example_src "${example_name}.cxx")
|
|
|
|
set(example_bin "${example_name}-example")
|
|
|
|
get_module_name(${example_name} module_name)
|
|
|
|
set(module_dir "${PROJECT_SOURCE_DIR}/src/${module_name}")
|
|
|
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${example_src}"
|
|
|
|
AND EXISTS ${module_dir}
|
2016-03-03 17:22:12 -08:00
|
|
|
AND IS_DIRECTORY ${module_dir})
|
2015-11-19 15:49:18 -08:00
|
|
|
add_custom_example(${example_bin} ${example_src} ${module_name})
|
|
|
|
if ((NOT ${example_bin} STREQUAL "") AND (${module_name} STREQUAL "grove"))
|
|
|
|
set(grove_module_path "${PROJECT_SOURCE_DIR}/src/${example_name}")
|
|
|
|
if (EXISTS ${grove_module_path})
|
|
|
|
include_directories(${grove_module_path})
|
2016-03-03 17:22:12 -08:00
|
|
|
target_link_libraries (${example_bin} ${example_name})
|
2015-11-19 15:49:18 -08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
MESSAGE(INFO " Ignored ${example_bin}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
2015-03-02 15:34:56 -08:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples)
|
|
|
|
|
2015-12-10 13:57:55 -08:00
|
|
|
# Set the mraa include and link directories prior to adding examples
|
|
|
|
include_directories (${MRAA_INCLUDE_DIRS})
|
|
|
|
link_directories (${MRAA_LIBDIR})
|
|
|
|
|
2015-11-19 15:49:18 -08:00
|
|
|
# If your sample source file matches the name of the module it tests, add it here
|
|
|
|
# Exceptions are as follows:
|
|
|
|
# string after first '-' is ignored (e.g. nrf24l01-transmitter maps to nrf24l01)
|
|
|
|
# mq? will use module gas
|
|
|
|
# grove* will use module grove
|
|
|
|
add_example (hmc5883l)
|
|
|
|
add_example (groveled)
|
|
|
|
add_example (groverelay)
|
|
|
|
add_example (grovelight)
|
|
|
|
add_example (grovetemp)
|
|
|
|
add_example (grovebutton)
|
|
|
|
add_example (groverotary)
|
|
|
|
add_example (groveslide)
|
|
|
|
add_example (buzzer-sound)
|
|
|
|
add_example (nrf24l01-transmitter)
|
|
|
|
add_example (nrf24l01-receiver)
|
|
|
|
add_example (nrf24l01-broadcast)
|
|
|
|
add_example (hcsr04)
|
|
|
|
add_example (max44000)
|
|
|
|
add_example (mma7455)
|
|
|
|
add_example (st7735)
|
|
|
|
add_example (max31855)
|
|
|
|
add_example (bmpx8x)
|
|
|
|
add_example (stepmotor)
|
|
|
|
add_example (pulsensor)
|
|
|
|
add_example (mic)
|
|
|
|
add_example (mpu9150)
|
|
|
|
add_example (maxds3231m)
|
|
|
|
add_example (max31723)
|
|
|
|
add_example (max5487)
|
|
|
|
add_example (nrf8001-broadcast)
|
|
|
|
add_example (nrf8001-helloworld)
|
|
|
|
add_example (lpd8806)
|
|
|
|
add_example (mlx90614)
|
|
|
|
add_example (ecs1030)
|
|
|
|
add_example (mq2)
|
|
|
|
add_example (mq3)
|
|
|
|
add_example (mq4)
|
|
|
|
add_example (mq5)
|
|
|
|
add_example (mq6)
|
|
|
|
add_example (mq7)
|
|
|
|
add_example (mq8)
|
|
|
|
add_example (mq9)
|
|
|
|
add_example (tp401)
|
|
|
|
add_example (tcs3414cs)
|
|
|
|
add_example (th02)
|
|
|
|
add_example (ttp223)
|
|
|
|
add_example (lsm303)
|
|
|
|
add_example (joystick12)
|
|
|
|
add_example (lol)
|
|
|
|
add_example (tsl2561)
|
|
|
|
add_example (htu21d)
|
|
|
|
add_example (mpl3115a2)
|
|
|
|
add_example (ldt0028)
|
|
|
|
add_example (am2315)
|
|
|
|
add_example (itg3200)
|
|
|
|
add_example (enc03r)
|
|
|
|
add_example (adc121c021)
|
|
|
|
add_example (ds1307)
|
|
|
|
add_example (a110x)
|
|
|
|
add_example (gp2y0a)
|
|
|
|
add_example (grovemoisture)
|
|
|
|
add_example (groveehr)
|
|
|
|
add_example (ta12200)
|
|
|
|
add_example (grovelinefinder)
|
|
|
|
add_example (grovevdiv)
|
|
|
|
add_example (grovewater)
|
|
|
|
add_example (guvas12d)
|
|
|
|
add_example (mpr121)
|
|
|
|
add_example (ublox6)
|
|
|
|
add_example (yg1006)
|
|
|
|
add_example (wt5001)
|
|
|
|
add_example (ppd42ns)
|
|
|
|
add_example (mq303a)
|
|
|
|
add_example (grovespeaker)
|
|
|
|
add_example (rfr359f)
|
|
|
|
add_example (biss0001)
|
|
|
|
add_example (rotaryencoder)
|
|
|
|
add_example (adxl345)
|
|
|
|
add_example (rpr220)
|
|
|
|
add_example (rpr220-intr)
|
|
|
|
add_example (mma7660)
|
|
|
|
add_example (cjq4435)
|
|
|
|
add_example (adxl335)
|
|
|
|
add_example (hmtrp)
|
|
|
|
add_example (nunchuck)
|
|
|
|
add_example (otp538u)
|
|
|
|
add_example (grovecollision)
|
|
|
|
add_example (groveelectromagnet)
|
|
|
|
add_example (groveemg)
|
|
|
|
add_example (groveo2)
|
|
|
|
add_example (grovegsr)
|
|
|
|
add_example (ina132)
|
|
|
|
add_example (l298)
|
|
|
|
add_example (l298-stepper)
|
|
|
|
add_example (at42qt1070)
|
|
|
|
add_example (grovemd)
|
|
|
|
add_example (grovemd-stepper)
|
|
|
|
add_example (pca9685)
|
|
|
|
add_example (groveeldriver)
|
|
|
|
add_example (adafruitss)
|
|
|
|
add_example (adafruitms1438)
|
|
|
|
add_example (adafruitms1438-stepper)
|
|
|
|
add_example (hx711)
|
|
|
|
add_example (flex)
|
|
|
|
add_example (a110x-intr)
|
|
|
|
add_example (mhz16)
|
|
|
|
add_example (apds9002)
|
|
|
|
add_example (waterlevel)
|
|
|
|
add_example (tm1637)
|
|
|
|
add_example (zfm20)
|
|
|
|
add_example (zfm20-register)
|
|
|
|
add_example (uln200xa)
|
|
|
|
add_example (grovewfs)
|
|
|
|
add_example (isd1820)
|
|
|
|
add_example (sx6119)
|
|
|
|
add_example (si114x)
|
|
|
|
add_example (maxsonarez)
|
|
|
|
add_example (hm11)
|
|
|
|
add_example (ht9170)
|
|
|
|
add_example (h3lis331dl)
|
|
|
|
add_example (ad8232)
|
|
|
|
add_example (grovescam)
|
|
|
|
add_example (m24lr64e)
|
|
|
|
add_example (rgbringcoder)
|
|
|
|
add_example (hp20x)
|
|
|
|
add_example (pn532)
|
|
|
|
add_example (pn532-writeurl)
|
|
|
|
add_example (lsm9ds0)
|
|
|
|
add_example (loudness)
|
|
|
|
add_example (mg811)
|
|
|
|
add_example (wheelencoder)
|
|
|
|
add_example (sm130)
|
|
|
|
add_example (grovegprs)
|
|
|
|
add_example (lm35)
|
|
|
|
add_example (micsv89)
|
|
|
|
add_example (xbee)
|
|
|
|
add_example (urm37)
|
|
|
|
add_example (urm37-uart)
|
|
|
|
add_example (adxrs610)
|
|
|
|
add_example (bma220)
|
|
|
|
add_example (dfrph)
|
|
|
|
add_example (mcp9808)
|
2015-12-04 17:01:20 -08:00
|
|
|
add_example (groveultrasonic)
|
|
|
|
add_example (sx1276-lora)
|
|
|
|
add_example (sx1276-fsk)
|
2016-01-01 22:02:24 +00:00
|
|
|
add_example (ili9341)
|
2015-12-04 17:01:20 -08:00
|
|
|
if (OPENZWAVE_FOUND)
|
|
|
|
include_directories(${OPENZWAVE_INCLUDE_DIRS})
|
|
|
|
add_example (ozw)
|
|
|
|
endif()
|
2015-12-04 19:16:36 -07:00
|
|
|
add_example (nlgpio16)
|
2015-12-01 14:57:34 -08:00
|
|
|
add_example (ads1x15)
|
2016-01-08 17:48:49 -07:00
|
|
|
if (MODBUS_FOUND)
|
|
|
|
include_directories(${MODBUS_INCLUDE_DIRS})
|
|
|
|
add_example (t3311)
|
2016-01-15 18:01:10 -07:00
|
|
|
add_example (hwxpxx)
|
2016-03-11 16:36:18 -07:00
|
|
|
add_example (h803x)
|
2016-01-08 17:48:49 -07:00
|
|
|
endif()
|
2016-01-13 13:49:15 -07:00
|
|
|
add_example (hdxxvxta)
|
2016-01-19 17:13:37 -07:00
|
|
|
add_example (rhusb)
|
2015-11-06 15:12:51 +08:00
|
|
|
add_example (apds9930)
|
2015-11-06 15:15:43 +08:00
|
|
|
add_example (kxcjk1013)
|
2016-03-03 17:22:12 -08:00
|
|
|
add_example (ssd1351)
|
2016-01-21 17:00:10 -08:00
|
|
|
add_example (ds1808lc)
|
2016-01-22 15:40:34 -08:00
|
|
|
add_example (hlg150h)
|
2016-01-22 15:41:11 -08:00
|
|
|
add_example (lp8860)
|
2016-01-22 15:41:42 -08:00
|
|
|
add_example (max44009)
|
2016-01-22 15:42:07 -08:00
|
|
|
add_example (si1132)
|
2016-01-22 15:42:31 -08:00
|
|
|
add_example (si7005)
|
2016-01-22 15:43:01 -08:00
|
|
|
add_example (t6713)
|
2016-02-19 17:58:44 -07:00
|
|
|
add_example (cwlsxxa)
|
2016-02-26 17:08:26 -07:00
|
|
|
add_example (teams)
|
2016-03-01 20:10:17 +01:00
|
|
|
add_example (apa102)
|
2016-03-02 16:36:06 -07:00
|
|
|
add_example (tex00)
|
2016-03-10 12:18:56 -07:00
|
|
|
add_example (bmi160)
|
2016-03-23 16:33:03 -07:00
|
|
|
add_example (smartdrive)
|
2016-03-18 11:34:38 +00:00
|
|
|
if (HAVE_FIRMATA)
|
|
|
|
add_example (curieimu)
|
|
|
|
endif ()
|
2016-04-01 17:29:48 -06:00
|
|
|
if (BACNET_FOUND)
|
|
|
|
include_directories(${BACNET_INCLUDE_DIRS})
|
2016-04-07 13:20:31 -06:00
|
|
|
# we need access to bacnetmstp headers too
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/src/bacnetmstp)
|
2016-04-01 17:29:48 -06:00
|
|
|
add_example (e50hx)
|
2016-06-10 12:46:49 -06:00
|
|
|
add_example (t8100)
|
2016-04-01 17:29:48 -06:00
|
|
|
endif()
|
2016-04-11 18:06:55 -06:00
|
|
|
add_example (vcap)
|
2015-12-16 16:26:25 -07:00
|
|
|
add_example (ds2413)
|
ds18b20: Initial implementation
This driver supports, and was tested with, a DS18B20 1-wire
Temperature Sensor using external power.
This device requires the use of a UART to provide access to a Dallas
1-wire bus, via a new facility supported by MRAA (once the relevant PR
is accepted), using the UartOW access class. It is important to
realize that the UART is only being used to access and control a
Dallas 1-wire compliant bus, it is not actually a UART device.
Multiple DS18B20 devices can be connected to this bus. This module
will identify all such devices connected, and allow you to access them
using an index starting at 0.
Parasitic power is not currently supported due to the very tight 10us
limit on switching a GPIO properly to supply power during certain
operations. For this reason, you should use external power for your
sensors.
Setting the alarm values (Tl, Th) is also not supported, since this is
only useful when doing a 1-wire device search looking for devices in
an alarm state, a capability not yet supported in MRAA. In reality,
this is trivial to handle yourself in your application.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-01-26 16:45:05 -07:00
|
|
|
add_example (ds18b20)
|
2016-05-04 12:47:39 -06:00
|
|
|
add_example (bmp280)
|
2016-04-15 10:47:40 -06:00
|
|
|
add_example (bno055)
|
2016-04-21 18:45:53 +08:00
|
|
|
add_example (l3gd20)
|
bmx055, bmi055, bmc160, bma250e, bmg150, bmm150: Initial implementation
This module (bmx055) implements support for the following core Bosch
chipsets:
bma250e - accelerometer, 3 variants (chip id's 0x03, 0xf9, and 0xfa)
bmm150 - magnetometer
bmg160 - gyroscope
The other 3 devices are combinations of the above:
bmx055 - accel/gyro/mag
bmc160 - accel/mag
bmi055 - accel/gyro
...for 6 devices total.
For the combination devices, all of the sub-devices appear as
individual independent devices on the I2C/SPI bus.
The combination drivers provide basic configuration and data output.
For more detailed control as well as interrupt support, you should use
the core device drivers (accel/gyro/mag) directly.
These devices support both I2C and SPI communications. They must be
powered at 3.3vdc.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-05-06 17:56:51 -06:00
|
|
|
add_example (bmx055)
|
2014-04-25 14:48:43 +01:00
|
|
|
|
2015-11-19 15:49:18 -08:00
|
|
|
# These are special cases where you specify example binary, source file and module(s)
|
|
|
|
include_directories (${PROJECT_SOURCE_DIR}/src)
|
|
|
|
add_custom_example (groveled-multi-example groveled-multi.cxx grove)
|
|
|
|
add_custom_example (lcm1602-i2c-example lcm1602-i2c.cxx lcd)
|
|
|
|
add_custom_example (lcm1602-parallel-example lcm1602-parallel.cxx lcd)
|
|
|
|
add_custom_example (jhd1313m1-lcd-example jhd1313m1-lcd.cxx lcd)
|
|
|
|
add_custom_example (es08a-example es08a.cxx servo)
|
|
|
|
add_custom_example (ssd1306-oled-example ssd1306-oled.cxx lcd)
|
|
|
|
add_custom_example (ssd1308-oled-example ssd1308-oled.cxx lcd)
|
|
|
|
add_custom_example (ssd1327-oled-example ssd1327-oled.cxx lcd)
|
|
|
|
add_custom_example (sainsmartks-example sainsmartks.cxx lcd)
|
|
|
|
add_custom_example (eboled-example eboled.cxx lcd)
|
|
|
|
add_custom_example (mpu60x0-example mpu60x0.cxx mpu9150)
|
|
|
|
add_custom_example (ak8975-example ak8975.cxx mpu9150)
|
|
|
|
add_custom_example (mpu9250-example mpu9250.cxx mpu9150)
|
2016-01-29 17:29:08 -07:00
|
|
|
add_custom_example (groveledbar-example groveledbar.cxx my9221)
|
|
|
|
add_custom_example (grovecircularled-example grovecircularled.cxx my9221)
|
2016-05-04 16:12:07 -06:00
|
|
|
add_custom_example (temperature-sensor-example temperature-sensor.cxx "si7005;bmpx8x;bme280")
|
2016-01-06 15:32:56 -08:00
|
|
|
add_custom_example (humidity-sensor-example humidity-sensor.cxx "si7005;bme280")
|
2016-05-04 16:12:07 -06:00
|
|
|
add_custom_example (pressure-sensor-example pressure-sensor.cxx "bmpx8x;bme280")
|
2016-01-06 15:32:56 -08:00
|
|
|
add_custom_example (co2-sensor-example co2-sensor.cxx "t6713")
|
2016-01-07 14:12:33 -08:00
|
|
|
add_custom_example (adc-example adc-sensor.cxx "ads1x15")
|
2016-01-06 15:32:56 -08:00
|
|
|
add_custom_example (light-sensor-example light-sensor.cxx "si1132;max44009")
|
|
|
|
add_custom_example (light-controller-example light-controller.cxx "lp8860;ds1808lc;hlg150h")
|
2016-05-04 12:47:39 -06:00
|
|
|
add_custom_example (bme280-example bme280.cxx bmp280)
|
bmx055, bmi055, bmc160, bma250e, bmg150, bmm150: Initial implementation
This module (bmx055) implements support for the following core Bosch
chipsets:
bma250e - accelerometer, 3 variants (chip id's 0x03, 0xf9, and 0xfa)
bmm150 - magnetometer
bmg160 - gyroscope
The other 3 devices are combinations of the above:
bmx055 - accel/gyro/mag
bmc160 - accel/mag
bmi055 - accel/gyro
...for 6 devices total.
For the combination devices, all of the sub-devices appear as
individual independent devices on the I2C/SPI bus.
The combination drivers provide basic configuration and data output.
For more detailed control as well as interrupt support, you should use
the core device drivers (accel/gyro/mag) directly.
These devices support both I2C and SPI communications. They must be
powered at 3.3vdc.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-05-06 17:56:51 -06:00
|
|
|
add_custom_example (bma250e-example bma250e.cxx bmx055)
|
|
|
|
add_custom_example (bmg160-example bmg160.cxx bmx055)
|
|
|
|
add_custom_example (bmm150-example bmm150.cxx bmx055)
|
|
|
|
add_custom_example (bmc150-example bmc150.cxx bmx055)
|
|
|
|
add_custom_example (bmi055-example bmi055.cxx bmx055)
|