example_hand_motion_detection.c File Reference
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include "acc_algorithm.h"
#include "acc_config.h"
#include "acc_detector_presence.h"
#include "acc_detector_presence_processing.h"
#include "acc_integration.h"
#include "acc_integration_log.h"
#include "acc_processing.h"
#include "acc_rss_a121.h"
#include "example_hand_motion_detection.h"

Go to the source code of this file.

Data Structures

struct  hand_motion_detection_handle
 

Macros

#define MODULE   "example_hand_motion_detection"
 

Functions

static void reinit_hand_motion_detection_state (hand_motion_detection_handle_t *handle)
 
static void set_sensor_config (const hand_motion_detection_config_t *hand_motion_detection_config, acc_config_t *sensor_config)
 
static void set_processing_config (const hand_motion_detection_config_t *hand_motion_detection_config, acc_detector_presence_processing_config_t *processing_config)
 
static hand_motion_detection_detection_state_t process_presence_processing_result (hand_motion_detection_handle_t *handle, const acc_detector_presence_processing_result_t *presence_processing_result)
 
static void determine_app_mode (hand_motion_detection_handle_t *handle, hand_motion_detection_result_t *result)
 
static void swap_app_mode (hand_motion_detection_handle_t *handle, hand_motion_detection_app_mode_t new_app_mode)
 
hand_motion_detection_config_thand_motion_detection_config_create (void)
 Create a hand motion configuration. More...
 
void hand_motion_detection_config_destroy (hand_motion_detection_config_t *config)
 Destroy a hand motion configuration. More...
 
void hand_motion_detection_set_config (hand_motion_detection_preset_t preset, hand_motion_detection_config_t *config)
 Set config specified by the preset. More...
 
hand_motion_detection_handle_thand_motion_detection_handle_create (const hand_motion_detection_config_t *hand_motion_detection_config, acc_sensor_id_t sensor_id)
 Create a hand_motion handle. More...
 
void hand_motion_detection_handle_destroy (hand_motion_detection_handle_t *handle)
 Destroy a hand_motion handle. More...
 
void hand_motion_detection_config_log (hand_motion_detection_handle_t *handle)
 Print configuration. More...
 
bool hand_motion_detection_get_buffer_size (hand_motion_detection_handle_t *handle, uint32_t *buffer_size)
 Get buffer size needed. More...
 
bool hand_motion_detection_prepare (hand_motion_detection_handle_t *handle, acc_sensor_t *sensor, const acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size, bool force_prepare)
 Prepare hand motion. More...
 
void hand_motion_detection_process (hand_motion_detection_handle_t *handle, void *buffer, hand_motion_detection_result_t *hand_motion_detection_result)
 Process Sparse IQ data. More...
 

Macro Definition Documentation

◆ MODULE

#define MODULE   "example_hand_motion_detection"

Definition at line 21 of file example_hand_motion_detection.c.

Function Documentation

◆ determine_app_mode()

static void determine_app_mode ( hand_motion_detection_handle_t handle,
hand_motion_detection_result_t result 
)
static

Definition at line 456 of file example_hand_motion_detection.c.

◆ hand_motion_detection_config_create()

hand_motion_detection_config_t* hand_motion_detection_config_create ( void  )

Create a hand motion configuration.

Returns
Hand motion configuration if successful, otherwise false

Definition at line 63 of file example_hand_motion_detection.c.

◆ hand_motion_detection_config_destroy()

void hand_motion_detection_config_destroy ( hand_motion_detection_config_t config)

Destroy a hand motion configuration.

Parameters
[in]configConfiguration to destroy

Definition at line 81 of file example_hand_motion_detection.c.

◆ hand_motion_detection_config_log()

void hand_motion_detection_config_log ( hand_motion_detection_handle_t handle)

Print configuration.

Parameters
[in]handleHandle to print config for

Definition at line 240 of file example_hand_motion_detection.c.

◆ hand_motion_detection_get_buffer_size()

bool hand_motion_detection_get_buffer_size ( hand_motion_detection_handle_t handle,
uint32_t *  buffer_size 
)

Get buffer size needed.

Parameters
[in]handleThe hand motion handle
[out]buffer_sizeBuffer size needed
Returns
True if successful, otherwise false

Definition at line 269 of file example_hand_motion_detection.c.

◆ hand_motion_detection_handle_create()

hand_motion_detection_handle_t* hand_motion_detection_handle_create ( const hand_motion_detection_config_t hand_motion_detection_config,
acc_sensor_id_t  sensor_id 
)

Create a hand_motion handle.

The handle is used only for processing

Parameters
[in]hand_motion_detection_confighand motion configuration
[in]sensor_idSensor id
Returns
A hand_motion handle, or NULL if creation failed

Definition at line 137 of file example_hand_motion_detection.c.

◆ hand_motion_detection_handle_destroy()

void hand_motion_detection_handle_destroy ( hand_motion_detection_handle_t handle)

Destroy a hand_motion handle.

Parameters
[in]handleThe hand_motion handle to destroy

Definition at line 207 of file example_hand_motion_detection.c.

◆ hand_motion_detection_prepare()

bool hand_motion_detection_prepare ( hand_motion_detection_handle_t handle,
acc_sensor_t sensor,
const acc_cal_result_t cal_result,
void *  buffer,
uint32_t  buffer_size,
bool  force_prepare 
)

Prepare hand motion.

Parameters
[in]handleThe hand motion handle
[in]sensorSensor to prepare
[in]cal_resultSensor calibration result
[in]bufferData buffer
[in]buffer_sizeSize of data buffer
[in]force_prepareForce executing prepare
Returns
True if successful, otherwise false

Definition at line 295 of file example_hand_motion_detection.c.

◆ hand_motion_detection_process()

void hand_motion_detection_process ( hand_motion_detection_handle_t handle,
void *  buffer,
hand_motion_detection_result_t hand_motion_detection_result 
)

Process Sparse IQ data.

Parameters
[in]handleThe hand_motion handle
[in]bufferData buffer
[out]hand_motion_detection_resultResult processed by hand_motion

Definition at line 322 of file example_hand_motion_detection.c.

◆ hand_motion_detection_set_config()

void hand_motion_detection_set_config ( hand_motion_detection_preset_t  preset,
hand_motion_detection_config_t config 
)

Set config specified by the preset.

Parameters
[in]presetThe preset used to set hand motion config
[out]configThe hand motion config to be set

Definition at line 94 of file example_hand_motion_detection.c.

◆ process_presence_processing_result()

static hand_motion_detection_detection_state_t process_presence_processing_result ( hand_motion_detection_handle_t handle,
const acc_detector_presence_processing_result_t presence_processing_result 
)
static

Definition at line 432 of file example_hand_motion_detection.c.

◆ reinit_hand_motion_detection_state()

static void reinit_hand_motion_detection_state ( hand_motion_detection_handle_t handle)
static

Definition at line 356 of file example_hand_motion_detection.c.

◆ set_processing_config()

static void set_processing_config ( const hand_motion_detection_config_t hand_motion_detection_config,
acc_detector_presence_processing_config_t processing_config 
)
static

Definition at line 413 of file example_hand_motion_detection.c.

◆ set_sensor_config()

static void set_sensor_config ( const hand_motion_detection_config_t hand_motion_detection_config,
acc_config_t sensor_config 
)
static

Definition at line 363 of file example_hand_motion_detection.c.

◆ swap_app_mode()

static void swap_app_mode ( hand_motion_detection_handle_t handle,
hand_motion_detection_app_mode_t  new_app_mode 
)
static

Definition at line 492 of file example_hand_motion_detection.c.