-
Notifications
You must be signed in to change notification settings - Fork 1
/
b_wl5m_subg_motion_sensors.h
177 lines (144 loc) · 4.64 KB
/
b_wl5m_subg_motion_sensors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/**
******************************************************************************
* @file b_wl5m_subg_motion_sensors.h
* @author MCD Application Team
* @brief This file contains the common defines and functions prototypes for
* the b_wl5m_ceb_motion_sensors.c driver.
******************************************************************************
* @attention
*
* Copyright (c) 2022 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef B_WL5M_SUBG_MOTION_SENSORS_H
#define B_WL5M_SUBG_MOTION_SENSORS_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Includes ------------------------------------------------------------------*/
#include "b_wl5m_subg_conf.h"
#include "b_wl5m_subg_errno.h"
#include "motion_sensor.h"
#ifndef USE_MOTION_SENSOR_IIS2MDC_0
#define USE_MOTION_SENSOR_IIS2MDC_0 1
#endif /* USE_MOTION_SENSOR_IIS2MDC_0 */
#ifndef USE_MOTION_SENSOR_ISM330DHCX_0
#define USE_MOTION_SENSOR_ISM330DHCX_0 1
#endif /* USE_MOTION_SENSOR_ISM330DHCX_0 */
#if (USE_MOTION_SENSOR_IIS2MDC_0 == 1)
#include "iis2mdc.h"
#endif /* USE_MOTION_SENSOR_IIS2MDC_0 == 1 */
#if (USE_MOTION_SENSOR_ISM330DHCX_0 == 1)
#include "ism330dhcx.h"
#endif /* USE_MOTION_SENSOR_ISM330DHCX_0 == 1 */
/** @addtogroup BSP BSP
* @{
*/
/** @addtogroup B_WL5M_SUBG B-WL5M-SUBG
* @{
*/
/** @addtogroup B_WL5M_SUBG_MOTION_SENSORS
* @{
*/
/** @defgroup B_WL5M_SUBG_MOTION_SENSORS_Exported_Types B-WL5M-SUBG MOTION SENSORS Exported Types
* @{
*/
typedef struct
{
int32_t x;
int32_t y;
int32_t z;
} MOTION_SENSOR_Axes_t;
typedef struct
{
int16_t x;
int16_t y;
int16_t z;
} MOTION_SENSOR_AxesRaw_t;
/* Motion Sensor instance Info */
typedef struct
{
uint8_t Acc;
uint8_t Gyro;
uint8_t Magneto;
uint8_t LowPower;
uint32_t GyroMaxFS;
uint32_t AccMaxFS;
uint32_t MagMaxFS;
float GyroMaxOdr;
float AccMaxOdr;
float MagMaxOdr;
} MOTION_SENSOR_Capabilities_t;
typedef struct
{
uint32_t Functions;
} MOTION_SENSOR_Ctx_t;
/**
* @}
*/
/** @defgroup B_WL5M_SUBG_MOTION_SENSOR_Exported_Constants B-WL5M-SUBG MOTION SENSOR Exported Constants
* @{
*/
#if (USE_MOTION_SENSOR_IIS2MDC_0 == 1)
#define MOTION_SENSOR_IIS2MDC_0 0
#endif /* (USE_MOTION_SENSOR_IIS2MDC_0 == 1) */
#if (USE_MOTION_SENSOR_ISM330DHCX_0 == 1)
#define MOTION_SENSOR_ISM330DHCX_0 1
#endif /* (USE_MOTION_SENSOR_ISM330DHCX_0 == 1) */
#ifndef MOTION_GYRO
#define MOTION_GYRO 1U
#endif /* MOTION_GYRO */
#ifndef MOTION_ACCELERO
#define MOTION_ACCELERO 2U
#endif /* MOTION_ACCELERO */
#ifndef MOTION_MAGNETO
#define MOTION_MAGNETO 4U
#endif /* MOTION_MAGNETO */
#define MOTION_SENSOR_FUNCTIONS_NBR 3U
#define MOTION_SENSOR_INSTANCES_NBR (USE_MOTION_SENSOR_IIS2MDC_0 + \
USE_MOTION_SENSOR_ISM330DHCX_0)
#if (MOTION_SENSOR_FUNCTIONS_NBR == 0)
#error "No motion sensor instance has been selected"
#endif /* MOTION_SENSOR_FUNCTIONS_NBR == 0 */
/**
* @}
*/
/** @addtogroup B_WL5M_SUBG_MOTION_SENSORS_Exported_Functions
* @{
*/
int32_t BSP_MOTION_SENSOR_Init(uint32_t Instance, uint32_t Functions);
int32_t BSP_MOTION_SENSOR_DeInit(uint32_t Instance);
int32_t BSP_MOTION_SENSOR_GetCapabilities(uint32_t Instance, MOTION_SENSOR_Capabilities_t *Capabilities);
int32_t BSP_MOTION_SENSOR_ReadID(uint32_t Instance, uint8_t *Id);
int32_t BSP_MOTION_SENSOR_Enable(uint32_t Instance, uint32_t Function);
int32_t BSP_MOTION_SENSOR_Disable(uint32_t Instance, uint32_t Function);
int32_t BSP_MOTION_SENSOR_GetAxes(uint32_t Instance, uint32_t Function, MOTION_SENSOR_Axes_t *Axes);
int32_t BSP_MOTION_SENSOR_GetAxesRaw(uint32_t Instance, uint32_t Function, MOTION_SENSOR_AxesRaw_t *Axes);
int32_t BSP_MOTION_SENSOR_GetSensitivity(uint32_t Instance, uint32_t Function, float *Sensitivity);
int32_t BSP_MOTION_SENSOR_GetOutputDataRate(uint32_t Instance, uint32_t Function, float *Odr);
int32_t BSP_MOTION_SENSOR_SetOutputDataRate(uint32_t Instance, uint32_t Function, float Odr);
int32_t BSP_MOTION_SENSOR_GetFullScale(uint32_t Instance, uint32_t Function, int32_t *Fullscale);
int32_t BSP_MOTION_SENSOR_SetFullScale(uint32_t Instance, uint32_t Function, int32_t Fullscale);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* B_WL5M_SUBG_MOTION_SENSORS_H */