Shih-Ho Hsieh / XYZ_sensor_Platform_SPI

Fork of XYZ_sensor_Platform by Shih-Ho Hsieh

Committer:
hober
Date:
Thu Nov 09 03:40:43 2017 +0000
Revision:
2:856f03e64695
20171109

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hober 2:856f03e64695 1 /**
hober 2:856f03e64695 2 ******************************************************************************
hober 2:856f03e64695 3 * @file pressure.h
hober 2:856f03e64695 4 * @author MEMS Application Team
hober 2:856f03e64695 5 * @version V1.2.0
hober 2:856f03e64695 6 * @date 28-January-2015
hober 2:856f03e64695 7 * @brief This header file contains the functions prototypes for the
hober 2:856f03e64695 8 * pressure driver.
hober 2:856f03e64695 9 ******************************************************************************
hober 2:856f03e64695 10 * @attention
hober 2:856f03e64695 11 *
hober 2:856f03e64695 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
hober 2:856f03e64695 13 *
hober 2:856f03e64695 14 * Redistribution and use in source and binary forms, with or without modification,
hober 2:856f03e64695 15 * are permitted provided that the following conditions are met:
hober 2:856f03e64695 16 * 1. Redistributions of source code must retain the above copyright notice,
hober 2:856f03e64695 17 * this list of conditions and the following disclaimer.
hober 2:856f03e64695 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
hober 2:856f03e64695 19 * this list of conditions and the following disclaimer in the documentation
hober 2:856f03e64695 20 * and/or other materials provided with the distribution.
hober 2:856f03e64695 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
hober 2:856f03e64695 22 * may be used to endorse or promote products derived from this software
hober 2:856f03e64695 23 * without specific prior written permission.
hober 2:856f03e64695 24 *
hober 2:856f03e64695 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
hober 2:856f03e64695 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
hober 2:856f03e64695 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
hober 2:856f03e64695 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
hober 2:856f03e64695 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
hober 2:856f03e64695 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
hober 2:856f03e64695 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
hober 2:856f03e64695 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
hober 2:856f03e64695 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
hober 2:856f03e64695 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
hober 2:856f03e64695 35 *
hober 2:856f03e64695 36 ******************************************************************************
hober 2:856f03e64695 37 */
hober 2:856f03e64695 38
hober 2:856f03e64695 39
hober 2:856f03e64695 40 /* Define to prevent recursive inclusion -------------------------------------*/
hober 2:856f03e64695 41 #ifndef __PRESSURE_H
hober 2:856f03e64695 42 #define __PRESSURE_H
hober 2:856f03e64695 43
hober 2:856f03e64695 44 #ifdef __cplusplus
hober 2:856f03e64695 45 extern "C" {
hober 2:856f03e64695 46 #endif
hober 2:856f03e64695 47
hober 2:856f03e64695 48 /* Includes ------------------------------------------------------------------*/
hober 2:856f03e64695 49 #include <stdint.h>
hober 2:856f03e64695 50
hober 2:856f03e64695 51 /** @addtogroup BSP
hober 2:856f03e64695 52 * @{
hober 2:856f03e64695 53 */
hober 2:856f03e64695 54
hober 2:856f03e64695 55 /** @addtogroup Components
hober 2:856f03e64695 56 * @{
hober 2:856f03e64695 57 */
hober 2:856f03e64695 58
hober 2:856f03e64695 59 /** @addtogroup PRESSURE
hober 2:856f03e64695 60 * @{
hober 2:856f03e64695 61 */
hober 2:856f03e64695 62
hober 2:856f03e64695 63 /** @defgroup PRESSURE_Exported_Types
hober 2:856f03e64695 64 * @{
hober 2:856f03e64695 65 */
hober 2:856f03e64695 66
hober 2:856f03e64695 67 /**
hober 2:856f03e64695 68 * @brief PRESSURE init structure definition
hober 2:856f03e64695 69 */
hober 2:856f03e64695 70 typedef struct
hober 2:856f03e64695 71 {
hober 2:856f03e64695 72 uint8_t OutputDataRate;
hober 2:856f03e64695 73 uint8_t PressureResolution;
hober 2:856f03e64695 74 uint8_t TemperatureResolution;
hober 2:856f03e64695 75 uint8_t DiffEnable;
hober 2:856f03e64695 76 uint8_t BlockDataUpdate;
hober 2:856f03e64695 77 uint8_t SPIMode;
hober 2:856f03e64695 78 } PRESSURE_InitTypeDef;
hober 2:856f03e64695 79
hober 2:856f03e64695 80 /**
hober 2:856f03e64695 81 * @brief PRESSURE status enumerator definition
hober 2:856f03e64695 82 */
hober 2:856f03e64695 83 typedef enum
hober 2:856f03e64695 84 {
hober 2:856f03e64695 85 PRESSURE_OK = 0,
hober 2:856f03e64695 86 PRESSURE_ERROR = 1,
hober 2:856f03e64695 87 PRESSURE_TIMEOUT = 2,
hober 2:856f03e64695 88 PRESSURE_NOT_IMPLEMENTED = 3
hober 2:856f03e64695 89 } PRESSURE_StatusTypeDef;
hober 2:856f03e64695 90
hober 2:856f03e64695 91 /**
hober 2:856f03e64695 92 * @brief PRESSURE component id enumerator definition
hober 2:856f03e64695 93 */
hober 2:856f03e64695 94 typedef enum
hober 2:856f03e64695 95 {
hober 2:856f03e64695 96 PRESSURE_NONE_COMPONENT = 0,
hober 2:856f03e64695 97 PRESSURE_LPS25H_COMPONENT = 1,
hober 2:856f03e64695 98 PRESSURE_LPS25HB_DIL24_COMPONENT = 2
hober 2:856f03e64695 99 } PRESSURE_ComponentTypeDef;
hober 2:856f03e64695 100
hober 2:856f03e64695 101 /**
hober 2:856f03e64695 102 * @brief PRESSURE driver extended structure definition
hober 2:856f03e64695 103 */
hober 2:856f03e64695 104 typedef struct
hober 2:856f03e64695 105 {
hober 2:856f03e64695 106 PRESSURE_ComponentTypeDef
hober 2:856f03e64695 107 id; /* This id must be unique for each component belonging to this class that wants to extend common class */
hober 2:856f03e64695 108 void *pData; /* This pointer is specific for each component */
hober 2:856f03e64695 109 } PRESSURE_DrvExtTypeDef;
hober 2:856f03e64695 110
hober 2:856f03e64695 111 /**
hober 2:856f03e64695 112 * @brief PRESSURE driver structure definition
hober 2:856f03e64695 113 */
hober 2:856f03e64695 114 typedef struct
hober 2:856f03e64695 115 {
hober 2:856f03e64695 116 PRESSURE_StatusTypeDef (*Init)(PRESSURE_InitTypeDef *);
hober 2:856f03e64695 117 PRESSURE_StatusTypeDef (*PowerOff)(void);
hober 2:856f03e64695 118 PRESSURE_StatusTypeDef (*ReadID)(uint8_t *);
hober 2:856f03e64695 119 PRESSURE_StatusTypeDef (*Reset)(void);
hober 2:856f03e64695 120 void (*ConfigIT)(uint16_t);
hober 2:856f03e64695 121 void (*EnableIT)(uint8_t);
hober 2:856f03e64695 122 void (*DisableIT)(uint8_t);
hober 2:856f03e64695 123 uint8_t (*ITStatus)(uint16_t, uint16_t);
hober 2:856f03e64695 124 void (*ClearIT)(uint16_t, uint16_t);
hober 2:856f03e64695 125 PRESSURE_StatusTypeDef (*GetPressure)(float *);
hober 2:856f03e64695 126 PRESSURE_StatusTypeDef (*GetTemperature)(float *);
hober 2:856f03e64695 127 void (*SlaveAddrRemap)(uint8_t);
hober 2:856f03e64695 128 PRESSURE_DrvExtTypeDef *extData;
hober 2:856f03e64695 129 } PRESSURE_DrvTypeDef;
hober 2:856f03e64695 130
hober 2:856f03e64695 131 /**
hober 2:856f03e64695 132 * @}
hober 2:856f03e64695 133 */
hober 2:856f03e64695 134
hober 2:856f03e64695 135 /**
hober 2:856f03e64695 136 * @}
hober 2:856f03e64695 137 */
hober 2:856f03e64695 138
hober 2:856f03e64695 139 /**
hober 2:856f03e64695 140 * @}
hober 2:856f03e64695 141 */
hober 2:856f03e64695 142
hober 2:856f03e64695 143 /**
hober 2:856f03e64695 144 * @}
hober 2:856f03e64695 145 */
hober 2:856f03e64695 146
hober 2:856f03e64695 147 #ifdef __cplusplus
hober 2:856f03e64695 148 }
hober 2:856f03e64695 149 #endif
hober 2:856f03e64695 150
hober 2:856f03e64695 151 #endif /* __PRESSURE_H */
hober 2:856f03e64695 152
hober 2:856f03e64695 153 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/