summaryrefslogtreecommitdiff
path: root/examples/peripheral
diff options
context:
space:
mode:
Diffstat (limited to 'examples/peripheral')
-rw-r--r--examples/peripheral/blinky/CMakeLists.txt51
1 files changed, 51 insertions, 0 deletions
diff --git a/examples/peripheral/blinky/CMakeLists.txt b/examples/peripheral/blinky/CMakeLists.txt
new file mode 100644
index 0000000..fc51f55
--- /dev/null
+++ b/examples/peripheral/blinky/CMakeLists.txt
@@ -0,0 +1,51 @@
+set(T blinky)
+set(D ${MCU_NRF5X_SDK_PATH}/examples/peripheral/${T})
+
+if (NOT EXISTS ${D})
+ message("${T}: Not available in this SDK version: ${D}")
+ return()
+endif ()
+
+if (MCU_CHIP MATCHES "nrf51.*")
+ set(SDK_CONFIG ${D}/pca10028/s130/config/sdk_config.h)
+ set(D_BOARD BOARD_PCA10028)
+elseif (MCU_CHIP MATCHES "nrf52.*")
+ set(SDK_CONFIG ${D}/pca10040/blank/config/sdk_config.h)
+ set(D_BOARD BOARD_PCA10040)
+endif ()
+
+message("${T}: Configured for chip ${MCU_CHIP}, using sdk config=${SDK_CONFIG}, board define: ${D_BOARD}")
+
+if (MCU_NRF5X_SDK_VERSION VERSION_GREATER 7)
+ list(APPEND EXTRA_SOURCE_DIRS
+ ${MCU_NRF5X_SDK_PATH}/components/drivers_nrf/delay
+ )
+endif ()
+
+mcu_include_directories_from_sources(
+ SOURCES_VAR SOURCES
+ HEADERS_VAR HEADERS
+ INCLUDES_VAR INCLUDES
+ SOURCE_DIR
+ ${MCU_NRF5X_SDK_PATH}/components/drivers_nrf/hal
+ ${MCU_NRF5X_SDK_PATH}/components/libraries/button
+ ${MCU_NRF5X_SDK_PATH}/components/libraries/log
+ ${MCU_NRF5X_SDK_PATH}/components/libraries/util
+ ${EXTRA_SOURCE_DIRS}
+ EXCLUDE
+ "app_error_weak_cmock"
+)
+
+add_executable(${T}
+ ${D}/main.c ${SDK_CONFIG}
+ ${SOURCES} ${HEADERS})
+
+target_include_directories(${T} PUBLIC
+ ${INCLUDES}
+ ${MCU_NRF5X_SDK_PATH}/examples/bsp
+ )
+target_compile_definitions(${T} PUBLIC ${D_BOARD})
+target_compile_definitions(${T} PUBLIC BLE_STACK_SUPPORT_REQD)
+target_compile_definitions(${T} PUBLIC NRF_SD_BLE_API_VERSION=3)
+mcu_add_executable(TARGET ${T}
+ SDK_CONFIG ${SDK_CONFIG})