From 8efa7d2accd58ed8892c65c4b5a019321a90c681 Mon Sep 17 00:00:00 2001 From: h2zero Date: Thu, 27 Aug 2020 10:55:24 -0600 Subject: [PATCH] Add example. --- .../basic_on_off_level_server/CMakeLists.txt | 7 ++ .../mesh/basic_on_off_level_server/Makefile | 3 + .../main/CMakeLists.txt | 4 ++ .../main/component.mk | 4 ++ .../basic_on_off_level_server/main/main.cpp | 66 +++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 examples/mesh/basic_on_off_level_server/CMakeLists.txt create mode 100644 examples/mesh/basic_on_off_level_server/Makefile create mode 100644 examples/mesh/basic_on_off_level_server/main/CMakeLists.txt create mode 100644 examples/mesh/basic_on_off_level_server/main/component.mk create mode 100644 examples/mesh/basic_on_off_level_server/main/main.cpp diff --git a/examples/mesh/basic_on_off_level_server/CMakeLists.txt b/examples/mesh/basic_on_off_level_server/CMakeLists.txt new file mode 100644 index 0000000..d5996db --- /dev/null +++ b/examples/mesh/basic_on_off_level_server/CMakeLists.txt @@ -0,0 +1,7 @@ +# The following lines of boilerplate have to be in your project's +# CMakeLists in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) +project(basic_on_off_level_server) diff --git a/examples/mesh/basic_on_off_level_server/Makefile b/examples/mesh/basic_on_off_level_server/Makefile new file mode 100644 index 0000000..92a66c7 --- /dev/null +++ b/examples/mesh/basic_on_off_level_server/Makefile @@ -0,0 +1,3 @@ +PROJECT_NAME := basic_on_off_level_server + +include $(IDF_PATH)/make/project.mk diff --git a/examples/mesh/basic_on_off_level_server/main/CMakeLists.txt b/examples/mesh/basic_on_off_level_server/main/CMakeLists.txt new file mode 100644 index 0000000..9be9075 --- /dev/null +++ b/examples/mesh/basic_on_off_level_server/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "main.cpp") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() \ No newline at end of file diff --git a/examples/mesh/basic_on_off_level_server/main/component.mk b/examples/mesh/basic_on_off_level_server/main/component.mk new file mode 100644 index 0000000..a98f634 --- /dev/null +++ b/examples/mesh/basic_on_off_level_server/main/component.mk @@ -0,0 +1,4 @@ +# +# "main" pseudo-component makefile. +# +# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) diff --git a/examples/mesh/basic_on_off_level_server/main/main.cpp b/examples/mesh/basic_on_off_level_server/main/main.cpp new file mode 100644 index 0000000..def8e2f --- /dev/null +++ b/examples/mesh/basic_on_off_level_server/main/main.cpp @@ -0,0 +1,66 @@ +#include "NimBLEDevice.h" +#include "driver/gpio.h" + +extern "C" {void app_main(void);} + +#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b" + +// LED pins +#define LEDR GPIO_NUM_16 +#define LEDG GPIO_NUM_17 +#define LEDB GPIO_NUM_18 +#define OUTPUT_PIN (1ULL<getElement(); + pElem->createModel(BT_MESH_MODEL_ID_GEN_ONOFF_SRV, new onOffSrvModelCallbacks()); + //pElem = pMesh->createElement(); + pElem->createModel(BT_MESH_MODEL_ID_GEN_LEVEL_SRV, new levelSrvModelCallbacks()); + pMesh->start(); +}