Developer World
Spresense SDK Library v3.2.0-ebc0364
arm_gesture.h
1/****************************************************************************
2 * modules/include/sensing/logical_sensor/arm_gesture.h
3 *
4 * Copyright 2018 Sony Semiconductor Solutions Corporation
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17 * the names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior written
19 * permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 ****************************************************************************/
35
36#ifndef __INCLUDE_SENSING_LOGICAL_SENSOR_ARM_GESTURE_H
37#define __INCLUDE_SENSING_LOGICAL_SENSOR_ARM_GESTURE_H
38
44/****************************************************************************
45 * Included Files
46 ****************************************************************************/
47
48#include <asmp/mpmq.h>
49#include <asmp/mptask.h>
50
51#include "sensing/sensor_api.h"
52#include "sensing/sensor_id.h"
53#include "sensing/sensor_ecode.h"
55#include "memutils/s_stl/queue.h"
57
58/****************************************************************************
59 * Public Types
60 ****************************************************************************/
61
63{
64public:
65
66 /*** public mathods ***/
67 int open(void);
68 int close(void);
69 int write(FAR sensor_command_data_mh_t *cmd);
70 void set_callback(FAR SensorCmd *cmd);
71 int receive(void);
72 int setRotation(FAR GestureSetRotation *rotation);
73
75 : m_cmd_pool_id(pool_id)
76 {
77 };
78
79 ~GestureClass(){};
80
81private:
82
83 #define MAX_EXEC_COUNT 8
84 struct exe_mh_s
85 {
88 };
89 s_std::Queue<struct exe_mh_s, MAX_EXEC_COUNT> m_exe_que;
90
91 /*** private members ***/
92 MemMgrLite::PoolId m_cmd_pool_id;
93
94 mptask_t m_mptask;
95 mpmq_t m_mq;
96
97 pthread_t m_thread_id;
98
99 /*** private mathods ***/
100 int sendInit(void);
101
102};
103
104/****************************************************************************
105 * Public Function Prototypes
106 ****************************************************************************/
107
114
122
129
137 FAR sensor_command_data_mh_t *command);
138
146 FAR GestureSetRotation *rotation);
147
152#endif /* __INCLUDE_SENSING_ARM_GESTURE_H */
Memory Handler API.
Definition: arm_gesture.h:63
Memory Handler Class for "Memory Manager Lite". This is only wrapper class for convert project-specif...
Definition: MemManager.h:107
int GestureSetCoordinate(FAR GestureClass *ins, FAR GestureSetRotation *rotation)
Set Gesture coordinate.
int GestureWrite(FAR GestureClass *ins, FAR sensor_command_data_mh_t *command)
Send data to Gesture worker task.
int GestureClose(FAR GestureClass *ins)
Destory Gesture worker task.
FAR GestureClass * GestureCreate(MemMgrLite::PoolId cmd_pool_id)
Create GestureClass instance.
int GestureOpen(FAR GestureClass *ins)
Load Gesture library and boot up as worker task. After booted up, send initialize and wait complete.
Rotation matrix. Assume x_adjusted, y_adjusted, z_adjusted as adjusted x, y, z acceleration value acc...
Definition: arm_gesture_command.h:161
Definition: MemMgrTypes.h:88
Definition: mpmq.h:77
Definition: mptask.h:248
The command of send some sensor data with MemHandle to the sensor manager. This function only can cal...
Definition: sensor_api.h:134