From f7fcf9900825d2e5ea2c42d2ac31c9f8daf80a42 Mon Sep 17 00:00:00 2001 From: zwsd Date: Mon, 1 Aug 2022 16:28:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=AF=E5=B8=A6=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/c_cpp_properties.json | 2 +- main/CMakeLists.txt | 1 - main/main.c | 25 ++++++++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 38437e0..5d1da2a 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -2,7 +2,7 @@ "configurations": [ { "name": "Win32", - "compileCommands": "./build/compile_commands.json" + "compileCommands": "${workspaceFolder}/build/compile_commands.json" } ], "version": 4 diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 2a6cfee..c3cbdfe 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRCS # - "../dep/zesp32-submodule-zsimpleble-server/zsimpleble_server.c" "ble_spp_server_demo.c" "main.c" INCLUDE_DIRS # diff --git a/main/main.c b/main/main.c index 5e19ad0..2188d54 100644 --- a/main/main.c +++ b/main/main.c @@ -5,10 +5,33 @@ #include "freertos/task.h" #include "nvs_flash.h" #include "string.h" +#include "driver/gpio.h" // #include "ble_spp_server_demo.h" +#define Electric_relay1 25 +#define Electric_relay2 26 + +#define GPIO_OUTPUT_PIN_SEL ((1ULL << Electric_relay1) | (1ULL << Electric_relay2)) + +void gpio_rgb_init() { + gpio_config_t gpio_grb_led_structer; + + gpio_grb_led_structer.intr_type = GPIO_INTR_DISABLE; + gpio_grb_led_structer.mode = GPIO_MODE_OUTPUT; + gpio_grb_led_structer.pin_bit_mask = GPIO_OUTPUT_PIN_SEL; + gpio_grb_led_structer.pull_down_en = 0; + gpio_grb_led_structer.pull_up_en = 0; + + gpio_config(&gpio_grb_led_structer); +} + void app_main(void) { - ble_spp_server_demo_app_main(); + // ble_spp_server_demo_app_main(); + gpio_rgb_init(); + + gpio_set_level(Electric_relay1,0); + gpio_set_level(Electric_relay2,0); + return; }