Official interfaces for ST components.

Dependents:   X_NUCLEO_IKS01A1 mDot_X_NUCLEO_IKS01A1 53L0A1 X_NUCLEO_IKS01A1 ... more

Fork of ST_INTERFACES by Davide Aliprandi

This library contains all abstract classes which together constitute the common API to which all existing and future ST components will adhere to.

Committer:
Davidroid
Date:
Mon Aug 01 15:06:25 2016 +0000
Revision:
0:f6dd8f22f875
Child:
1:a7810e7acf8d
Interfaces for mbed libraries.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Davidroid 0:f6dd8f22f875 1 /**
Davidroid 0:f6dd8f22f875 2 ******************************************************************************
Davidroid 0:f6dd8f22f875 3 * @file GyroSensor.h
Davidroid 0:f6dd8f22f875 4 * @author AST / EST
Davidroid 0:f6dd8f22f875 5 * @version V0.0.1
Davidroid 0:f6dd8f22f875 6 * @date 13-April-2015
Davidroid 0:f6dd8f22f875 7 * @brief This file contains the abstract class describing in general
Davidroid 0:f6dd8f22f875 8 * the interfaces of a gyroscope
Davidroid 0:f6dd8f22f875 9 ******************************************************************************
Davidroid 0:f6dd8f22f875 10 * @attention
Davidroid 0:f6dd8f22f875 11 *
Davidroid 0:f6dd8f22f875 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Davidroid 0:f6dd8f22f875 13 *
Davidroid 0:f6dd8f22f875 14 * Redistribution and use in source and binary forms, with or without modification,
Davidroid 0:f6dd8f22f875 15 * are permitted provided that the following conditions are met:
Davidroid 0:f6dd8f22f875 16 * 1. Redistributions of source code must retain the above copyright notice,
Davidroid 0:f6dd8f22f875 17 * this list of conditions and the following disclaimer.
Davidroid 0:f6dd8f22f875 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Davidroid 0:f6dd8f22f875 19 * this list of conditions and the following disclaimer in the documentation
Davidroid 0:f6dd8f22f875 20 * and/or other materials provided with the distribution.
Davidroid 0:f6dd8f22f875 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Davidroid 0:f6dd8f22f875 22 * may be used to endorse or promote products derived from this software
Davidroid 0:f6dd8f22f875 23 * without specific prior written permission.
Davidroid 0:f6dd8f22f875 24 *
Davidroid 0:f6dd8f22f875 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Davidroid 0:f6dd8f22f875 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Davidroid 0:f6dd8f22f875 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Davidroid 0:f6dd8f22f875 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Davidroid 0:f6dd8f22f875 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Davidroid 0:f6dd8f22f875 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Davidroid 0:f6dd8f22f875 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Davidroid 0:f6dd8f22f875 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Davidroid 0:f6dd8f22f875 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Davidroid 0:f6dd8f22f875 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Davidroid 0:f6dd8f22f875 35 *
Davidroid 0:f6dd8f22f875 36 ******************************************************************************
Davidroid 0:f6dd8f22f875 37 */
Davidroid 0:f6dd8f22f875 38
Davidroid 0:f6dd8f22f875 39 /* Define to prevent from recursive inclusion --------------------------------*/
Davidroid 0:f6dd8f22f875 40 #ifndef __GYRO_SENSOR_CLASS_H
Davidroid 0:f6dd8f22f875 41 #define __GYRO_SENSOR_CLASS_H
Davidroid 0:f6dd8f22f875 42
Davidroid 0:f6dd8f22f875 43 /* Includes ------------------------------------------------------------------*/
Davidroid 0:f6dd8f22f875 44 #include <Component_class.h>
Davidroid 0:f6dd8f22f875 45
Davidroid 0:f6dd8f22f875 46 /* Classes ------------------------------------------------------------------*/
Davidroid 0:f6dd8f22f875 47 /** An abstract class for a Gyroscope
Davidroid 0:f6dd8f22f875 48 */
Davidroid 0:f6dd8f22f875 49 class GyroSensor : public Component
Davidroid 0:f6dd8f22f875 50 {
Davidroid 0:f6dd8f22f875 51 public:
Davidroid 0:f6dd8f22f875 52 /**
Davidroid 0:f6dd8f22f875 53 * @brief Get current gyroscope angular rate X/Y/Z-axes values
Davidroid 0:f6dd8f22f875 54 * in standard data units [mdps]
Davidroid 0:f6dd8f22f875 55 * @param[out] pData Pointer to where to store angular rates to.
Davidroid 0:f6dd8f22f875 56 * pData must point to an array of (at least) three elements, where:
Davidroid 0:f6dd8f22f875 57 * pData[0] corresponds to X-axis,
Davidroid 0:f6dd8f22f875 58 * pData[1] corresponds to Y-axis, and
Davidroid 0:f6dd8f22f875 59 * pData[2] corresponds to Z-axis.
Davidroid 0:f6dd8f22f875 60 * @return 0 in case of success, an error code otherwise
Davidroid 0:f6dd8f22f875 61 */
Davidroid 0:f6dd8f22f875 62 virtual int Get_G_Axes(int32_t *pData) = 0;
Davidroid 0:f6dd8f22f875 63
Davidroid 0:f6dd8f22f875 64 /**
Davidroid 0:f6dd8f22f875 65 * @brief Get current gyroscope raw data X/Y/Z-axes values
Davidroid 0:f6dd8f22f875 66 * in device sepcific LSB units
Davidroid 0:f6dd8f22f875 67 * @param[out] pData Pointer to where to store gyroscope raw data to.
Davidroid 0:f6dd8f22f875 68 * pData must point to an array of (at least) three elements, where:
Davidroid 0:f6dd8f22f875 69 * pData[0] corresponds to X-axis,
Davidroid 0:f6dd8f22f875 70 * pData[1] corresponds to Y-axis, and
Davidroid 0:f6dd8f22f875 71 * pData[2] corresponds to Z-axis.
Davidroid 0:f6dd8f22f875 72 * @return 0 in case of success, an error code otherwise
Davidroid 0:f6dd8f22f875 73 */
Davidroid 0:f6dd8f22f875 74 virtual int Get_G_AxesRaw(int16_t *pData) = 0;
Davidroid 0:f6dd8f22f875 75
Davidroid 0:f6dd8f22f875 76 /**
Davidroid 0:f6dd8f22f875 77 * @brief Get gyroscope's current sensitivity [mdps/LSB]
Davidroid 0:f6dd8f22f875 78 * @param[out] pfData Pointer to where the gyroscope's sensitivity is stored to
Davidroid 0:f6dd8f22f875 79 * @return 0 in case of success, an error code otherwise
Davidroid 0:f6dd8f22f875 80 */
Davidroid 0:f6dd8f22f875 81 virtual int Get_G_Sensitivity(float *pfData) = 0;
Davidroid 0:f6dd8f22f875 82
Davidroid 0:f6dd8f22f875 83 /**
Davidroid 0:f6dd8f22f875 84 * @brief Get gyroscope's current output data rate [Hz]
Davidroid 0:f6dd8f22f875 85 * @param[out] pfData Pointer to where the gyroscope output data rate is stored to
Davidroid 0:f6dd8f22f875 86 * @return 0 in case of success, an error code otherwise
Davidroid 0:f6dd8f22f875 87 */
Davidroid 0:f6dd8f22f875 88 virtual int Get_G_ODR(float *pfData) = 0;
Davidroid 0:f6dd8f22f875 89
Davidroid 0:f6dd8f22f875 90 /**
Davidroid 0:f6dd8f22f875 91 * @brief Set gyroscope's output data rate
Davidroid 0:f6dd8f22f875 92 * @param[in] odr New value for gyroscope's output data rate in [Hz]
Davidroid 0:f6dd8f22f875 93 * @return 0 in case of success, an error code otherwise
Davidroid 0:f6dd8f22f875 94 */
Davidroid 0:f6dd8f22f875 95 virtual int Set_G_ODR(float odr) = 0;
Davidroid 0:f6dd8f22f875 96
Davidroid 0:f6dd8f22f875 97 /**
Davidroid 0:f6dd8f22f875 98 * @brief Get gyroscope's full scale value
Davidroid 0:f6dd8f22f875 99 * i.e.\ min/max measurable value [dps]
Davidroid 0:f6dd8f22f875 100 * @param[out] pfData Pointer to where the gyroscope full scale value is stored to
Davidroid 0:f6dd8f22f875 101 * @return 0 in case of success, an error code otherwise
Davidroid 0:f6dd8f22f875 102 */
Davidroid 0:f6dd8f22f875 103 virtual int Get_G_FS(float *pfData) = 0;
Davidroid 0:f6dd8f22f875 104
Davidroid 0:f6dd8f22f875 105 /**
Davidroid 0:f6dd8f22f875 106 * @brief Set gyroscope's full scale value
Davidroid 0:f6dd8f22f875 107 * i.e.\ min/max measurable value
Davidroid 0:f6dd8f22f875 108 * @param[in] fs New full scale value for gyroscope in [dps]
Davidroid 0:f6dd8f22f875 109 * @return 0 in case of success, an error code otherwise
Davidroid 0:f6dd8f22f875 110 */
Davidroid 0:f6dd8f22f875 111 virtual int Set_G_FS(float fs) = 0;
Davidroid 0:f6dd8f22f875 112 };
Davidroid 0:f6dd8f22f875 113
Davidroid 0:f6dd8f22f875 114 #endif /* __GYRO_SENSOR_CLASS_H */