acc_control_helper.h
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2022
2 // All rights reserved
3 // This file is subject to the terms and conditions defined in the file
4 // 'LICENSES/license_acconeer.txt', (BSD 3-Clause License) which is part
5 // of this source code package.
6
7 #ifndef ACC_CONTROL_HELPER_H_
8 #define ACC_CONTROL_HELPER_H_
9 #include <stdint.h>
10
11 #include "acc_config.h"
12 #include "acc_definitions_a121.h"
13 #include "acc_definitions_common.h"
14 #include "acc_processing.h"
15 #include "acc_sensor.h"
16
17 /** \example acc_control_helper.c
18 * @brief This is a simplified API that can be used to easier get started
19 * The implementation of this API is provided as source code which can
20 * be examined and modified in order to suit your needs.
21 */
22
23 typedef struct
24 {
25 acc_config_t *config;
26 acc_sensor_t *sensor;
27 acc_sensor_id_t sensor_id;
28 acc_processing_t *processing;
29 void *buffer;
30 uint32_t buffer_size;
31 acc_cal_result_t cal_result;
32 acc_processing_metadata_t proc_meta;
33 acc_processing_result_t proc_result;
34 } acc_control_helper_t;
35
36
37 /**
38 * @brief Create a helper instance
39 *
40 * After a successful call to this function all members of the the acc_control_helper_t
41 * are initialized to default values and the config member is created.
42 *
43 * @param radar A pointer to an acc_control_helper_t struct. The members in this struct will be initialized.
44 * @param sensor_id The sensor id
45 * @return true if successful, false otherwise
46 */
47 bool acc_control_helper_create(acc_control_helper_t *radar, acc_sensor_id_t sensor_id);
48
49
50 /**
51 * @brief Destroy a helper instance
52 *
53 * @param radar A pointer to an acc_control_helper_t struct
54 */
55 void acc_control_helper_destroy(acc_control_helper_t *radar);
56
57
58 /**
59 * @brief Activate the sensor
60 *
61 * After a successful call to this function the following members of the
62 * acc_control_helper_t struct are updated:
63 *
64 * buffer_size: The size of the allocated buffer
65 * sensor: Pointer to sensor instance
66 * processing: Pointer to processing instance
67 * cal_result: The calibration data
68 *
69 * @param radar A pointer to an acc_control_helper_t struct
70 * @return true if successful, false otherwise
71 *
72 */
73 bool acc_control_helper_activate(acc_control_helper_t *radar);
74
75
76 /**
77 * @brief Perform a radar measurement and wait for the result.
78 *
79 * After each call to this function the "proc_result" member of the acc_control_helper_t
80 * is updated.
81 *
82 * @param radar A pointer to an acc_control_helper_t struct
83 * @return true if successful, false otherwise
84 */
85 bool acc_control_helper_get_next(acc_control_helper_t *radar);
86
87
88 #endif
acc_control_helper_create
bool acc_control_helper_create(acc_control_helper_t *radar, acc_sensor_id_t sensor_id)
Create a helper instance.
Definition: acc_control_helper.c:41
acc_control_helper_t::sensor_id
acc_sensor_id_t sensor_id
Definition: acc_control_helper.h:27
acc_control_helper_t::processing
acc_processing_t * processing
Definition: acc_control_helper.h:28
acc_processing_result_t
Result provided by the processing module.
Definition: acc_processing.h:71
acc_control_helper_t::config
acc_config_t * config
Definition: acc_control_helper.h:25
acc_cal_result_t
The result from a completed calibration.
Definition: acc_definitions_a121.h:30
acc_control_helper_destroy
void acc_control_helper_destroy(acc_control_helper_t *radar)
Destroy a helper instance.
Definition: acc_control_helper.c:50
acc_control_helper_t::buffer_size
uint32_t buffer_size
Definition: acc_control_helper.h:30
acc_processing_metadata_t
Metadata that will be populated by the processing module during creation.
Definition: acc_processing.h:36
acc_control_helper_t::proc_meta
acc_processing_metadata_t proc_meta
Definition: acc_control_helper.h:32
acc_sensor.h
acc_config_t
struct acc_config acc_config_t
Definition: acc_config.h:24
acc_control_helper_t::sensor
acc_sensor_t * sensor
Definition: acc_control_helper.h:26
acc_control_helper_t::buffer
void * buffer
Definition: acc_control_helper.h:29
acc_control_helper_t::cal_result
acc_cal_result_t cal_result
Definition: acc_control_helper.h:31
acc_sensor_id_t
uint32_t acc_sensor_id_t
Type representing a sensor ID.
Definition: acc_definitions_common.h:13
acc_processing_t
struct acc_processing_handle acc_processing_t
Definition: acc_processing.h:30
acc_control_helper_t
Definition: acc_control_helper.h:23
acc_control_helper_activate
bool acc_control_helper_activate(acc_control_helper_t *radar)
Activate the sensor.
Definition: acc_control_helper.c:81
acc_definitions_common.h
acc_config.h
acc_control_helper_get_next
bool acc_control_helper_get_next(acc_control_helper_t *radar)
Perform a radar measurement and wait for the result.
Definition: acc_control_helper.c:157
acc_control_helper_t::proc_result
acc_processing_result_t proc_result
Definition: acc_control_helper.h:33
acc_processing.h
acc_sensor_t
struct acc_sensor acc_sensor_t
Definition: acc_sensor.h:31
acc_definitions_a121.h