From 4bfaba7f959d8272c142ae6955e4aaf0860e833d Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Wed, 30 Oct 2024 22:01:36 +0800 Subject: [PATCH] wip O5_JP. falling edge only yet --- Core/Inc/utilities_def.h | 2 +- LoRaWAN/App/lora_app.c | 19 +++++- STM32CubeIDE/.cproject | 4 +- .../Release/Application/User/Core/subdir.mk | 40 +++++------ .../Application/User/LoRaWAN/App/subdir.mk | 8 +-- .../Application/User/LoRaWAN/Target/subdir.mk | 2 +- .../Application/User/STS/Core/Src/subdir.mk | 6 +- .../Application/User/STS/TOF/App/subdir.mk | 6 +- .../Application/User/STS/TOF/Target/subdir.mk | 2 +- .../User/STS/TOF/vl53l0x/subdir.mk | 14 ++-- STM32CubeIDE/Release/Drivers/CMSIS/subdir.mk | 2 +- .../Drivers/STM32WLxx_HAL_Driver/subdir.mk | 48 +++++++------- .../Release/Middlewares/LoRaWAN/subdir.mk | 66 +++++++++---------- .../Release/Middlewares/SubGHz_Phy/subdir.mk | 6 +- STM32CubeIDE/Release/Utilities/subdir.mk | 16 ++--- STS/Core/Inc/yunhorn_sts_prd_conf.h | 14 ++++ STS/Core/Inc/yunhorn_sts_sensors.h | 15 +++++ STS/Core/Src/yunhorn_sts_process.c | 12 ++-- 18 files changed, 162 insertions(+), 120 deletions(-) diff --git a/Core/Inc/utilities_def.h b/Core/Inc/utilities_def.h index 16c631e..22653b4 100644 --- a/Core/Inc/utilities_def.h +++ b/Core/Inc/utilities_def.h @@ -82,7 +82,7 @@ typedef enum /* USER CODE BEGIN CFG_SEQ_Task_Id_t */ CFG_SEQ_Task_YunhornSTSEventRFAC, /* RFAC */ -#if defined(STS_M1)||defined(STS_O6) +#if defined(STS_M1)||defined(STS_O6)||defined(STS_O5) CFG_SEQ_Task_YunhornSTSEventP1, /* REEDSWITCH, IO */ #endif #if defined(STS_O6) diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 63c3b8c..89eaf63 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -514,7 +514,7 @@ void LoRaWAN_Init(void) UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process); -#ifdef STS_M1 +#if defined(STS_M1)||defined(STS_O5) UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_YunhornSTSEventP1_Process); @@ -555,8 +555,9 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { case BUT1_Pin: /* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */ - if (EventType == TX_ON_EVENT) + //if (EventType == TX_ON_EVENT) { + APP_LOG(TS_OFF, VLEVEL_M, "\r\n Button 0 pressed \r\n"); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); } break; @@ -764,6 +765,8 @@ static void SendTxData(void) sts_r_sensor_data_t sts_r4_sensor_data={0}; #elif defined(STS_M1) sts_r_sensor_data_t sts_m1_sensor_data={0}; +#elif defined(STS_O5) + STS_OO_SensorDataTypeDef oo_data; #endif if (LmHandlerIsBusy() == false) @@ -785,6 +788,10 @@ static void SendTxData(void) EnvSensors_Read(&sensor_data); +#ifdef STS_O5 + STS_O5_SENSOR_Read(&oo_data); +#endif + #ifdef STS_R4 //UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), CFG_SEQ_Prio_0); //STS_YunhornSTSEventP6_Process(); @@ -829,6 +836,9 @@ static void SendTxData(void) #ifdef STS_M1 // WATER LEAKAGE SENSOR AppData.Port = YUNHORN_STS_M1_LORA_APP_DATA_PORT; /* STS-M1 Data Port */ #endif +#ifdef STS_O5 + AppData.Port = YUNHORN_STS_O5_LORA_APP_DATA_PORT; /* STS-O5 Data Port */ +#endif AppData.Buffer[i++] = (uint8_t) (AppLedStateOn|0x80); // for first byte, cannot be 0x0 AppData.Buffer[i++] = (uint8_t) sts_mtmcode1; @@ -909,6 +919,11 @@ static void SendTxData(void) #endif /* CAYENNE_LPP */ +#ifdef STS_O5 + AppData.Buffer[i++] = 1; + AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff; +#endif + #ifdef VL53L0 //VL53L0 #if (defined(STS_R1)||defined(STS_R5)) diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index f6d209d..5bf6f2e 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -133,9 +133,7 @@