wip
This commit is contained in:
parent
e60db68969
commit
bd4a1a0135
|
@ -109,14 +109,20 @@ int main(void)
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
MX_USART2_UART_Init();
|
MX_USART2_UART_Init();
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
example11_init();
|
printf("\n\n####### start 1\n\r");
|
||||||
example11_process();
|
printf("\n\n####### start 2\n\r");
|
||||||
|
printf("\n\n####### start 3\n\r");
|
||||||
|
printf("\n\n####### start 4\n\r");
|
||||||
|
|
||||||
|
//example11_init();
|
||||||
|
//example11_process();
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
/* USER CODE BEGIN WHILE */
|
/* USER CODE BEGIN WHILE */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* USER CODE END WHILE */
|
/* USER CODE END WHILE */
|
||||||
example11();
|
//example11();
|
||||||
|
//example11_process();
|
||||||
MX_LoRaWAN_Process();
|
MX_LoRaWAN_Process();
|
||||||
//MX_TOF_Process();
|
//MX_TOF_Process();
|
||||||
// MX_TOF_Ranging_Process();
|
// MX_TOF_Ranging_Process();
|
||||||
|
|
|
@ -123,7 +123,7 @@ void SystemApp_Init(void)
|
||||||
/*Initialize the Sensors */
|
/*Initialize the Sensors */
|
||||||
EnvSensors_Init();
|
EnvSensors_Init();
|
||||||
#if defined(L8)
|
#if defined(L8)
|
||||||
//MX_TOF_Init();
|
MX_TOF_Init();
|
||||||
#endif
|
#endif
|
||||||
#if defined(STS_P2)
|
#if defined(STS_P2)
|
||||||
STS_TOF_VL53LX_PeopleCounting_Process_Init();
|
STS_TOF_VL53LX_PeopleCounting_Process_Init();
|
||||||
|
|
|
@ -128,7 +128,7 @@ UTIL_ADV_TRACE_Status_t vcom_DeInit(void)
|
||||||
/* ##-3- Disable the NVIC for DMA ########################################### */
|
/* ##-3- Disable the NVIC for DMA ########################################### */
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
HAL_NVIC_DisableIRQ(DMA1_Channel6_IRQn);
|
HAL_NVIC_DisableIRQ(DMA1_Channel6_IRQn);
|
||||||
|
HAL_NVIC_DisableIRQ(DMA1_Channel7_IRQn);
|
||||||
return UTIL_ADV_TRACE_OK;
|
return UTIL_ADV_TRACE_OK;
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
/* USER CODE BEGIN vcom_DeInit_2 */
|
/* USER CODE BEGIN vcom_DeInit_2 */
|
||||||
|
|
|
@ -114,9 +114,9 @@ void MX_TOF_Init(void)
|
||||||
//MX_53L1A2_SimpleRanging_Init();
|
//MX_53L1A2_SimpleRanging_Init();
|
||||||
//STS_TOF_VL53LX_PeopleCounting_Process();
|
//STS_TOF_VL53LX_PeopleCounting_Process();
|
||||||
#ifdef L8
|
#ifdef L8
|
||||||
//MX_53L8A1_ThresholdDetection_Init();
|
MX_53L8A1_ThresholdDetection_Init();
|
||||||
//MX_53L8A1_ThresholdDetection_Process();
|
MX_53L8A1_ThresholdDetection_Process();
|
||||||
example11_init();
|
//example11_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* USER CODE BEGIN TOF_Init_PostTreatment */
|
/* USER CODE BEGIN TOF_Init_PostTreatment */
|
||||||
|
@ -185,8 +185,8 @@ void MX_TOF_Process(void)
|
||||||
//sts_tof_vl53lx_peoplecount_subprocess();
|
//sts_tof_vl53lx_peoplecount_subprocess();
|
||||||
#ifdef L8
|
#ifdef L8
|
||||||
//MX_53L8A1_ThresholdDetection_Process();
|
//MX_53L8A1_ThresholdDetection_Process();
|
||||||
//STS_TOF_L8_Process();
|
STS_TOF_L8_Process();
|
||||||
example11_process();
|
//example11_process();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* USER CODE BEGIN TOF_Process_PostTreatment */
|
/* USER CODE BEGIN TOF_Process_PostTreatment */
|
||||||
|
@ -215,15 +215,21 @@ void STS_TOF_L8_Process(void)
|
||||||
void STS_Reset_Sensor(void)
|
void STS_Reset_Sensor(void)
|
||||||
{
|
{
|
||||||
/* Sensor reset */
|
/* Sensor reset */
|
||||||
|
printf("\r\nSTS_reset_sensor start 1\r\n");
|
||||||
HAL_GPIO_WritePin(VL53L8A1_PWR_EN_C_PORT, VL53L8A1_PWR_EN_C_PIN, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(VL53L8A1_PWR_EN_C_PORT, VL53L8A1_PWR_EN_C_PIN, GPIO_PIN_RESET);
|
||||||
HAL_Delay(2);
|
printf("\r\nSTS_reset_sensor start 1.1\r\n");
|
||||||
|
//HAL_Delay(50);
|
||||||
|
printf("\r\nSTS_reset_sensor start 1.2\r\n");
|
||||||
HAL_GPIO_WritePin(VL53L8A1_PWR_EN_C_PORT, VL53L8A1_PWR_EN_C_PIN, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(VL53L8A1_PWR_EN_C_PORT, VL53L8A1_PWR_EN_C_PIN, GPIO_PIN_SET);
|
||||||
HAL_Delay(2);
|
//HAL_Delay(50);
|
||||||
|
printf("\r\nSTS_reset_sensor start 2\r\n");
|
||||||
HAL_GPIO_WritePin(VL53L8A1_LPn_C_PORT, VL53L8A1_LPn_C_PIN, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(VL53L8A1_LPn_C_PORT, VL53L8A1_LPn_C_PIN, GPIO_PIN_RESET);
|
||||||
HAL_Delay(2);
|
printf("\r\nSTS_reset_sensor start 2.1\r\n");
|
||||||
|
//HAL_Delay(50);
|
||||||
|
printf("\r\nSTS_reset_sensor start 2.2\r\n");
|
||||||
HAL_GPIO_WritePin(VL53L8A1_LPn_C_PORT, VL53L8A1_LPn_C_PIN, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(VL53L8A1_LPn_C_PORT, VL53L8A1_LPn_C_PIN, GPIO_PIN_SET);
|
||||||
HAL_Delay(2);
|
//HAL_Delay(50);
|
||||||
|
printf("\r\nSTS_reset_sensor finished \r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VL53L8A1 */
|
/* VL53L8A1 */
|
||||||
|
@ -324,7 +330,7 @@ static void MX_53L8A1_ThresholdDetection_Process(void)
|
||||||
printf("-------------------------------------------\n\r");
|
printf("-------------------------------------------\n\r");
|
||||||
printf("please put a target between %d and %d millimeters from the sensor\n\r",
|
printf("please put a target between %d and %d millimeters from the sensor\n\r",
|
||||||
LOW_THRESHOLD, HIGH_THRESHOLD);
|
LOW_THRESHOLD, HIGH_THRESHOLD);
|
||||||
#if 1
|
#if 0
|
||||||
//while (1)
|
//while (1)
|
||||||
{
|
{
|
||||||
/* interrupt mode */
|
/* interrupt mode */
|
||||||
|
@ -905,7 +911,7 @@ int example11_init(void)
|
||||||
* example, only the I2C address is used.
|
* example, only the I2C address is used.
|
||||||
*/
|
*/
|
||||||
Dev.platform.address = VL53L8CX_DEFAULT_I2C_ADDRESS;
|
Dev.platform.address = VL53L8CX_DEFAULT_I2C_ADDRESS;
|
||||||
|
printf("\r\n example11_init: dev =%02x\r\n", Dev.platform.address);
|
||||||
/* (Optional) Reset sensor toggling PINs (see platform, not in API) */
|
/* (Optional) Reset sensor toggling PINs (see platform, not in API) */
|
||||||
//STS_Reset_Sensor(&(Dev.platform));
|
//STS_Reset_Sensor(&(Dev.platform));
|
||||||
STS_Reset_Sensor();
|
STS_Reset_Sensor();
|
||||||
|
@ -920,19 +926,23 @@ int example11_init(void)
|
||||||
/*********************************/
|
/*********************************/
|
||||||
#if 0
|
#if 0
|
||||||
/* (Optional) Check if there is a VL53LMZ sensor connected */
|
/* (Optional) Check if there is a VL53LMZ sensor connected */
|
||||||
status = vl53lmz_is_alive(&Dev, &isAlive);
|
printf("\r\n check Alive status \r\n");
|
||||||
|
status = vl53l8cx_is_alive(&Dev, &isAlive);
|
||||||
|
|
||||||
if(!isAlive || status)
|
if(!isAlive || status)
|
||||||
{
|
{
|
||||||
printf("VL53LMZ not detected at requested address\n");
|
printf("VL53LMZ not detected at requested address\n");
|
||||||
return status;
|
//return status;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* (Mandatory) Init VL53LMZ sensor */
|
/* (Mandatory) Init VL53LMZ sensor */
|
||||||
|
printf("\r\nstart Init \r\n");
|
||||||
status = vl53l8cx_init(&Dev);
|
status = vl53l8cx_init(&Dev);
|
||||||
|
printf("\r\nInit status =%d \r\n", status);
|
||||||
if(status)
|
if(status)
|
||||||
{
|
{
|
||||||
printf("VL53LMZ ULD Loading failed\n");
|
printf("VL53LMZ ULD Loading failed\n");
|
||||||
return status;
|
//return status;
|
||||||
} else {
|
} else {
|
||||||
printf("VL53L8CX ULD good\n");
|
printf("VL53L8CX ULD good\n");
|
||||||
}
|
}
|
||||||
|
@ -944,6 +954,7 @@ int example11_init(void)
|
||||||
/*********************************/
|
/*********************************/
|
||||||
/* Program motion indicator */
|
/* Program motion indicator */
|
||||||
/*********************************/
|
/*********************************/
|
||||||
|
printf("VL53LMZ program motion indicator\n");
|
||||||
|
|
||||||
/* Create motion indicator with resolution 8x8 */
|
/* Create motion indicator with resolution 8x8 */
|
||||||
status = vl53l8cx_motion_indicator_init(&Dev, &motion_config, VL53L8CX_RESOLUTION_8X8);
|
status = vl53l8cx_motion_indicator_init(&Dev, &motion_config, VL53L8CX_RESOLUTION_8X8);
|
||||||
|
|
Loading…
Reference in New Issue