#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#define SENSOR_ID (1U)
#define SENSOR_TIMEOUT_MS (1000U)
#define NBR_CONFIGS (2U)
#define NBR_ITERATIONS_PER_CONFIG (20U)
{
void *buffer,
uint32_t nbr_configs);
{
(void)argc;
(void)argv;
void *buffer = NULL;
uint32_t buffer_size = 0U;
{
{
.start = 1.0f,
.end = 2.0f,
.frame_rate = 5.0f,
.reset_filters_on_prepare = true,
},
{
.name = "zone2",
.start = 0.2f,
.end = 1.0f,
.frame_rate = 10.0f,
.reset_filters_on_prepare = true,
},
};
{
return EXIT_FAILURE;
}
{
if (presence_config[cfg] == NULL)
{
printf("acc_detector_presence_config_create() failed\n");
return EXIT_FAILURE;
}
uint32_t current_buffer_size = 0;
if (presence_handle[cfg] == NULL)
{
printf("acc_detector_presence_create() failed\n");
return EXIT_FAILURE;
}
{
printf("acc_detector_presence_get_buffer_size() failed\n");
return EXIT_FAILURE;
}
if (buffer_size < current_buffer_size)
{
buffer_size = current_buffer_size;
}
}
if (buffer == NULL)
{
printf("buffer allocation failed\n");
return EXIT_FAILURE;
}
if (sensor == NULL)
{
printf("acc_sensor_create() failed\n");
return EXIT_FAILURE;
}
bool status;
bool cal_complete = false;
do
{
if (status && !cal_complete)
{
}
} while (status && !cal_complete);
if (!status)
{
printf("acc_sensor_calibrate() failed\n");
return EXIT_FAILURE;
}
while (true)
{
{
&cal_result, buffer, buffer_size))
{
printf("acc_detector_presence_prepare() failed\n");
return EXIT_FAILURE;
}
{
{
printf("acc_sensor_measure failed\n");
return EXIT_FAILURE;
}
{
printf("Sensor interrupt timeout\n");
return EXIT_FAILURE;
}
{
printf("acc_sensor_read failed\n");
return EXIT_FAILURE;
}
{
printf("acc_detector_presence_process failed\n");
return EXIT_FAILURE;
}
}
}
}
printf("Application finished OK\n");
return EXIT_SUCCESS;
}
void *buffer,
uint32_t nbr_configs)
{
for (uint32_t cfg = 0U; cfg < nbr_configs; cfg++)
{
if (presence_config[cfg] != NULL)
{
presence_config[cfg] = NULL;
}
if (presence_handle[cfg] != NULL)
{
presence_handle[cfg] = NULL;
}
}
if (sensor != NULL)
{
}
if (buffer != NULL)
{
}
}
{
{
printf("Motion\n");
}
else
{
printf("No motion\n");
}
printf("%s - Intra presence score: %d, Inter presence score: %d, Distance (mm): %d\n",
config_name,
printf("%s - Depthwise Intra Presence Scores: \t", config_name);
{
}
printf("\n");
printf("%s - Depthwise Inter Presence Scores: \t", config_name);
{
}
printf("\n");
}