|
|
#include <stdarg.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <string.h>#include "acc_definitions_a121.h"#include "acc_detector_distance.h"#include "acc_hal_definitions_a121.h"#include "acc_hal_integration_a121.h"#include "acc_integration.h"#include "acc_rss_a121.h"#include "acc_version.h"#include "acc_reg_protocol.h"#include "distance_reg_protocol.h"#include "i2c_application_system.h"#include "i2c_distance_detector.h"Go to the source code of this file.
Data Structures | |
| struct | distance_detector_resources_t |
Macros | |
| #define | SENSOR_ID (1U) |
| #define | SENSOR_TIMEOUT_MS (10000U) |
| #define | UART_LOG_BUFFER_SIZE 100 |
Functions | |
| static uint32_t | get_command (void) |
| Get the i2c_detector_command values. More... | |
| static void | command_handler (uint32_t command) |
| Execute the command sent from the host. More... | |
| static void | detector_status_set_bits (uint32_t bit_mask) |
| Set bits in the i2c_detector_status. More... | |
| static void | detector_status_clr_bits (uint32_t bit_mask) |
| Clear bits in the i2c_detector_status. More... | |
| static bool | detector_status_test_bits (uint32_t bit_mask) |
| Test bits in the i2c_detector_status. More... | |
| static void | create_sensor (distance_detector_resources_t *resources) |
| Create sensor. More... | |
| static void | apply_detector_config (distance_detector_resources_t *resources) |
| Apply detector config. More... | |
| static void | calibrate_sensor (distance_detector_resources_t *resources) |
| Calibrate sensor. More... | |
| static void | calibrate_detector (distance_detector_resources_t *resources, bool update_calibration) |
| Calibrate detector. More... | |
| static bool | is_detector_ready (void) |
| Test if detector is ready. More... | |
| static bool | detector_get_next (distance_detector_resources_t *resources) |
| Get next distance measurement. More... | |
| static void | print_distance_result (const acc_detector_distance_result_t *result) |
| Print the distance detector result. More... | |
| static void | uart_log (const char *format,...) |
| UART logging function (can be enabled/disabled by command) More... | |
| acc_detector_distance_config_t * | i2c_distance_detector_get_config (void) |
| Get distance detector configuration handle. More... | |
| bool | i2c_distance_detector_command (uint32_t command) |
| Send command to be executed to i2c distance detector. More... | |
| uint32_t | i2c_distance_detector_get_status (void) |
| Get distance detector status. More... | |
| uint32_t | i2c_distance_detector_get_result (void) |
| Get distance detector result. More... | |
| uint32_t | i2c_distance_detector_get_counter (void) |
| Get distance detector measure counter. More... | |
| float | i2c_distance_detector_get_peak_distance (uint16_t peak_id) |
| Get the peak distance for a specific peak id. More... | |
| float | i2c_distance_detector_get_peak_strength (uint16_t peak_id) |
| Get the peak strength for a specific peak id. More... | |
| void | i2c_distance_detector_measure_on_wakeup (bool enable) |
| Enable/Disable measure on wake up. More... | |
| bool | i2c_distance_detector_get_measure_on_wakeup (void) |
| Get measure on wake up state. More... | |
| int | acconeer_main (int argc, char *argv[]) |
| Assembly test example. More... | |
Variables | |
| static distance_detector_resources_t | detector_resources = {0} |
| static uint32_t | i2c_detector_command = 0U |
| static uint32_t | i2c_detector_status = 0U |
| static uint32_t | measure_distance_counter = 0U |
| static bool | measure_distance_error = false |
| static bool | measure_on_wakeup = false |
| static bool | uart_logs_enabed = false |
| #define SENSOR_ID (1U) |
Definition at line 26 of file i2c_distance_detector.c.
| #define SENSOR_TIMEOUT_MS (10000U) |
Definition at line 27 of file i2c_distance_detector.c.
| #define UART_LOG_BUFFER_SIZE 100 |
Definition at line 51 of file i2c_distance_detector.c.
| int acconeer_main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Assembly test example.
Touchless button application.
Tank level reference application.
Smart presence reference application.
Parking application.
Breathing example application.
Waste level application.
Vibration example.
Surface velocity example application.
Service subsweeps example.
Service multple configurations example.
Low power service example.
Service sensor calibration caching example.
Service example.
Processing subtract adaptive background example.
Processing static presence example.
Processing peak interpolation example.
Processing noncoherent mean example.
Processing coherent mean example.
Processing amplitude example.
hand motion application
Detector presence example with multiple configurations.
Low power detector presence example.
Detector presence example.
Detector distance example with iq data print.
Distance detector low power example.
Detector distance with calibration caching example.
Detector distance example.
Control helper example.
Cargo application.
Test if measure on wake up is enable Do a measurement if the the detector is ready (configured and calibrated)
Definition at line 298 of file i2c_distance_detector.c.
|
static |
Apply detector config.
This function will create the distance detector and allocate the needed memory
| [in] | resources | distance detector resources struct |
Definition at line 586 of file i2c_distance_detector.c.
|
static |
Calibrate detector.
| [in] | resources | distance detector resources struct |
| [in] | update_calibration | Set to false for first calibration, true for calibration update |
Definition at line 700 of file i2c_distance_detector.c.
|
static |
Calibrate sensor.
| [in] | resources | distance detector resources struct |
Definition at line 661 of file i2c_distance_detector.c.
|
static |
Execute the command sent from the host.
| [in] | command | The command to execute |
Definition at line 441 of file i2c_distance_detector.c.
|
static |
Create sensor.
| [in] | resources | distance detector resources struct |
Definition at line 566 of file i2c_distance_detector.c.
|
static |
Get next distance measurement.
| [in] | resources | distance detector resources struct |
Definition at line 774 of file i2c_distance_detector.c.
|
static |
Clear bits in the i2c_detector_status.
The i2c_detector_status is protected by a critical section
| [in] | bit_mask | The bit_mask to clear |
Definition at line 541 of file i2c_distance_detector.c.
|
static |
Set bits in the i2c_detector_status.
The i2c_detector_status is protected by a critical section
| [in] | bit_mask | The bit_mask to set |
Definition at line 528 of file i2c_distance_detector.c.
|
static |
Test bits in the i2c_detector_status.
The i2c_detector_status is protected by a critical section
| [in] | bit_mask | The bit_mask to test |
Definition at line 554 of file i2c_distance_detector.c.
|
static |
Get the i2c_detector_command values.
The i2c_detector_command is cleared during this read The read and clear are protected by a critical section
Definition at line 427 of file i2c_distance_detector.c.
| bool i2c_distance_detector_command | ( | uint32_t | command | ) |
Send command to be executed to i2c distance detector.
| [in] | command | The command to be executed |
Definition at line 166 of file i2c_distance_detector.c.
| acc_detector_distance_config_t* i2c_distance_detector_get_config | ( | void | ) |
Get distance detector configuration handle.
Definition at line 161 of file i2c_distance_detector.c.
| uint32_t i2c_distance_detector_get_counter | ( | void | ) |
Get distance detector measure counter.
The counter will be increased every time the distance detector completes a measure
Definition at line 234 of file i2c_distance_detector.c.
| bool i2c_distance_detector_get_measure_on_wakeup | ( | void | ) |
Get measure on wake up state.
Definition at line 280 of file i2c_distance_detector.c.
| float i2c_distance_detector_get_peak_distance | ( | uint16_t | peak_id | ) |
Get the peak distance for a specific peak id.
| [in] | peak_id | The id of the peak |
Definition at line 246 of file i2c_distance_detector.c.
| float i2c_distance_detector_get_peak_strength | ( | uint16_t | peak_id | ) |
Get the peak strength for a specific peak id.
| [in] | peak_id | The id of the peak |
Definition at line 258 of file i2c_distance_detector.c.
| uint32_t i2c_distance_detector_get_result | ( | void | ) |
Get distance detector result.
Definition at line 200 of file i2c_distance_detector.c.
| uint32_t i2c_distance_detector_get_status | ( | void | ) |
Get distance detector status.
Definition at line 188 of file i2c_distance_detector.c.
| void i2c_distance_detector_measure_on_wakeup | ( | bool | enable | ) |
Enable/Disable measure on wake up.
| [in] | enable | Enable measure on wake up if set to true |
Definition at line 270 of file i2c_distance_detector.c.
|
static |
Test if detector is ready.
Definition at line 767 of file i2c_distance_detector.c.
|
static |
Print the distance detector result.
Only available when the UART logs have been enabled with ENABLE_UART_LOGS
| [in] | result | The distance detector result |
Definition at line 835 of file i2c_distance_detector.c.
|
static |
UART logging function (can be enabled/disabled by command)
Definition at line 851 of file i2c_distance_detector.c.
|
static |
Definition at line 43 of file i2c_distance_detector.c.
|
static |
Definition at line 44 of file i2c_distance_detector.c.
|
static |
Definition at line 45 of file i2c_distance_detector.c.
|
static |
Definition at line 46 of file i2c_distance_detector.c.
|
static |
Definition at line 47 of file i2c_distance_detector.c.
|
static |
Definition at line 48 of file i2c_distance_detector.c.
|
static |
Definition at line 49 of file i2c_distance_detector.c.