example_hand_motion_detection.h File Reference
#include <stdint.h>
#include "acc_config.h"
#include "acc_detector_presence.h"
#include "acc_processing.h"

Go to the source code of this file.

Data Structures

struct  hand_motion_detection_algo_config_t
 Hand motion algo configuration. More...
 
struct  hand_motion_detection_config_t
 Configuration for hand_motion. More...
 
struct  hand_motion_detection_algo_result_t
 Hand motion algo result. More...
 
struct  hand_motion_detection_result_t
 Result type. More...
 

Typedefs

typedef struct hand_motion_detection_handle hand_motion_detection_handle_t
 hand motion handle More...
 

Enumerations

enum  hand_motion_detection_preset_t { HAND_MOTION_DETECTION_PRESET_NONE, HAND_MOTION_DETECTION_PRESET_FAUCET }
 
enum  hand_motion_detection_app_mode_t { HAND_MOTION_DETECTION_APP_MODE_PRESENCE, HAND_MOTION_DETECTION_APP_MODE_HAND_MOTION }
 
enum  hand_motion_detection_detection_state_t { HAND_MOTION_DETECTION_STATE_NO_DETECTION, HAND_MOTION_DETECTION_STATE_DETECTION, HAND_MOTION_DETECTION_STATE_RETENTION }
 

Functions

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...
 

Typedef Documentation

◆ hand_motion_detection_handle_t

hand motion handle

Definition at line 19 of file example_hand_motion_detection.h.

Enumeration Type Documentation

◆ hand_motion_detection_app_mode_t

Enumerator
HAND_MOTION_DETECTION_APP_MODE_PRESENCE 
HAND_MOTION_DETECTION_APP_MODE_HAND_MOTION 

Definition at line 29 of file example_hand_motion_detection.h.

◆ hand_motion_detection_detection_state_t

Enumerator
HAND_MOTION_DETECTION_STATE_NO_DETECTION 
HAND_MOTION_DETECTION_STATE_DETECTION 
HAND_MOTION_DETECTION_STATE_RETENTION 

Definition at line 35 of file example_hand_motion_detection.h.

◆ hand_motion_detection_preset_t

Enumerator
HAND_MOTION_DETECTION_PRESET_NONE 

No preset, user needs to set each specific parameter themselves

HAND_MOTION_DETECTION_PRESET_FAUCET 

Sensor placed on a faucet to detect hands and turn on water

Definition at line 21 of file example_hand_motion_detection.h.

Function Documentation

◆ 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.