Peter Ferland / mDot_X_NUCLEO_IKS01A1

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of X_NUCLEO_IKS01A1 by ST

Committer:
Wolfgang Betz
Date:
Thu Jun 04 13:46:35 2015 +0200
Revision:
30:7b36639ee80a
Parent:
28:501726e9220d
Child:
32:2bb1d4ced32b
Refine abstract class documentation regarding parameter names

Who changed what in which revision?

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