diff --git a/Core/Inc/main.h b/Core/Inc/main.h index 9bdeeec..d870785 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -213,18 +213,35 @@ void Error_Handler(void); #endif -#ifdef STM32WLE5xx + #define I2C2_SCL_PIN GPIO_PIN_12 #define I2C2_SDA_PIN GPIO_PIN_11 #define I2C2_SCL_PORT GPIOA #define I2C2_SDA_PORT GPIOA // FOR STM32WLE5CCU6 UFQFPN48 PA12 PA11 +#ifndef STM32WLE5xx #define I2C2_STANDARD_100K 0x00000E14 #define I2C2_FAST_400K 0x00000004 #define I2C2_FAST_PLUS_1M 0x00000000 #endif +/* + * FOR STM32WLE5CCU6 UFQFPN48 PA12 PA11 + * +#define I2C2_STANDARD_100K 0x00000E14 +#define I2C2_FAST_400K 0x00000004 +#define I2C2_FAST_PLUS_1M 0x00000000 +*/ + +/* + * FOR STM32WL55JCIX UFBGA73 PA12 PA11 + */ + +#define I2C2_STANDARD_100K 0x10805D88 +#define I2C2_FAST_400K 0x0090194B +#define I2C2_FAST_PLUS_1M 0x00700814 + #if defined(STS_R4) /* IF_SOAP_IN, MEMS_IF_3, PA10 */ #define SOAP_STATUS_Pin GPIO_PIN_10 diff --git a/Core/Inc/platform.h b/Core/Inc/platform.h index 6bb9bf9..1f78fbb 100644 --- a/Core/Inc/platform.h +++ b/Core/Inc/platform.h @@ -28,9 +28,9 @@ extern "C" { /* Exported constants --------------------------------------------------------*/ -//#define USE_BSP_DRIVER +#define USE_BSP_DRIVER /* USER CODE BEGIN EC */ -#define YUNHORN_STS_WLE5CCxx 1 +//#define YUNHORN_STS_WLE5CCxx 1 /* USER CODE END EC */ /* Includes ------------------------------------------------------------------*/ diff --git a/Core/Inc/utilities_def.h b/Core/Inc/utilities_def.h index 32a810d..16c631e 100644 --- a/Core/Inc/utilities_def.h +++ b/Core/Inc/utilities_def.h @@ -92,7 +92,7 @@ typedef enum #if defined(STS_R1)||defined(STS_R1D)||defined(STS_R5)||defined(STS_R2) CFG_SEQ_Task_YunhornSTSEventP4, /* TOF RANGE */ #endif -#if defined(STS_P2)||defined(STS_T6) +#if defined(STS_P2)||defined(STS_T6)||defined(L8) CFG_SEQ_Task_YunhornSTSEventP5, /* TOF IN-OUT */ #endif #ifdef STS_R4 diff --git a/Core/Src/i2c.c b/Core/Src/i2c.c index 679baa3..6d4c951 100644 --- a/Core/Src/i2c.c +++ b/Core/Src/i2c.c @@ -43,7 +43,7 @@ void MX_I2C2_Init(void) /* USER CODE END I2C2_Init 1 */ hi2c2.Instance = I2C2; - hi2c2.Init.Timing = I2C2_STANDARD_100K; //I2C2_FAST_400K; + hi2c2.Init.Timing = I2C2_FAST_PLUS_1M; hi2c2.Init.OwnAddress1 = 0; hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; diff --git a/Core/Src/main.c b/Core/Src/main.c index 0d59c2d..9b28119 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -103,19 +103,18 @@ int main(void) MX_GPIO_Init(); MX_I2C2_Init(); - //MX_DMA_Init(); + MX_DMA_Init(); MX_LoRaWAN_Init(); /* USER CODE BEGIN 2 */ MX_USART2_UART_Init(); /* USER CODE END 2 */ - //MX_TOF_Init(); - /* Infinite loop */ + /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ - MX_TOF_Process(); + MX_LoRaWAN_Process(); /* USER CODE BEGIN 3 */ diff --git a/Core/Src/usart_if.c b/Core/Src/usart_if.c index 9f0331e..7a9a992 100644 --- a/Core/Src/usart_if.c +++ b/Core/Src/usart_if.c @@ -127,8 +127,8 @@ UTIL_ADV_TRACE_Status_t vcom_DeInit(void) /* ##-3- Disable the NVIC for DMA ########################################### */ /* USER CODE BEGIN 1 */ - HAL_NVIC_DisableIRQ(DMA1_Channel5_IRQn); - + HAL_NVIC_DisableIRQ(DMA1_Channel6_IRQn); + HAL_NVIC_DisableIRQ(DMA1_Channel7_IRQn); return UTIL_ADV_TRACE_OK; /* USER CODE END 1 */ /* USER CODE BEGIN vcom_DeInit_2 */ diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 2a6c8ef..a9a61f0 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -50,7 +50,7 @@ extern volatile sts_cfg_nvm_t sts_cfg_nvm; extern volatile uint32_t rfac_timer; extern volatile uint32_t STS_TOFScanPeriod_msec, STS_TxPeriod_sec, STS_HeartBeatTimerPeriod_sec; volatile uint8_t sts_data_buf[LORAWAN_APP_DATA_BUFFER_MAX_SIZE]={0x0}; -volatile LmHandlerAppData_t sts_app_data={ 0, 0, sts_data_buf }; +//volatile LmHandlerAppData_t sts_app_data={ 0, 0, sts_data_buf }; /* USER CODE END EV */ @@ -419,7 +419,7 @@ void LoRaWAN_Init(void) uint32_t feature_version = 0UL; /* USER CODE END LoRaWAN_Init_LV */ - APP_LOG(TS_OFF, VLEVEL_M, "\n\n# YUNHORN SMARTOILETS: (%s) MTM:%d.%d HWFW:%d.%d V:%d.%d.%d #\n\n",(char*)YUNHORN_STS_PRD_STRING, + APP_LOG(TS_OFF, VLEVEL_M, "\n\r# YUNHORN SMARTOILETS: (%s) MTM:%d.%d HWFW:%d.%d V:%d.%d.%d #\n\r",(char*)YUNHORN_STS_PRD_STRING, (uint8_t)sts_mtmcode1, (uint8_t)sts_mtmcode2,(uint8_t)sts_hardware_ver,(uint8_t)FirmwareVersion, (uint8_t)MajorVer,(uint8_t)MinorVer,(uint8_t)SubMinorVer); /* USER CODE BEGIN LoRaWAN_Init_1 */ @@ -518,7 +518,7 @@ void LoRaWAN_Init(void) #endif -#if defined(STS_P2)||defined(STS_T6) +#if defined(STS_P2)||defined(STS_T6)||defined(L8) UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), UTIL_SEQ_RFU, STS_YunhornSTSEventP5_Process); @@ -532,8 +532,8 @@ void LoRaWAN_Init(void) UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), UTIL_SEQ_RFU, STS_YunhornSTSEventP4_Process); #endif -#if defined(STS_P2)||defined(STS_T6) - UTIL_TIMER_Create(&YunhornSTSWakeUpScanTimer, STS_TOFScanPeriod_msec, UTIL_TIMER_PERIODIC, (void*)OnYunhornSTSWakeUpScanTimerEvent, NULL); +#if defined(STS_P2)||defined(STS_T6)||defined(L8) + UTIL_TIMER_Create(&YunhornSTSWakeUpScanTimer, STS_TOFScanPeriod_msec, UTIL_TIMER_ONESHOT, (void*)OnYunhornSTSWakeUpScanTimerEvent, NULL); UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer); #endif @@ -841,6 +841,9 @@ static void SendTxData(void) AppData.Port = YUNHORN_STS_P2_LORA_APP_DATA_PORT; /* STS-P2 Data Port */ #elif defined(STS_T6) AppData.Port = YUNHORN_STS_T6_LORA_APP_DATA_PORT; /* STS-T6 Data Port */ +#elif defined(L8) + AppData.Port = YUNHORN_STS_L8_LORA_APP_DATA_PORT; /* STS-L8 Data Port */ + #endif #ifdef CAYENNE_LPP @@ -954,6 +957,14 @@ static void SendTxData(void) AppData.Buffer[i++] = (uint8_t)((sts_t6_sensor_data.tof_range_presence_state & 0xFF)); #endif //STS_T6 + +#if defined(L8) + AppData.Buffer[i++] = 1; + AppData.Buffer[i++] = 8; //testing + //(uint8_t)((sts_l8_sensor_data.tof_range_presence_state & 0xFF)); + +#endif //STS_T6 + /* STS-R4 SOAP LEVEL SENSOR */ #ifdef STS_R4 AppData.Buffer[i++] = 2; @@ -1105,6 +1116,7 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams) APP_LOG(TS_OFF, VLEVEL_H, "###### U/L FRAME:JOIN | DR:%d | PWR:%d\r\n", joinParams->Datarate, joinParams->TxPower); } + UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer); /* USER CODE END OnJoinRequest_1 */ } @@ -1470,7 +1482,7 @@ void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity) /* USER CODE BEGIN PrFD_YunhornSTSWakeUpScanTimerEvents */ static void OnYunhornSTSWakeUpScanTimerEvent(void *context) { -#if defined(STS_P2)||defined(STS_T6) +#if defined(STS_P2)||defined(STS_T6)||defined(L8) UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), CFG_SEQ_Prio_0); UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer); diff --git a/LoRaWAN/Target/radio_board_if.h b/LoRaWAN/Target/radio_board_if.h index 187e0d4..09d8e4d 100644 --- a/LoRaWAN/Target/radio_board_if.h +++ b/LoRaWAN/Target/radio_board_if.h @@ -151,6 +151,12 @@ typedef enum RBI_SWITCH_RFO_LP = RADIO_SWITCH_RFO_LP, RBI_SWITCH_RFO_HP = RADIO_SWITCH_RFO_HP, } RBI_Switch_TypeDef; +typedef enum +{ + RBI_RFO_LP_MAXPOWER = 0, + RBI_RFO_HP_MAXPOWER = 1, +} RBI_RFOMaxPowerConfig_TypeDef; + #elif defined(YUNHORN_STS_WLE5CCxx) typedef enum { diff --git a/README.md b/README.md index f81cc4b..6669d88 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,4 @@ 2024 09 20 START RR 2024 09 25 START R1D 2024 09 27 GOOD STS-R4 on single board RM2_1 + 2024 10 24 START L8M with workable L8 diff --git a/STM32CubeIDE/Release/Application/User/STS/TOF/App_l1cb/Src/subdir.mk b/STM32CubeIDE/Release/Application/User/STS/TOF/App_l1cb/Src/subdir.mk new file mode 100644 index 0000000..acbe69a --- /dev/null +++ b/STM32CubeIDE/Release/Application/User/STS/TOF/App_l1cb/Src/subdir.mk @@ -0,0 +1,9 @@ +################################################################################ +# Automatically-generated file. Do not edit! +# Toolchain: GNU Tools for STM32 (12.3.rel1) +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables + +# Each subdirectory must supply rules for building sources it contributes + diff --git a/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/modules/subdir.mk b/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/modules/subdir.mk new file mode 100644 index 0000000..acbe69a --- /dev/null +++ b/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/modules/subdir.mk @@ -0,0 +1,9 @@ +################################################################################ +# Automatically-generated file. Do not edit! +# Toolchain: GNU Tools for STM32 (12.3.rel1) +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables + +# Each subdirectory must supply rules for building sources it contributes + diff --git a/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/porting/subdir.mk b/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/porting/subdir.mk new file mode 100644 index 0000000..acbe69a --- /dev/null +++ b/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/porting/subdir.mk @@ -0,0 +1,9 @@ +################################################################################ +# Automatically-generated file. Do not edit! +# Toolchain: GNU Tools for STM32 (12.3.rel1) +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables + +# Each subdirectory must supply rules for building sources it contributes + diff --git a/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/subdir.mk b/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/subdir.mk new file mode 100644 index 0000000..acbe69a --- /dev/null +++ b/STM32CubeIDE/Release/Application/User/STS/TOF/vl53l1cb/subdir.mk @@ -0,0 +1,9 @@ +################################################################################ +# Automatically-generated file. Do not edit! +# Toolchain: GNU Tools for STM32 (12.3.rel1) +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables + +# Each subdirectory must supply rules for building sources it contributes + diff --git a/STM32CubeIDE/Release/Drivers/BSP/53L8A1/subdir.mk b/STM32CubeIDE/Release/Drivers/BSP/53L8A1/subdir.mk new file mode 100644 index 0000000..5e87a83 --- /dev/null +++ b/STM32CubeIDE/Release/Drivers/BSP/53L8A1/subdir.mk @@ -0,0 +1,27 @@ +################################################################################ +# Automatically-generated file. Do not edit! +# Toolchain: GNU Tools for STM32 (12.3.rel1) +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/ONEDRIVE/STM32WLV13/Drivers/BSP/53L8A1/53l8a1_ranging_sensor.c + +OBJS += \ +./Drivers/BSP/53L8A1/53l8a1_ranging_sensor.o + +C_DEPS += \ +./Drivers/BSP/53L8A1/53l8a1_ranging_sensor.d + + +# Each subdirectory must supply rules for building sources it contributes +Drivers/BSP/53L8A1/53l8a1_ranging_sensor.o: D:/ONEDRIVE/STM32WLV13/Drivers/BSP/53L8A1/53l8a1_ranging_sensor.c Drivers/BSP/53L8A1/subdir.mk + arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -DL8 -DCORE_CM4 -DUSE_HAL_DRIVER -DSTM32WLE5xx -c -I../../Core/Inc -I../../STS/Core/Inc -I../../STS/TOF/App -I../../STS/TOF/Target -I../../STS/TOF/vl53l1x_uld -I../../STS/TOF/vl53l0x -I../../LoRaWAN/App -I../../LoRaWAN/Target -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc/Legacy -I../../../../../../../Utilities/trace/adv_trace -I../../../../../../../Utilities/misc -I../../../../../../../Utilities/sequencer -I../../../../../../../Utilities/timer -I../../../../../../../Utilities/lpm/tiny_lpm -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler/Packages -I../../../../../../../Drivers/CMSIS/Device/ST/STM32WLxx/Include -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Crypto -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac/Region -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Utilities -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver -I../../../../../../../Middlewares/ST/STM32_Cryptographic/include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32WLxx_Nucleo -I../../../../../../../Drivers/BSP/Components/vl53l8cx/porting -I../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../Drivers/BSP/53L8A1 -I../../../../../../../Drivers/BSP/Components/vl53l8cx/modules -I../../../../../../../Drivers/BSP/Components/vl53l8cx -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + +clean: clean-Drivers-2f-BSP-2f-53L8A1 + +clean-Drivers-2f-BSP-2f-53L8A1: + -$(RM) ./Drivers/BSP/53L8A1/53l8a1_ranging_sensor.cyclo ./Drivers/BSP/53L8A1/53l8a1_ranging_sensor.d ./Drivers/BSP/53L8A1/53l8a1_ranging_sensor.o ./Drivers/BSP/53L8A1/53l8a1_ranging_sensor.su + +.PHONY: clean-Drivers-2f-BSP-2f-53L8A1 + diff --git a/STM32CubeIDE/Release/Drivers/BSP/Components/subdir.mk b/STM32CubeIDE/Release/Drivers/BSP/Components/subdir.mk new file mode 100644 index 0000000..81bdd0e --- /dev/null +++ b/STM32CubeIDE/Release/Drivers/BSP/Components/subdir.mk @@ -0,0 +1,52 @@ +################################################################################ +# Automatically-generated file. Do not edit! +# Toolchain: GNU Tools for STM32 (12.3.rel1) +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/vl53l8cx.c \ +D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/modules/vl53l8cx_api.c \ +D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/modules/vl53l8cx_plugin_detection_thresholds.c \ +D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/modules/vl53l8cx_plugin_motion_indicator.c \ +D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/modules/vl53l8cx_plugin_xtalk.c \ +D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/porting/wle5cc_platform.c + +OBJS += \ +./Drivers/BSP/Components/vl53l8cx.o \ +./Drivers/BSP/Components/vl53l8cx_api.o \ +./Drivers/BSP/Components/vl53l8cx_plugin_detection_thresholds.o \ +./Drivers/BSP/Components/vl53l8cx_plugin_motion_indicator.o \ +./Drivers/BSP/Components/vl53l8cx_plugin_xtalk.o \ +./Drivers/BSP/Components/wle5cc_platform.o + +C_DEPS += \ +./Drivers/BSP/Components/vl53l8cx.d \ +./Drivers/BSP/Components/vl53l8cx_api.d \ +./Drivers/BSP/Components/vl53l8cx_plugin_detection_thresholds.d \ +./Drivers/BSP/Components/vl53l8cx_plugin_motion_indicator.d \ +./Drivers/BSP/Components/vl53l8cx_plugin_xtalk.d \ +./Drivers/BSP/Components/wle5cc_platform.d + + +# Each subdirectory must supply rules for building sources it contributes +Drivers/BSP/Components/vl53l8cx.o: D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/vl53l8cx.c Drivers/BSP/Components/subdir.mk + arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -DL8 -DCORE_CM4 -DUSE_HAL_DRIVER -DSTM32WLE5xx -c -I../../Core/Inc -I../../STS/Core/Inc -I../../STS/TOF/App -I../../STS/TOF/Target -I../../STS/TOF/vl53l1x_uld -I../../STS/TOF/vl53l0x -I../../LoRaWAN/App -I../../LoRaWAN/Target -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc/Legacy -I../../../../../../../Utilities/trace/adv_trace -I../../../../../../../Utilities/misc -I../../../../../../../Utilities/sequencer -I../../../../../../../Utilities/timer -I../../../../../../../Utilities/lpm/tiny_lpm -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler/Packages -I../../../../../../../Drivers/CMSIS/Device/ST/STM32WLxx/Include -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Crypto -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac/Region -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Utilities -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver -I../../../../../../../Middlewares/ST/STM32_Cryptographic/include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32WLxx_Nucleo -I../../../../../../../Drivers/BSP/Components/vl53l8cx/porting -I../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../Drivers/BSP/53L8A1 -I../../../../../../../Drivers/BSP/Components/vl53l8cx/modules -I../../../../../../../Drivers/BSP/Components/vl53l8cx -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/BSP/Components/vl53l8cx_api.o: D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/modules/vl53l8cx_api.c Drivers/BSP/Components/subdir.mk + arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -DL8 -DCORE_CM4 -DUSE_HAL_DRIVER -DSTM32WLE5xx -c -I../../Core/Inc -I../../STS/Core/Inc -I../../STS/TOF/App -I../../STS/TOF/Target -I../../STS/TOF/vl53l1x_uld -I../../STS/TOF/vl53l0x -I../../LoRaWAN/App -I../../LoRaWAN/Target -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc/Legacy -I../../../../../../../Utilities/trace/adv_trace -I../../../../../../../Utilities/misc -I../../../../../../../Utilities/sequencer -I../../../../../../../Utilities/timer -I../../../../../../../Utilities/lpm/tiny_lpm -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler/Packages -I../../../../../../../Drivers/CMSIS/Device/ST/STM32WLxx/Include -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Crypto -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac/Region -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Utilities -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver -I../../../../../../../Middlewares/ST/STM32_Cryptographic/include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32WLxx_Nucleo -I../../../../../../../Drivers/BSP/Components/vl53l8cx/porting -I../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../Drivers/BSP/53L8A1 -I../../../../../../../Drivers/BSP/Components/vl53l8cx/modules -I../../../../../../../Drivers/BSP/Components/vl53l8cx -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/BSP/Components/vl53l8cx_plugin_detection_thresholds.o: D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/modules/vl53l8cx_plugin_detection_thresholds.c Drivers/BSP/Components/subdir.mk + arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -DL8 -DCORE_CM4 -DUSE_HAL_DRIVER -DSTM32WLE5xx -c -I../../Core/Inc -I../../STS/Core/Inc -I../../STS/TOF/App -I../../STS/TOF/Target -I../../STS/TOF/vl53l1x_uld -I../../STS/TOF/vl53l0x -I../../LoRaWAN/App -I../../LoRaWAN/Target -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc/Legacy -I../../../../../../../Utilities/trace/adv_trace -I../../../../../../../Utilities/misc -I../../../../../../../Utilities/sequencer -I../../../../../../../Utilities/timer -I../../../../../../../Utilities/lpm/tiny_lpm -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler/Packages -I../../../../../../../Drivers/CMSIS/Device/ST/STM32WLxx/Include -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Crypto -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac/Region -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Utilities -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver -I../../../../../../../Middlewares/ST/STM32_Cryptographic/include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32WLxx_Nucleo -I../../../../../../../Drivers/BSP/Components/vl53l8cx/porting -I../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../Drivers/BSP/53L8A1 -I../../../../../../../Drivers/BSP/Components/vl53l8cx/modules -I../../../../../../../Drivers/BSP/Components/vl53l8cx -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/BSP/Components/vl53l8cx_plugin_motion_indicator.o: D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/modules/vl53l8cx_plugin_motion_indicator.c Drivers/BSP/Components/subdir.mk + arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -DL8 -DCORE_CM4 -DUSE_HAL_DRIVER -DSTM32WLE5xx -c -I../../Core/Inc -I../../STS/Core/Inc -I../../STS/TOF/App -I../../STS/TOF/Target -I../../STS/TOF/vl53l1x_uld -I../../STS/TOF/vl53l0x -I../../LoRaWAN/App -I../../LoRaWAN/Target -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc/Legacy -I../../../../../../../Utilities/trace/adv_trace -I../../../../../../../Utilities/misc -I../../../../../../../Utilities/sequencer -I../../../../../../../Utilities/timer -I../../../../../../../Utilities/lpm/tiny_lpm -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler/Packages -I../../../../../../../Drivers/CMSIS/Device/ST/STM32WLxx/Include -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Crypto -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac/Region -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Utilities -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver -I../../../../../../../Middlewares/ST/STM32_Cryptographic/include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32WLxx_Nucleo -I../../../../../../../Drivers/BSP/Components/vl53l8cx/porting -I../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../Drivers/BSP/53L8A1 -I../../../../../../../Drivers/BSP/Components/vl53l8cx/modules -I../../../../../../../Drivers/BSP/Components/vl53l8cx -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/BSP/Components/vl53l8cx_plugin_xtalk.o: D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/modules/vl53l8cx_plugin_xtalk.c Drivers/BSP/Components/subdir.mk + arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -DL8 -DCORE_CM4 -DUSE_HAL_DRIVER -DSTM32WLE5xx -c -I../../Core/Inc -I../../STS/Core/Inc -I../../STS/TOF/App -I../../STS/TOF/Target -I../../STS/TOF/vl53l1x_uld -I../../STS/TOF/vl53l0x -I../../LoRaWAN/App -I../../LoRaWAN/Target -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc/Legacy -I../../../../../../../Utilities/trace/adv_trace -I../../../../../../../Utilities/misc -I../../../../../../../Utilities/sequencer -I../../../../../../../Utilities/timer -I../../../../../../../Utilities/lpm/tiny_lpm -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler/Packages -I../../../../../../../Drivers/CMSIS/Device/ST/STM32WLxx/Include -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Crypto -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac/Region -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Utilities -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver -I../../../../../../../Middlewares/ST/STM32_Cryptographic/include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32WLxx_Nucleo -I../../../../../../../Drivers/BSP/Components/vl53l8cx/porting -I../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../Drivers/BSP/53L8A1 -I../../../../../../../Drivers/BSP/Components/vl53l8cx/modules -I../../../../../../../Drivers/BSP/Components/vl53l8cx -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/BSP/Components/wle5cc_platform.o: D:/ONEDRIVE/STM32WLV13/Drivers/BSP/Components/vl53l8cx/porting/wle5cc_platform.c Drivers/BSP/Components/subdir.mk + arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -DL8 -DCORE_CM4 -DUSE_HAL_DRIVER -DSTM32WLE5xx -c -I../../Core/Inc -I../../STS/Core/Inc -I../../STS/TOF/App -I../../STS/TOF/Target -I../../STS/TOF/vl53l1x_uld -I../../STS/TOF/vl53l0x -I../../LoRaWAN/App -I../../LoRaWAN/Target -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc -I../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc/Legacy -I../../../../../../../Utilities/trace/adv_trace -I../../../../../../../Utilities/misc -I../../../../../../../Utilities/sequencer -I../../../../../../../Utilities/timer -I../../../../../../../Utilities/lpm/tiny_lpm -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler/Packages -I../../../../../../../Drivers/CMSIS/Device/ST/STM32WLxx/Include -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Crypto -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac/Region -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac -I../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler -I../../../../../../../Middlewares/Third_Party/LoRaWAN/Utilities -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy -I../../../../../../../Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver -I../../../../../../../Middlewares/ST/STM32_Cryptographic/include -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/BSP/STM32WLxx_Nucleo -I../../../../../../../Drivers/BSP/Components/vl53l8cx/porting -I../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../Drivers/BSP/53L8A1 -I../../../../../../../Drivers/BSP/Components/vl53l8cx/modules -I../../../../../../../Drivers/BSP/Components/vl53l8cx -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + +clean: clean-Drivers-2f-BSP-2f-Components + +clean-Drivers-2f-BSP-2f-Components: + -$(RM) ./Drivers/BSP/Components/vl53l8cx.cyclo ./Drivers/BSP/Components/vl53l8cx.d ./Drivers/BSP/Components/vl53l8cx.o ./Drivers/BSP/Components/vl53l8cx.su ./Drivers/BSP/Components/vl53l8cx_api.cyclo ./Drivers/BSP/Components/vl53l8cx_api.d ./Drivers/BSP/Components/vl53l8cx_api.o ./Drivers/BSP/Components/vl53l8cx_api.su ./Drivers/BSP/Components/vl53l8cx_plugin_detection_thresholds.cyclo ./Drivers/BSP/Components/vl53l8cx_plugin_detection_thresholds.d ./Drivers/BSP/Components/vl53l8cx_plugin_detection_thresholds.o ./Drivers/BSP/Components/vl53l8cx_plugin_detection_thresholds.su ./Drivers/BSP/Components/vl53l8cx_plugin_motion_indicator.cyclo ./Drivers/BSP/Components/vl53l8cx_plugin_motion_indicator.d ./Drivers/BSP/Components/vl53l8cx_plugin_motion_indicator.o ./Drivers/BSP/Components/vl53l8cx_plugin_motion_indicator.su ./Drivers/BSP/Components/vl53l8cx_plugin_xtalk.cyclo ./Drivers/BSP/Components/vl53l8cx_plugin_xtalk.d ./Drivers/BSP/Components/vl53l8cx_plugin_xtalk.o ./Drivers/BSP/Components/vl53l8cx_plugin_xtalk.su ./Drivers/BSP/Components/wle5cc_platform.cyclo ./Drivers/BSP/Components/wle5cc_platform.d ./Drivers/BSP/Components/wle5cc_platform.o ./Drivers/BSP/Components/wle5cc_platform.su + +.PHONY: clean-Drivers-2f-BSP-2f-Components + diff --git a/STS/Core/Inc/yunhorn_sts_prd_conf.h b/STS/Core/Inc/yunhorn_sts_prd_conf.h index 3ab47c6..4d1b42e 100644 --- a/STS/Core/Inc/yunhorn_sts_prd_conf.h +++ b/STS/Core/Inc/yunhorn_sts_prd_conf.h @@ -39,8 +39,8 @@ * MODULE SELECTION */ //#define USE_OLED_SSD1306 -#define STS_USE_TOF_VL53L1X -#define STS_USE_TOF_VL53L0X 1U +//#define STS_USE_TOF_VL53L1X +//#define STS_USE_TOF_VL53L0X 1U #ifdef STS_R1 /* STS R1 for single roll */ #define YUNHORN_STS_R1_ENABLED 1U diff --git a/STS/Core/Src/yunhorn_sts_process.c b/STS/Core/Src/yunhorn_sts_process.c index d1b477e..8b7907c 100644 --- a/STS/Core/Src/yunhorn_sts_process.c +++ b/STS/Core/Src/yunhorn_sts_process.c @@ -112,7 +112,7 @@ volatile uint8_t sts_work_mode=4; volatile uint32_t rfac_timer=0; volatile uint16_t sts_sensor_install_height=3000; volatile uint8_t sensor_data_ready=0; -volatile uint32_t STS_TOFScanPeriod_msec=250, STS_TxPeriod_sec=10, STS_HeartBeatTimerPeriod_sec=60; +volatile uint32_t STS_TOFScanPeriod_msec=500, STS_TxPeriod_sec=10, STS_HeartBeatTimerPeriod_sec=60; static uint8_t outbuf[128]={0x0}; extern volatile hmac_result_t hmac_result; extern uint16_t sensor_id; @@ -435,6 +435,7 @@ void STS_YunhornSTSEventP5_Process(void) #elif defined(L8) //STS_TOF_VL53L8X_Process(); MX_TOF_Process(); + //MX_TOF_Ranging_Process(); #endif } @@ -1686,7 +1687,7 @@ void STS_SENSOR_Distance_Test_Process(void) APP_LOG(TS_OFF, VLEVEL_M, "\r\nSensor Function Test: Distance Measured =%u mm\r\n", (int)sts_distance_rss_distance); #endif -#if defined(VL53LX) +#if defined(VL53LX)||defined(L8) //MX_TOF_Init(); //MX_TOF_Process(); sts_sensor_install_height = (uint16_t)MX_TOF_Ranging_Process(); diff --git a/STS/TOF/App/app_tof.c b/STS/TOF/App/app_tof.c index 7b689ee..45367e7 100644 --- a/STS/TOF/App/app_tof.c +++ b/STS/TOF/App/app_tof.c @@ -36,7 +36,7 @@ extern "C" { #include "app_tof_pin_conf.h" #endif #include "stm32wlxx_nucleo.h" - +int example11(void); /* Private typedef -----------------------------------------------------------*/ /* * The application is to showcase the threshold detection @@ -70,12 +70,14 @@ extern "C" { /* for VL53L8A1 */ #define RANGING_FREQUENCY (10U) /* Ranging frequency Hz (shall be consistent with TimingBudget value) */ #define LOW_THRESHOLD (200U) -#define HIGH_THRESHOLD (600U) +#define HIGH_THRESHOLD (1200U) /* Private variables ---------------------------------------------------------*/ static RANGING_SENSOR_Capabilities_t Cap; static RANGING_SENSOR_ProfileConfig_t Profile; static RANGING_SENSOR_Result_t Result; +//static VL53L8CX_ResultsData L8CXResult; +//static VL53L8CX_Motion_Configuration motion_config; /* Motion configuration*/ static void MX_53L8A1_ThresholdDetection_Init(void); static void MX_53L8A1_ThresholdDetection_Process(void); @@ -113,6 +115,8 @@ void MX_TOF_Init(void) //STS_TOF_VL53LX_PeopleCounting_Process(); #ifdef L8 MX_53L8A1_ThresholdDetection_Init(); + MX_53L8A1_ThresholdDetection_Process(); + #endif /* USER CODE BEGIN TOF_Init_PostTreatment */ @@ -133,6 +137,36 @@ uint16_t MX_TOF_Ranging_Process(void) STS_TOF_VL53LX_Range_Process(range_mode, &range_distance); APP_LOG(TS_OFF, VLEVEL_M, "\n VL53L1 Range distance =%u mm \n\r", (uint16_t)range_distance); + return (uint16_t) range_distance; +#elif defined(L8) + uint16_t range_distance=0; + uint8_t center_roi[4] = {27,28,35,36}; + uint8_t range_mode = 2; //STS_TOF_LONG_RANGE; + int32_t status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result); + + printf("\r| 27 | 28 | 35 | 36 |\r\n"); + + for (uint8_t zone_nbr = 0; zone_nbr < 4; zone_nbr++) + { + /* Print distance and status */ + if (Result.ZoneResult[center_roi[zone_nbr]].NumberOfTargets > 0) + { + printf("| %04ld %2ld", + (long)Result.ZoneResult[center_roi[zone_nbr]].Distance[RANGING_SENSOR_NB_TARGET_PER_ZONE-1], + (long)Result.ZoneResult[center_roi[zone_nbr]].Status[RANGING_SENSOR_NB_TARGET_PER_ZONE-1]); + } + else { + printf("| -- "); + } + + range_distance += Result.ZoneResult[center_roi[zone_nbr]].Distance[RANGING_SENSOR_NB_TARGET_PER_ZONE-1]; + + } + //printf("\n\r"); + + range_distance /=4; + printf("| %u mm\r\n", (uint16_t)range_distance); + return (uint16_t) range_distance; #endif @@ -150,16 +184,56 @@ void MX_TOF_Process(void) //sts_tof_vl53lx_peoplecount_subprocess(); #ifdef L8 - MX_53L8A1_ThresholdDetection_Process(); + //MX_53L8A1_ThresholdDetection_Process(); + STS_TOF_L8_Process(); + #endif /* USER CODE BEGIN TOF_Process_PostTreatment */ /* USER CODE END TOF_Process_PostTreatment */ } - - #ifdef L8 +void STS_TOF_L8_Process(void) +{ + //while (1) + { + /* interrupt mode */ + if (ToF_EventDetected != 0) + { + ToF_EventDetected = 0; + + status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result); + + if (status == BSP_ERROR_NONE) + { + print_result(&Result); + } + } + } +} +#endif + +void STS_Reset_Sensor(void) +{ +/* Sensor reset */ + + HAL_GPIO_WritePin(VL53L8A1_PWR_EN_C_PORT, VL53L8A1_PWR_EN_C_PIN, GPIO_PIN_RESET); + + //HAL_Delay(50); + + HAL_GPIO_WritePin(VL53L8A1_PWR_EN_C_PORT, VL53L8A1_PWR_EN_C_PIN, GPIO_PIN_SET); + //HAL_Delay(50); + + HAL_GPIO_WritePin(VL53L8A1_LPn_C_PORT, VL53L8A1_LPn_C_PIN, GPIO_PIN_RESET); + + //HAL_Delay(50); + + HAL_GPIO_WritePin(VL53L8A1_LPn_C_PORT, VL53L8A1_LPn_C_PIN, GPIO_PIN_SET); + //HAL_Delay(50); + +} + /* VL53L8A1 */ static void MX_53L8A1_ThresholdDetection_Init(void) { @@ -184,9 +258,9 @@ static void MX_53L8A1_ThresholdDetection_Init(void) if (status != BSP_ERROR_NONE) { printf("VL53L8A1_RANGING_SENSOR_Init failed\n"); - while (1); + //while (1); } - printf("\r\nVL53L8A1_RANGING_SENSOR_Init Success\r\n"); + } static void MX_53L8A1_ThresholdDetection_Process(void) @@ -197,7 +271,7 @@ static void MX_53L8A1_ThresholdDetection_Process(void) VL53L8A1_RANGING_SENSOR_ReadID(VL53L8A1_DEV_CENTER, &Id); VL53L8A1_RANGING_SENSOR_GetCapabilities(VL53L8A1_DEV_CENTER, &Cap); - + printf("\n detection process, after get capabilities\r\n"); Profile.RangingProfile = RS_PROFILE_8x8_AUTONOMOUS; Profile.TimingBudget = TIMING_BUDGET; Profile.Frequency = RANGING_FREQUENCY; /* Ranging frequency Hz (shall be consistent with TimingBudget value) */ @@ -214,6 +288,7 @@ static void MX_53L8A1_ThresholdDetection_Process(void) VL53L8A1_RANGING_SENSOR_ConfigIT(VL53L8A1_DEV_CENTER, &ITConfig); + status = VL53L8A1_RANGING_SENSOR_Start(VL53L8A1_DEV_CENTER, RS_MODE_ASYNC_CONTINUOUS); if (status != BSP_ERROR_NONE) @@ -227,8 +302,8 @@ static void MX_53L8A1_ThresholdDetection_Process(void) printf("-------------------------------------------\n\r"); printf("please put a target between %d and %d millimeters from the sensor\n\r", LOW_THRESHOLD, HIGH_THRESHOLD); - - while (1) +#if 0 + //while (1) { /* interrupt mode */ if (ToF_EventDetected != 0) @@ -243,6 +318,7 @@ static void MX_53L8A1_ThresholdDetection_Process(void) } } } +#endif } static void print_result(RANGING_SENSOR_Result_t *Result) @@ -258,15 +334,15 @@ static void print_result(RANGING_SENSOR_Result_t *Result) printf("%c[2H", 27); /* clear screen */ printf("53L8A1 Threshold Detection demo application\n\r"); - printf("-------------------------------------------\n\n\r"); - - printf("Cell Format :\n\n\r"); + printf("-------------------------------------------"); + printf("-------- Low= %4d High= %4d ------------", LOW_THRESHOLD, HIGH_THRESHOLD); + printf("Cell Format :"); for (l = 0; l < RANGING_SENSOR_NB_TARGET_PER_ZONE; l++) { printf(" \033[38;5;10m%20s\033[0m : %20s\n", "Distance [mm]", "Status\r"); if ((Profile.EnableAmbient != 0) || (Profile.EnableSignal != 0)) { - printf(" %20s : %20s\n", "Signal [kcps/spad]", "Ambient [kcps/spad]"); + printf(" %20s : %20s\n", "Signal [kcps/spad]", "Ambient [kcps/spad]\r"); } } @@ -282,7 +358,7 @@ static void print_result(RANGING_SENSOR_Result_t *Result) for (i = 0; i < zones_per_line; i++) { - printf("| "); + printf("| "); } printf("|\n"); @@ -292,14 +368,32 @@ static void print_result(RANGING_SENSOR_Result_t *Result) for (k = (zones_per_line - 1); k >= 0; k--) { if (Result->ZoneResult[j + k].NumberOfTargets > 0) - printf("| \033[38;5;10m%5ld\033[0m : %5ld ", - (long)Result->ZoneResult[j + k].Distance[l], + { + /* ---- origin + printf("| \033[38;5;10m%5ld\033[0m :%2d%5ld ", + (long)Result->ZoneResult[j + k].Distance[l],(j+k), (long)Result->ZoneResult[j + k].Status[l]); + */ + int32_t roi_distance =(uint32_t)(Result->ZoneResult[j + k].Distance[l]); + int16_t roi_low = (roi_distance - LOW_THRESHOLD)/10; + int16_t roi_high = (HIGH_THRESHOLD - roi_distance)/10; + + if ((roi_low> 0)&&(roi_high>0)) + { + //printf("| \033[38;5;10m%5ld\033[0m :%2d%5ld ", (uint32_t)(roi_distance-LOW_THRESHOLD), (j+k), (uint32_t)Result->ZoneResult[j + k].Status[l]); + printf("| \033[38;5;10m%5d\033[0m : ", (uint16_t)roi_low); + } + else if ((roi_low< 0)|| (roi_high<0)) + { + //printf("| \033[38;5;10m%5s\033[0m :%2d%5ld ", ".",(j+k), (uint32_t)Result->ZoneResult[j + k].Status[l]); + printf("| \033[38;5;10m%5s\033[0m : ", "."); + } + } else - printf("| %5s : %5s ", "X", "X"); + printf("| %5s : %5s ", ".", "."); } printf("|\n"); - +#if 0 if ((Profile.EnableAmbient != 0) || (Profile.EnableSignal != 0)) { /* Print Signal and Ambient */ @@ -326,6 +420,7 @@ static void print_result(RANGING_SENSOR_Result_t *Result) } printf("|\n"); } +#endif } } @@ -338,7 +433,7 @@ static void print_result(RANGING_SENSOR_Result_t *Result) -#endif + #if defined(STS_P2)||defined(STS_T6) uint8_t IsInterruptDetected(uint16_t dev) diff --git a/STS/TOF/App/app_tof.h b/STS/TOF/App/app_tof.h index fd86d1e..1989efd 100644 --- a/STS/TOF/App/app_tof.h +++ b/STS/TOF/App/app_tof.h @@ -34,7 +34,9 @@ void MX_TOF_Init(void); void MX_TOF_Process(void); uint16_t MX_TOF_Ranging_Process(void); - +int example11_init(void); +void example11_process(void); +void STS_Reset_Sensor(void); //void STS_TOF_VL53LX_PeopleCounting_Process(void); //int sts_tof_vl53lx_peoplecount_subprocess(void);