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