|
|
#include <stdarg.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <string.h>#include "acc_definitions_a121.h"#include "acc_detector_presence.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 "i2c_application_system.h"#include "i2c_presence_detector.h"#include "presence_reg_protocol.h"Go to the source code of this file.
Data Structures | |
| struct | presence_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 (presence_detector_resources_t *resources) |
| Create sensor. More... | |
| static bool | calibrate_sensor (presence_detector_resources_t *resources) |
| Calibrate sensor. More... | |
| static void | apply_detector_config (presence_detector_resources_t *resources) |
| Apply detector config. More... | |
| static bool | detector_activate (presence_detector_resources_t *resources, bool enable) |
| Activate detector. More... | |
| static bool | detector_get_next (presence_detector_resources_t *resources) |
| Get next presence measurement. More... | |
| static void | detector_gpio_output (void) |
| Handle detector GPIO output. More... | |
| static void | module_low_power (void) |
| Try to set module in low power mode. More... | |
| static bool | enter_hibernate (acc_sensor_t *sensor) |
| Enter sensor hibernation state. More... | |
| static bool | exit_hibernate (acc_sensor_t *sensor) |
| Exit sensor hibernation state. More... | |
| static void | print_presence_result (acc_detector_presence_result_t *result) |
| Print the presence detector result. More... | |
| static void | uart_log (const char *format,...) |
| UART logging function (can be enabled/disabled by command) More... | |
| acc_detector_presence_config_t * | i2c_presence_detector_get_config (void) |
| Get presence detector configuration handle. More... | |
| bool | i2c_presence_detector_command (uint32_t command) |
| Send command to be executed to i2c presence detector. More... | |
| uint32_t | i2c_presence_detector_get_status (void) |
| Get presence detector status. More... | |
| uint32_t | i2c_presence_detector_get_result (void) |
| Get presence detector result. More... | |
| float | i2c_presence_detector_get_distance (void) |
| Get presence detector distance. More... | |
| float | i2c_presence_detector_get_intra_presence_score (void) |
| Get intra presence score. More... | |
| float | i2c_presence_detector_get_inter_presence_score (void) |
| Get inter presence score. More... | |
| uint32_t | i2c_presence_detector_get_counter (void) |
| Get presence detector measure counter. More... | |
| void | i2c_presence_detector_presence_detected_gpio (bool enable) |
| Enable/Disable gpio output for presence detected. More... | |
| bool | i2c_presence_detector_get_presence_detected_gpio (void) |
| Get gpio output for presence detected state. More... | |
| uint32_t | i2c_presence_detector_get_presence_frame_rate_mhz (void) |
| Get the actual frame rate for the current presence detector configuration. More... | |
| int | acconeer_main (int argc, char *argv[]) |
| Assembly test example. More... | |
Variables | |
| static presence_detector_resources_t | detector_resources = {0} |
| static uint32_t | i2c_detector_command = 0U |
| static uint32_t | i2c_detector_status = 0U |
| static bool | presence_detector_active = false |
| static bool | presence_detected = false |
| static bool | presence_detected_sticky = false |
| static bool | presence_detection_gpio = false |
| static bool | presence_detector_error = false |
| static float | presence_distance = 0.0f |
| static uint32_t | presence_frame_counter = 0U |
| static uint32_t | presence_last_tick_ms = 0U |
| static uint32_t | presence_frame_rate_mhz = 0U |
| static float | intra_presence_score = 0.0f |
| static float | inter_presence_score = 0.0f |
| static bool | uart_logs_enabed = false |
| #define SENSOR_ID (1U) |
Definition at line 26 of file i2c_presence_detector.c.
| #define SENSOR_TIMEOUT_MS (10000U) |
Definition at line 27 of file i2c_presence_detector.c.
| #define UART_LOG_BUFFER_SIZE 100 |
Definition at line 57 of file i2c_presence_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)
Test if measure on wake up is enable Do a measurement if the the detector is ready (configured and calibrated)
Definition at line 344 of file i2c_presence_detector.c.
|
static |
Apply detector config.
This function will create the presence detector and allocate the needed memory
| [in] | resources | presence detector resources struct |
Definition at line 654 of file i2c_presence_detector.c.
|
static |
Calibrate sensor.
| [in] | resources | presence detector resources struct |
Definition at line 613 of file i2c_presence_detector.c.
|
static |
Execute the command sent from the host.
| [in] | command | The command to execute |
Definition at line 493 of file i2c_presence_detector.c.
|
static |
Create sensor.
| [in] | resources | presence detector resources struct |
Definition at line 593 of file i2c_presence_detector.c.
|
static |
Activate detector.
This function will activate the detector
| [in] | resources | presence detector resources struct |
| [in] | enable | set to true to enable the detector |
Definition at line 723 of file i2c_presence_detector.c.
|
static |
Get next presence measurement.
| [in] | resources | presence detector resources struct |
Definition at line 767 of file i2c_presence_detector.c.
|
static |
Handle detector GPIO output.
Definition at line 863 of file i2c_presence_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 568 of file i2c_presence_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 555 of file i2c_presence_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 581 of file i2c_presence_detector.c.
|
static |
Enter sensor hibernation state.
Definition at line 916 of file i2c_presence_detector.c.
|
static |
Exit sensor hibernation state.
Definition at line 930 of file i2c_presence_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 479 of file i2c_presence_detector.c.
| bool i2c_presence_detector_command | ( | uint32_t | command | ) |
Send command to be executed to i2c presence detector.
| [in] | command | The command to be executed |
Definition at line 191 of file i2c_presence_detector.c.
| acc_detector_presence_config_t* i2c_presence_detector_get_config | ( | void | ) |
Get presence detector configuration handle.
Definition at line 186 of file i2c_presence_detector.c.
| uint32_t i2c_presence_detector_get_counter | ( | void | ) |
Get presence detector measure counter.
The counter will be increased every time the presence detector completes a measure
Definition at line 296 of file i2c_presence_detector.c.
| float i2c_presence_detector_get_distance | ( | void | ) |
Get presence detector distance.
Definition at line 260 of file i2c_presence_detector.c.
| float i2c_presence_detector_get_inter_presence_score | ( | void | ) |
Get inter presence score.
Definition at line 284 of file i2c_presence_detector.c.
| float i2c_presence_detector_get_intra_presence_score | ( | void | ) |
Get intra presence score.
Definition at line 272 of file i2c_presence_detector.c.
| bool i2c_presence_detector_get_presence_detected_gpio | ( | void | ) |
Get gpio output for presence detected state.
Definition at line 318 of file i2c_presence_detector.c.
| uint32_t i2c_presence_detector_get_presence_frame_rate_mhz | ( | void | ) |
Get the actual frame rate for the current presence detector configuration.
Definition at line 330 of file i2c_presence_detector.c.
| uint32_t i2c_presence_detector_get_result | ( | void | ) |
Get presence detector result.
Definition at line 225 of file i2c_presence_detector.c.
| uint32_t i2c_presence_detector_get_status | ( | void | ) |
Get presence detector status.
Definition at line 213 of file i2c_presence_detector.c.
| void i2c_presence_detector_presence_detected_gpio | ( | bool | enable | ) |
Enable/Disable gpio output for presence detected.
| [in] | enable | Enable gpio output for presence detected if set to true |
Definition at line 308 of file i2c_presence_detector.c.
|
static |
Try to set module in low power mode.
Definition at line 893 of file i2c_presence_detector.c.
|
static |
Print the presence detector result.
Only available when the UART logs have been enabled with ENABLE_UART_LOGS
| [in] | result | The presence detector result |
Definition at line 944 of file i2c_presence_detector.c.
|
static |
UART logging function (can be enabled/disabled by command)
Definition at line 958 of file i2c_presence_detector.c.
|
static |
Definition at line 41 of file i2c_presence_detector.c.
|
static |
Definition at line 42 of file i2c_presence_detector.c.
|
static |
Definition at line 43 of file i2c_presence_detector.c.
|
static |
Definition at line 54 of file i2c_presence_detector.c.
|
static |
Definition at line 53 of file i2c_presence_detector.c.
|
static |
Definition at line 45 of file i2c_presence_detector.c.
|
static |
Definition at line 46 of file i2c_presence_detector.c.
|
static |
Definition at line 47 of file i2c_presence_detector.c.
|
static |
Definition at line 44 of file i2c_presence_detector.c.
|
static |
Definition at line 48 of file i2c_presence_detector.c.
|
static |
Definition at line 49 of file i2c_presence_detector.c.
|
static |
Definition at line 50 of file i2c_presence_detector.c.
|
static |
Definition at line 52 of file i2c_presence_detector.c.
|
static |
Definition at line 51 of file i2c_presence_detector.c.
|
static |
Definition at line 55 of file i2c_presence_detector.c.