STM32Cube BSP FW for STM32F769I-Discovery
Dependents: mbed-os-example-blinky-5 DISCO-F769NI_TOUCHSCREEN_demo_custom_1 Datarecorder2 DISCO-F769NI_TOUCHSCREEN_demo ... more
Drivers/BSP/Components/Common/gyro.h@8:d13d7c447539, 2019-11-15 (annotated)
- Committer:
- Jerome Coutant
- Date:
- Fri Nov 15 14:50:16 2019 +0100
- Revision:
- 8:d13d7c447539
- Parent:
- 0:c0f3bbab73d2
Correct warning
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jerome Coutant
0:c0f3bbab73d2
|
1
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
2
|
******************************************************************************
|
|
Jerome Coutant
0:c0f3bbab73d2
|
3
|
* @file gyro.h
|
|
Jerome Coutant
0:c0f3bbab73d2
|
4
|
* @author MCD Application Team
|
|
Jerome Coutant
0:c0f3bbab73d2
|
5
|
* @version V4.0.1
|
|
Jerome Coutant
0:c0f3bbab73d2
|
6
|
* @date 21-July-2015
|
|
Jerome Coutant
0:c0f3bbab73d2
|
7
|
* @brief This header file contains the functions prototypes for the gyroscope driver.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
8
|
******************************************************************************
|
|
Jerome Coutant
0:c0f3bbab73d2
|
9
|
* @attention
|
|
Jerome Coutant
0:c0f3bbab73d2
|
10
|
*
|
|
Jerome Coutant
0:c0f3bbab73d2
|
11
|
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
|
|
Jerome Coutant
0:c0f3bbab73d2
|
12
|
*
|
|
Jerome Coutant
0:c0f3bbab73d2
|
13
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
14
|
* are permitted provided that the following conditions are met:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
15
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
16
|
* this list of conditions and the following disclaimer.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
17
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
18
|
* this list of conditions and the following disclaimer in the documentation
|
|
Jerome Coutant
0:c0f3bbab73d2
|
19
|
* and/or other materials provided with the distribution.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
20
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
Jerome Coutant
0:c0f3bbab73d2
|
21
|
* may be used to endorse or promote products derived from this software
|
|
Jerome Coutant
0:c0f3bbab73d2
|
22
|
* without specific prior written permission.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
23
|
*
|
|
Jerome Coutant
0:c0f3bbab73d2
|
24
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Jerome Coutant
0:c0f3bbab73d2
|
25
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Jerome Coutant
0:c0f3bbab73d2
|
26
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Jerome Coutant
0:c0f3bbab73d2
|
27
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
Jerome Coutant
0:c0f3bbab73d2
|
28
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Jerome Coutant
0:c0f3bbab73d2
|
29
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Jerome Coutant
0:c0f3bbab73d2
|
30
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Jerome Coutant
0:c0f3bbab73d2
|
31
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
32
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Jerome Coutant
0:c0f3bbab73d2
|
33
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
34
|
*
|
|
Jerome Coutant
0:c0f3bbab73d2
|
35
|
******************************************************************************
|
|
Jerome Coutant
0:c0f3bbab73d2
|
36
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
37
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
38
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
39
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
40
|
#ifndef __GYRO_H
|
|
Jerome Coutant
0:c0f3bbab73d2
|
41
|
#define __GYRO_H
|
|
Jerome Coutant
0:c0f3bbab73d2
|
42
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
43
|
#ifdef __cplusplus
|
|
Jerome Coutant
0:c0f3bbab73d2
|
44
|
extern "C" {
|
|
Jerome Coutant
0:c0f3bbab73d2
|
45
|
#endif
|
|
Jerome Coutant
0:c0f3bbab73d2
|
46
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
47
|
/* Includes ------------------------------------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
48
|
#include <stdint.h>
|
|
Jerome Coutant
0:c0f3bbab73d2
|
49
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
50
|
/** @addtogroup BSP
|
|
Jerome Coutant
0:c0f3bbab73d2
|
51
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
52
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
53
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
54
|
/** @addtogroup Components
|
|
Jerome Coutant
0:c0f3bbab73d2
|
55
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
56
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
57
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
58
|
/** @addtogroup GYRO
|
|
Jerome Coutant
0:c0f3bbab73d2
|
59
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
60
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
61
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
62
|
/** @defgroup GYRO_Exported_Types
|
|
Jerome Coutant
0:c0f3bbab73d2
|
63
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
64
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
65
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
66
|
/** @defgroup GYRO_Driver_structure Gyroscope Driver structure
|
|
Jerome Coutant
0:c0f3bbab73d2
|
67
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
68
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
69
|
typedef struct
|
|
Jerome Coutant
0:c0f3bbab73d2
|
70
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
71
|
void (*Init)(uint16_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
72
|
void (*DeInit)(void);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
73
|
uint8_t (*ReadID)(void);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
74
|
void (*Reset)(void);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
75
|
void (*LowPower)(uint16_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
76
|
void (*ConfigIT)(uint16_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
77
|
void (*EnableIT)(uint8_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
78
|
void (*DisableIT)(uint8_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
79
|
uint8_t (*ITStatus)(uint16_t, uint16_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
80
|
void (*ClearIT)(uint16_t, uint16_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
81
|
void (*FilterConfig)(uint8_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
82
|
void (*FilterCmd)(uint8_t);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
83
|
void (*GetXYZ)(float *);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
84
|
}GYRO_DrvTypeDef;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
85
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
86
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
87
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
88
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
89
|
/** @defgroup GYRO_Config_structure Gyroscope Configuration structure
|
|
Jerome Coutant
0:c0f3bbab73d2
|
90
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
91
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
92
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
93
|
typedef struct
|
|
Jerome Coutant
0:c0f3bbab73d2
|
94
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
95
|
uint8_t Power_Mode; /* Power-down/Sleep/Normal Mode */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
96
|
uint8_t Output_DataRate; /* OUT data rate */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
97
|
uint8_t Axes_Enable; /* Axes enable */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
98
|
uint8_t Band_Width; /* Bandwidth selection */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
99
|
uint8_t BlockData_Update; /* Block Data Update */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
100
|
uint8_t Endianness; /* Endian Data selection */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
101
|
uint8_t Full_Scale; /* Full Scale selection */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
102
|
}GYRO_InitTypeDef;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
103
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
104
|
/* GYRO High Pass Filter struct */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
105
|
typedef struct
|
|
Jerome Coutant
0:c0f3bbab73d2
|
106
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
107
|
uint8_t HighPassFilter_Mode_Selection; /* Internal filter mode */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
108
|
uint8_t HighPassFilter_CutOff_Frequency; /* High pass filter cut-off frequency */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
109
|
}GYRO_FilterConfigTypeDef;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
110
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
111
|
/*GYRO Interrupt struct */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
112
|
typedef struct
|
|
Jerome Coutant
0:c0f3bbab73d2
|
113
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
114
|
uint8_t Latch_Request; /* Latch interrupt request into CLICK_SRC register */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
115
|
uint8_t Interrupt_Axes; /* X, Y, Z Axes Interrupts */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
116
|
uint8_t Interrupt_ActiveEdge; /* Interrupt Active edge */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
117
|
}GYRO_InterruptConfigTypeDef;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
118
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
119
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
120
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
121
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
122
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
123
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
124
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
125
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
126
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
127
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
128
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
129
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
130
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
131
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
132
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
133
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
134
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
135
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
136
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
137
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
138
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
139
|
#ifdef __cplusplus
|
|
Jerome Coutant
0:c0f3bbab73d2
|
140
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
141
|
#endif
|
|
Jerome Coutant
0:c0f3bbab73d2
|
142
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
143
|
#endif /* __GYRO_H */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
144
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
145
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|