class IMU nucleo
Dependents: Coupe-Robotique-FIP-Main
Fork of IMU_FIP by
Components/HTS221/hts221.h@5:e2e603447679, 2015-05-21 (annotated)
- Committer:
- quentin9696
- Date:
- Thu May 21 11:21:58 2015 +0000
- Revision:
- 5:e2e603447679
- Parent:
- 0:528e23a13fb7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
quentin9696 | 0:528e23a13fb7 | 1 | /** |
quentin9696 | 0:528e23a13fb7 | 2 | ****************************************************************************** |
quentin9696 | 0:528e23a13fb7 | 3 | * @file x_cube_mems_hts221.h |
quentin9696 | 0:528e23a13fb7 | 4 | * @author AST / EST |
quentin9696 | 0:528e23a13fb7 | 5 | * @version V0.0.1 |
quentin9696 | 0:528e23a13fb7 | 6 | * @date 1-December-2014 |
quentin9696 | 0:528e23a13fb7 | 7 | * @brief Header file for component HTS221 |
quentin9696 | 0:528e23a13fb7 | 8 | ****************************************************************************** |
quentin9696 | 0:528e23a13fb7 | 9 | * @attention |
quentin9696 | 0:528e23a13fb7 | 10 | * |
quentin9696 | 0:528e23a13fb7 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
quentin9696 | 0:528e23a13fb7 | 12 | * |
quentin9696 | 0:528e23a13fb7 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
quentin9696 | 0:528e23a13fb7 | 14 | * are permitted provided that the following conditions are met: |
quentin9696 | 0:528e23a13fb7 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
quentin9696 | 0:528e23a13fb7 | 16 | * this list of conditions and the following disclaimer. |
quentin9696 | 0:528e23a13fb7 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
quentin9696 | 0:528e23a13fb7 | 18 | * this list of conditions and the following disclaimer in the documentation |
quentin9696 | 0:528e23a13fb7 | 19 | * and/or other materials provided with the distribution. |
quentin9696 | 0:528e23a13fb7 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
quentin9696 | 0:528e23a13fb7 | 21 | * may be used to endorse or promote products derived from this software |
quentin9696 | 0:528e23a13fb7 | 22 | * without specific prior written permission. |
quentin9696 | 0:528e23a13fb7 | 23 | * |
quentin9696 | 0:528e23a13fb7 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
quentin9696 | 0:528e23a13fb7 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
quentin9696 | 0:528e23a13fb7 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
quentin9696 | 0:528e23a13fb7 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
quentin9696 | 0:528e23a13fb7 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
quentin9696 | 0:528e23a13fb7 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
quentin9696 | 0:528e23a13fb7 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
quentin9696 | 0:528e23a13fb7 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
quentin9696 | 0:528e23a13fb7 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
quentin9696 | 0:528e23a13fb7 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
quentin9696 | 0:528e23a13fb7 | 34 | * |
quentin9696 | 0:528e23a13fb7 | 35 | ****************************************************************************** |
quentin9696 | 0:528e23a13fb7 | 36 | */ |
quentin9696 | 0:528e23a13fb7 | 37 | |
quentin9696 | 0:528e23a13fb7 | 38 | #ifndef __X_CUBE_MEMS_HTS221_H |
quentin9696 | 0:528e23a13fb7 | 39 | #define __X_CUBE_MEMS_HTS221_H |
quentin9696 | 0:528e23a13fb7 | 40 | |
quentin9696 | 0:528e23a13fb7 | 41 | /* Includes ------------------------------------------------------------------*/ |
quentin9696 | 0:528e23a13fb7 | 42 | #include "mbed.h" |
quentin9696 | 0:528e23a13fb7 | 43 | #include "x_cube_mems_i2c.h" |
quentin9696 | 0:528e23a13fb7 | 44 | |
quentin9696 | 0:528e23a13fb7 | 45 | /* Classes -------------------------------------------------------------------*/ |
quentin9696 | 0:528e23a13fb7 | 46 | /** Class representing a HTS221 sensor component |
quentin9696 | 0:528e23a13fb7 | 47 | */ |
quentin9696 | 0:528e23a13fb7 | 48 | class HTS221 |
quentin9696 | 0:528e23a13fb7 | 49 | { |
quentin9696 | 0:528e23a13fb7 | 50 | public: |
quentin9696 | 0:528e23a13fb7 | 51 | /** Constructor |
quentin9696 | 0:528e23a13fb7 | 52 | * @param |
quentin9696 | 0:528e23a13fb7 | 53 | */ |
quentin9696 | 0:528e23a13fb7 | 54 | HTS221(DevI2C &i2c) : dev_i2c(i2c) { |
quentin9696 | 0:528e23a13fb7 | 55 | HumTempInitialized = 0; |
quentin9696 | 0:528e23a13fb7 | 56 | Init(); |
quentin9696 | 0:528e23a13fb7 | 57 | }; |
quentin9696 | 0:528e23a13fb7 | 58 | |
quentin9696 | 0:528e23a13fb7 | 59 | int GetTemperature(float* pfData); |
quentin9696 | 0:528e23a13fb7 | 60 | int GetHumidity(float* pfData); |
quentin9696 | 0:528e23a13fb7 | 61 | void Init(/*HUM_TEMP_InitTypeDef *HTS221_Init*/); |
quentin9696 | 0:528e23a13fb7 | 62 | uint8_t ReadID(void); |
quentin9696 | 0:528e23a13fb7 | 63 | void RebootCmd(void); |
quentin9696 | 0:528e23a13fb7 | 64 | int Power_OFF(void); |
quentin9696 | 0:528e23a13fb7 | 65 | int Power_ON(void); |
quentin9696 | 0:528e23a13fb7 | 66 | int HTS221_Calibration(); |
quentin9696 | 0:528e23a13fb7 | 67 | private: |
quentin9696 | 0:528e23a13fb7 | 68 | |
quentin9696 | 0:528e23a13fb7 | 69 | uint8_t isInitialized(void) |
quentin9696 | 0:528e23a13fb7 | 70 | { |
quentin9696 | 0:528e23a13fb7 | 71 | return HumTempInitialized; |
quentin9696 | 0:528e23a13fb7 | 72 | } |
quentin9696 | 0:528e23a13fb7 | 73 | |
quentin9696 | 0:528e23a13fb7 | 74 | DevI2C &dev_i2c; |
quentin9696 | 0:528e23a13fb7 | 75 | uint8_t HumTempInitialized; |
quentin9696 | 0:528e23a13fb7 | 76 | }; |
quentin9696 | 0:528e23a13fb7 | 77 | |
quentin9696 | 0:528e23a13fb7 | 78 | #endif // __X_CUBE_MEMS_HTS221_H |