wayne roberts / Mbed OS CB-LORA-MR_utility

Dependencies:   SX127x

Committer:
Wayne Roberts
Date:
Wed Apr 24 10:11:06 2019 -0700
Revision:
0:e1e70da93044
initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wayne Roberts 0:e1e70da93044 1 /**
Wayne Roberts 0:e1e70da93044 2 ******************************************************************************
Wayne Roberts 0:e1e70da93044 3 * @file accelerometer.h
Wayne Roberts 0:e1e70da93044 4 * @author MEMS Application Team
Wayne Roberts 0:e1e70da93044 5 * @brief This header file contains the functions prototypes for the
Wayne Roberts 0:e1e70da93044 6 * accelerometer driver
Wayne Roberts 0:e1e70da93044 7 ******************************************************************************
Wayne Roberts 0:e1e70da93044 8 * @attention
Wayne Roberts 0:e1e70da93044 9 *
Wayne Roberts 0:e1e70da93044 10 * <h2><center>&copy; COPYRIGHT(c) 2018 STMicroelectronics</center></h2>
Wayne Roberts 0:e1e70da93044 11 *
Wayne Roberts 0:e1e70da93044 12 * Redistribution and use in source and binary forms, with or without modification,
Wayne Roberts 0:e1e70da93044 13 * are permitted provided that the following conditions are met:
Wayne Roberts 0:e1e70da93044 14 * 1. Redistributions of source code must retain the above copyright notice,
Wayne Roberts 0:e1e70da93044 15 * this list of conditions and the following disclaimer.
Wayne Roberts 0:e1e70da93044 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
Wayne Roberts 0:e1e70da93044 17 * this list of conditions and the following disclaimer in the documentation
Wayne Roberts 0:e1e70da93044 18 * and/or other materials provided with the distribution.
Wayne Roberts 0:e1e70da93044 19 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Wayne Roberts 0:e1e70da93044 20 * may be used to endorse or promote products derived from this software
Wayne Roberts 0:e1e70da93044 21 * without specific prior written permission.
Wayne Roberts 0:e1e70da93044 22 *
Wayne Roberts 0:e1e70da93044 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Wayne Roberts 0:e1e70da93044 24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Wayne Roberts 0:e1e70da93044 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Wayne Roberts 0:e1e70da93044 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Wayne Roberts 0:e1e70da93044 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Wayne Roberts 0:e1e70da93044 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Wayne Roberts 0:e1e70da93044 29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Wayne Roberts 0:e1e70da93044 30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Wayne Roberts 0:e1e70da93044 31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Wayne Roberts 0:e1e70da93044 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wayne Roberts 0:e1e70da93044 33 *
Wayne Roberts 0:e1e70da93044 34 ******************************************************************************
Wayne Roberts 0:e1e70da93044 35 */
Wayne Roberts 0:e1e70da93044 36
Wayne Roberts 0:e1e70da93044 37 /* Define to prevent recursive inclusion -------------------------------------*/
Wayne Roberts 0:e1e70da93044 38 #ifndef __ACCELEROMETER_H
Wayne Roberts 0:e1e70da93044 39 #define __ACCELEROMETER_H
Wayne Roberts 0:e1e70da93044 40
Wayne Roberts 0:e1e70da93044 41 #ifdef __cplusplus
Wayne Roberts 0:e1e70da93044 42 extern "C" {
Wayne Roberts 0:e1e70da93044 43 #endif
Wayne Roberts 0:e1e70da93044 44
Wayne Roberts 0:e1e70da93044 45
Wayne Roberts 0:e1e70da93044 46
Wayne Roberts 0:e1e70da93044 47 /* Includes ------------------------------------------------------------------*/
Wayne Roberts 0:e1e70da93044 48 #include "sensor.h"
Wayne Roberts 0:e1e70da93044 49
Wayne Roberts 0:e1e70da93044 50 /** @addtogroup BSP BSP
Wayne Roberts 0:e1e70da93044 51 * @{
Wayne Roberts 0:e1e70da93044 52 */
Wayne Roberts 0:e1e70da93044 53
Wayne Roberts 0:e1e70da93044 54 /** @addtogroup COMPONENTS COMPONENTS
Wayne Roberts 0:e1e70da93044 55 * @{
Wayne Roberts 0:e1e70da93044 56 */
Wayne Roberts 0:e1e70da93044 57
Wayne Roberts 0:e1e70da93044 58 /** @addtogroup COMMON COMMON
Wayne Roberts 0:e1e70da93044 59 * @{
Wayne Roberts 0:e1e70da93044 60 */
Wayne Roberts 0:e1e70da93044 61
Wayne Roberts 0:e1e70da93044 62 /** @addtogroup ACCELEROMETER ACCELEROMETER
Wayne Roberts 0:e1e70da93044 63 * @{
Wayne Roberts 0:e1e70da93044 64 */
Wayne Roberts 0:e1e70da93044 65
Wayne Roberts 0:e1e70da93044 66 /** @addtogroup ACCELEROMETER_Public_Types ACCELEROMETER Public types
Wayne Roberts 0:e1e70da93044 67 * @{
Wayne Roberts 0:e1e70da93044 68 */
Wayne Roberts 0:e1e70da93044 69
Wayne Roberts 0:e1e70da93044 70 /**
Wayne Roberts 0:e1e70da93044 71 * @brief ACCELEROMETER driver structure definition
Wayne Roberts 0:e1e70da93044 72 */
Wayne Roberts 0:e1e70da93044 73 typedef struct
Wayne Roberts 0:e1e70da93044 74 {
Wayne Roberts 0:e1e70da93044 75 DrvStatusTypeDef(*Init)(DrvContextTypeDef *);
Wayne Roberts 0:e1e70da93044 76 DrvStatusTypeDef(*DeInit)(DrvContextTypeDef *);
Wayne Roberts 0:e1e70da93044 77 DrvStatusTypeDef(*Sensor_Enable)(DrvContextTypeDef *);
Wayne Roberts 0:e1e70da93044 78 DrvStatusTypeDef(*Sensor_Disable)(DrvContextTypeDef *);
Wayne Roberts 0:e1e70da93044 79 DrvStatusTypeDef(*Get_WhoAmI)(DrvContextTypeDef *, uint8_t *);
Wayne Roberts 0:e1e70da93044 80 DrvStatusTypeDef(*Check_WhoAmI)(DrvContextTypeDef *);
Wayne Roberts 0:e1e70da93044 81 DrvStatusTypeDef(*Get_Axes)(DrvContextTypeDef *, SensorAxes_t *);
Wayne Roberts 0:e1e70da93044 82 DrvStatusTypeDef(*Get_AxesRaw)(DrvContextTypeDef *, SensorAxesRaw_t *);
Wayne Roberts 0:e1e70da93044 83 DrvStatusTypeDef(*Get_Sensitivity)(DrvContextTypeDef *, float *);
Wayne Roberts 0:e1e70da93044 84 DrvStatusTypeDef(*Get_ODR)(DrvContextTypeDef *, float *);
Wayne Roberts 0:e1e70da93044 85 DrvStatusTypeDef(*Set_ODR)(DrvContextTypeDef *, SensorOdr_t);
Wayne Roberts 0:e1e70da93044 86 DrvStatusTypeDef(*Set_ODR_Value)(DrvContextTypeDef *, float);
Wayne Roberts 0:e1e70da93044 87 DrvStatusTypeDef(*Get_FS)(DrvContextTypeDef *, float *);
Wayne Roberts 0:e1e70da93044 88 DrvStatusTypeDef(*Set_FS)(DrvContextTypeDef *, SensorFs_t);
Wayne Roberts 0:e1e70da93044 89 DrvStatusTypeDef(*Set_FS_Value)(DrvContextTypeDef *, float);
Wayne Roberts 0:e1e70da93044 90 DrvStatusTypeDef(*Get_Axes_Status)(DrvContextTypeDef *, uint8_t *);
Wayne Roberts 0:e1e70da93044 91 DrvStatusTypeDef(*Set_Axes_Status)(DrvContextTypeDef *, uint8_t *);
Wayne Roberts 0:e1e70da93044 92 DrvStatusTypeDef(*Read_Reg)(DrvContextTypeDef *, uint8_t, uint8_t *);
Wayne Roberts 0:e1e70da93044 93 DrvStatusTypeDef(*Write_Reg)(DrvContextTypeDef *, uint8_t, uint8_t);
Wayne Roberts 0:e1e70da93044 94 DrvStatusTypeDef(*Get_DRDY_Status)(DrvContextTypeDef *, uint8_t *);
Wayne Roberts 0:e1e70da93044 95 } ACCELERO_Drv_t;
Wayne Roberts 0:e1e70da93044 96
Wayne Roberts 0:e1e70da93044 97 /**
Wayne Roberts 0:e1e70da93044 98 * @brief ACCELEROMETER data structure definition
Wayne Roberts 0:e1e70da93044 99 */
Wayne Roberts 0:e1e70da93044 100 typedef struct
Wayne Roberts 0:e1e70da93044 101 {
Wayne Roberts 0:e1e70da93044 102 void *pComponentData; /* Component specific data. */
Wayne Roberts 0:e1e70da93044 103 void *pExtData; /* Other data. */
Wayne Roberts 0:e1e70da93044 104 } ACCELERO_Data_t;
Wayne Roberts 0:e1e70da93044 105
Wayne Roberts 0:e1e70da93044 106 typedef enum
Wayne Roberts 0:e1e70da93044 107 {
Wayne Roberts 0:e1e70da93044 108 X_AXIS = 0,
Wayne Roberts 0:e1e70da93044 109 Y_AXIS,
Wayne Roberts 0:e1e70da93044 110 Z_AXIS,
Wayne Roberts 0:e1e70da93044 111 ALL_ACTIVE
Wayne Roberts 0:e1e70da93044 112 } ACTIVE_AXIS_t;
Wayne Roberts 0:e1e70da93044 113
Wayne Roberts 0:e1e70da93044 114 typedef enum
Wayne Roberts 0:e1e70da93044 115 {
Wayne Roberts 0:e1e70da93044 116 NORMAL_MODE,
Wayne Roberts 0:e1e70da93044 117 HIGH_RES_MODE,
Wayne Roberts 0:e1e70da93044 118 LOW_PWR_MODE
Wayne Roberts 0:e1e70da93044 119 } OP_MODE_t;
Wayne Roberts 0:e1e70da93044 120
Wayne Roberts 0:e1e70da93044 121 typedef enum
Wayne Roberts 0:e1e70da93044 122 {
Wayne Roberts 0:e1e70da93044 123 INT1_DRDY_DISABLED,
Wayne Roberts 0:e1e70da93044 124 INT1_DRDY_ENABLED
Wayne Roberts 0:e1e70da93044 125 } INT1_DRDY_CONFIG_t;
Wayne Roberts 0:e1e70da93044 126
Wayne Roberts 0:e1e70da93044 127 typedef enum
Wayne Roberts 0:e1e70da93044 128 {
Wayne Roberts 0:e1e70da93044 129 DRDY_PULSED,
Wayne Roberts 0:e1e70da93044 130 DRDY_LATCHED
Wayne Roberts 0:e1e70da93044 131 } DRDY_MODE_t;
Wayne Roberts 0:e1e70da93044 132
Wayne Roberts 0:e1e70da93044 133
Wayne Roberts 0:e1e70da93044 134 /**
Wayne Roberts 0:e1e70da93044 135 * @brief ACCELEROMETER hardware features status data structure definition
Wayne Roberts 0:e1e70da93044 136 */
Wayne Roberts 0:e1e70da93044 137 typedef struct
Wayne Roberts 0:e1e70da93044 138 {
Wayne Roberts 0:e1e70da93044 139 unsigned int FreeFallStatus : 1;
Wayne Roberts 0:e1e70da93044 140 unsigned int TapStatus : 1;
Wayne Roberts 0:e1e70da93044 141 unsigned int DoubleTapStatus : 1;
Wayne Roberts 0:e1e70da93044 142 unsigned int WakeUpStatus : 1;
Wayne Roberts 0:e1e70da93044 143 unsigned int StepStatus : 1;
Wayne Roberts 0:e1e70da93044 144 unsigned int TiltStatus : 1;
Wayne Roberts 0:e1e70da93044 145 unsigned int D6DOrientationStatus : 1;
Wayne Roberts 0:e1e70da93044 146 } ACCELERO_Event_Status_t;
Wayne Roberts 0:e1e70da93044 147
Wayne Roberts 0:e1e70da93044 148 /**
Wayne Roberts 0:e1e70da93044 149 * @}
Wayne Roberts 0:e1e70da93044 150 */
Wayne Roberts 0:e1e70da93044 151
Wayne Roberts 0:e1e70da93044 152 /**
Wayne Roberts 0:e1e70da93044 153 * @}
Wayne Roberts 0:e1e70da93044 154 */
Wayne Roberts 0:e1e70da93044 155
Wayne Roberts 0:e1e70da93044 156 /**
Wayne Roberts 0:e1e70da93044 157 * @}
Wayne Roberts 0:e1e70da93044 158 */
Wayne Roberts 0:e1e70da93044 159
Wayne Roberts 0:e1e70da93044 160 /**
Wayne Roberts 0:e1e70da93044 161 * @}
Wayne Roberts 0:e1e70da93044 162 */
Wayne Roberts 0:e1e70da93044 163
Wayne Roberts 0:e1e70da93044 164 /**
Wayne Roberts 0:e1e70da93044 165 * @}
Wayne Roberts 0:e1e70da93044 166 */
Wayne Roberts 0:e1e70da93044 167
Wayne Roberts 0:e1e70da93044 168 #ifdef __cplusplus
Wayne Roberts 0:e1e70da93044 169 }
Wayne Roberts 0:e1e70da93044 170 #endif
Wayne Roberts 0:e1e70da93044 171
Wayne Roberts 0:e1e70da93044 172 #endif /* __ACCELEROMETER_H */
Wayne Roberts 0:e1e70da93044 173
Wayne Roberts 0:e1e70da93044 174 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/