From b0793ee97f300850393cb945053d6be88f240ef3 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Wed, 13 Mar 2024 19:01:26 +0800 Subject: [PATCH] good at sleep 27uA --- Core/Inc/yunhorn_sts_prd_conf.h | 139 +------------------------------- Core/Src/gpio.c | 2 +- LoRaWAN/App/lora_app.c | 20 ++--- STM32CubeIDE/.cproject | 3 + 4 files changed, 12 insertions(+), 152 deletions(-) diff --git a/Core/Inc/yunhorn_sts_prd_conf.h b/Core/Inc/yunhorn_sts_prd_conf.h index 942034a..a3cfcd1 100644 --- a/Core/Inc/yunhorn_sts_prd_conf.h +++ b/Core/Inc/yunhorn_sts_prd_conf.h @@ -6,8 +6,8 @@ ******************************************************************************* * @attention * - * Copyright (c) 2022 Yunhorn Technology Limited. - * Copyright (c) 2022 Shenzhen Yunhorn Technology Co., Ltd. + * Copyright (c) 2024 Yunhorn Technology Limited. + * Copyright (c) 2024 Shenzhen Yunhorn Technology Co., Ltd. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file @@ -42,6 +42,7 @@ //#define USE_TOF_VL53L1X #ifdef STS_R1D +#define YUNHORN_STS_R0_ENABLED 1U #define YUNHORN_STS_R1_ENABLED 1U #define STS_USE_TOF_VL53L0X 1U #endif @@ -50,129 +51,6 @@ * @brief This is the list of Yunhorn STS products to be used in ALL product config */ -/* YUNHORN SMARTOILETS OCCUPANCY PRODUCTS */ -/*#define YUNHORN_STS_O1_ENABLED */ -/*#define YUNHORN_STS_O2_ENABLED */ -/*#define YUNHORN_STS_O3_ENABLED */ -/*#define YUNHORN_STS_O4_ENABLED */ -/*#define YUNHORN_STS_O5_ENABLED */ -/*#define YUNHORN_STS_O6_ENABLED */ -/*#define YUNHORN_STS_O7_ENABLED */ -/*#define YUNHORN_STS_O8_ENABLED */ -/*#define YUNHORN_STS_O9_ENABLED */ -/*#define YUNHORN_STS_O10_ENABLED */ - -/*#define YUNHORN_STS_O6_ENABLED */ - -/* YUNHORN SMARTOILETS ENVIRONMENT PRODUCTS */ -/*#define YUNHORN_STS_E1_ENABLED */ -/*#define YUNHORN_STS_E2_ENABLED */ -/*#define YUNHORN_STS_E3_ENABLED */ -/*#define YUNHORN_STS_E4_ENABLED */ -/*#define YUNHORN_STS_E5_ENABLED */ -/*#define YUNHORN_STS_E6_ENABLED */ - - -/* YUNHORN SMARTOILETS PEOPLE COUNTING PRODUCTS */ -/*#define YUNHORN_STS_P1_ENABLED */ -/*#define YUNHORN_STS_P2_ENABLED */ -/*#define YUNHORN_STS_P3_ENABLED */ -/*#define YUNHORN_STS_P4_ENABLED */ -/*#define YUNHORN_STS_P5_ENABLED */ -/*#define YUNHORN_STS_P6_ENABLED */ - -/* YUNHORN SMARTOILETS CLEANSING RESOUCES LEVEL PRODUCTS */ -//#define YUNHORN_STS_R0_ENABLED -//#define YUNHORN_STS_R0_ENABLED -//#define YUNHORN_STS_R2_ENABLED -//#define YUNHORN_STS_R3_ENABLED -//#define YUNHORN_STS_R4_ENABLED - - -/* YUNHORN SMARTOILETS MECHNICAL REACTURAL PRODUCTS */ -/*#define YUNHORN_STS_M1_ENABLED */ -/*#define YUNHORN_STS_M2_ENABLED */ -/*#define YUNHORN_STS_M3_ENABLED */ -/*#define YUNHORN_STS_M4_ENABLED */ -/*#define YUNHORN_STS_M5_ENABLED */ -/*#define YUNHORN_STS_M6_ENABLED */ - -/*#define YUNHORN_STS_M7_ENABLED */ - -/*#define YUNHORN_STS_M8_ENABLED */ -/*#define YUNHORN_STS_M9_ENABLED */ -/*#define YUNHORN_STS_M10_ENABLED */ - -/* YUNHORN SMARTOILETS DIPLAY AND SMART PANEL PRODUCTS */ -/*#define YUNHORN_STS_D1_ENABLED */ -/*#define YUNHORN_STS_D2_ENABLED */ -/*#define YUNHORN_STS_D3_ENABLED */ -/*#define YUNHORN_STS_D4_ENABLED */ -/*#define YUNHORN_STS_D5_ENABLED */ -/*#define YUNHORN_STS_D6_ENABLED */ -/*#define YUNHORN_STS_D7_ENABLED */ -/*#define YUNHORN_STS_D8_ENABLED */ - - - -/** YUNHORN SMARTOILETS DIGITAL SIGNAGE PRODUCTS **/ -/*#define YUNHORN_STS_F1_ENABLED */ -/*#define YUNHORN_STS_F2_ENABLED */ -/*#define YUNHORN_STS_F3_ENABLED */ -/*#define YUNHORN_STS_F4_ENABLED */ -/*#define YUNHORN_STS_F5_ENABLED */ -/*#define YUNHORN_STS_F6_ENABLED */ -/*#define YUNHORN_STS_F7_ENABLED */ -/*#define YUNHORN_STS_F8_ENABLED */ -/*#define YUNHORN_STS_F9_ENABLED */ -/*#define YUNHORN_STS_F10_ENABLED */ - - -/** YUNHORN SMARTOILETS CONNECTIVITY AND GATEWAY PRODUCTS **/ -/*#define YUNHORN_STS_N1_ENABLED */ -/*#define YUNHORN_STS_N2_ENABLED */ -/*#define YUNHORN_STS_N3_ENABLED */ -/*#define YUNHORN_STS_N4_ENABLED */ -/*#define YUNHORN_STS_N5_ENABLED */ -/*#define YUNHORN_STS_N6_ENABLED */ -/*#define YUNHORN_STS_N7_ENABLED */ -/*#define YUNHORN_STS_N8_ENABLED */ - - -/** Includes --------------------------------------------------------- - * @brief YUNHORN SMARTOILETS SENSOR - * LORA-WAN MESSAGE UPLINK DATA PORTS AND HEARTBEAT PORTS DEFINATION - */ - -//#define YUNHORN_STS_O1_LORA_APP_DATA_PORT 4U -//#define YUNHORN_STS_O1_LORA_APP_HTBT_PORT 5U -//#define YUNHORN_STS_O2_LORA_APP_DATA_PORT 4U -//#define YUNHORN_STS_O2_LORA_APP_HTBT_PORT 5U -//#define YUNHORN_STS_O3_LORA_APP_DATA_PORT 4U -//#define YUNHORN_STS_O3_LORA_APP_HTBT_PORT 5U -//#define YUNHORN_STS_O4_LORA_APP_DATA_PORT 56U -//#define YUNHORN_STS_O4_LORA_APP_HTBT_PORT 57U -#ifdef STS_O5 -#define YUNHORN_STS_O5_LORA_APP_DATA_PORT 4U -#define YUNHORN_STS_O5_LORA_APP_HTBT_PORT 5U -#endif - -//#define YUNHORN_STS_O6_LORA_APP_DATA_PORT 17U -//#define YUNHORN_STS_O6_LORA_APP_HTBT_PORT 18U -//#define YUNHORN_STS_O6_USER_APP_CTRL_PORT 2U -//#define YUNHORN_STS_O6_USER_APP_CTRL_REPLY_PORT 1U - -//#define YUNHORN_STS_E1_LORA_APP_DATA_PORT 102U -//#define YUNHORN_STS_E1_LORA_APP_HTBT_PORT 103U -//#define YUNHORN_STS_E2_LORA_APP_DATA_PORT 101U -//#define YUNHORN_STS_E2_LORA_APP_HTBT_PORT 108U -//#define YUNHORN_STS_E3_LORA_APP_DATA_PORT 00U -//#define YUNHORN_STS_E3_LORA_APP_HTBT_PORT 00U - -//#define YUNHORN_STS_E4_LORA_APP_DATA_PORT 70U -//#define YUNHORN_STS_E4_LORA_APP_HTBT_PORT 71U - - #define YUNHORN_STS_USER_APP_CTRL_PORT 2U #define YUNHORN_STS_USER_APP_CTRL_REPLY_PORT 1U @@ -264,17 +142,6 @@ #define sts_appctrlport (YUNHORN_STS_USER_APP_CTRL_PORT) #define sts_appctrl_reply_port (YUNHORN_STS_USER_APP_CTRL_REPLY_PORT) -#ifdef STS_O5 -#define YUNHORN_STS_O5_ENABLED 1U -#define sts_mtmcode1 0U -#define sts_mtmcode2 5U -#define sts_hardware_ver 1U -#define sts_version 1U -#define sts_senddataport (YUNHORN_STS_O5_LORA_APP_DATA_PORT) -#define sts_sendhtbtport (YUNHORN_STS_O5_LORA_APP_HTBT_PORT) -#endif - - //#define NVM_CFG_PARAMETER_SIZE (STS_R0_NVM_CFG_SIZE) diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index ead1122..99487f6 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -59,7 +59,7 @@ void MX_GPIO_Init(void) HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); //__HAL_RCC_GPIOA_CLK_DISABLE(); //__HAL_RCC_GPIOB_CLK_DISABLE(); - //__HAL_RCC_GPIOC_CLK_DISABLE(); + __HAL_RCC_GPIOC_CLK_DISABLE(); /*Configure GPIO pin Output Level */ #if defined(STM32WL55xx) diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 976f390..85199f2 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -633,28 +633,18 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) switch (GPIO_Pin) { case BUT1_Pin: - -#ifdef YUNHORN_STS_O5_ENABLED - UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0); - UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); -#else -// uint8_t pinstate = HAL_GPIO_ReadPin(BUT1_GPIO_Port,BUT1_Pin); -// APP_LOG(TS_OFF, VLEVEL_H, "## BUTTON-1 DETECTED: %2d \r\n", pinstate); - - //if (EventType == TX_ON_EVENT) -// if (pinstate == 1) + if (EventType == TX_ON_EVENT) { +#ifdef YUNHORN_STS_O5_ENABLED + UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0); +#endif UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); - } //else - //{ + } #ifdef LED_ONBOARD LED_ON; HAL_Delay(20); LED_OFF; #endif - //} -#endif - break; case BUT2_Pin: diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index 0210430..6fe7ebf 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -225,6 +225,9 @@ + + +