Dependencies: X_NUCLEO_COMMON
Fork of X_NUCLEO_IKS01A1-f2df by
X_NUCLEO_IKS01A1-f255a2c75ecb/Components/Common/magneto.h@1:7f97780b8ad4, 2017-02-09 (annotated)
- Committer:
- Salvatore94
- Date:
- Thu Feb 09 16:40:33 2017 +0000
- Revision:
- 1:7f97780b8ad4
- Parent:
- 0:5a49275457c6
Per peppe;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
antseggs | 0:5a49275457c6 | 1 | /** |
antseggs | 0:5a49275457c6 | 2 | ****************************************************************************** |
antseggs | 0:5a49275457c6 | 3 | * @file magneto.h |
antseggs | 0:5a49275457c6 | 4 | * @author MEMS Application Team |
antseggs | 0:5a49275457c6 | 5 | * @version V1.2.0 |
antseggs | 0:5a49275457c6 | 6 | * @date 28-January-2015 |
antseggs | 0:5a49275457c6 | 7 | * @brief This header file contains the functions prototypes for the |
antseggs | 0:5a49275457c6 | 8 | * magneto driver. |
antseggs | 0:5a49275457c6 | 9 | ****************************************************************************** |
antseggs | 0:5a49275457c6 | 10 | * @attention |
antseggs | 0:5a49275457c6 | 11 | * |
antseggs | 0:5a49275457c6 | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
antseggs | 0:5a49275457c6 | 13 | * |
antseggs | 0:5a49275457c6 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
antseggs | 0:5a49275457c6 | 15 | * are permitted provided that the following conditions are met: |
antseggs | 0:5a49275457c6 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
antseggs | 0:5a49275457c6 | 17 | * this list of conditions and the following disclaimer. |
antseggs | 0:5a49275457c6 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
antseggs | 0:5a49275457c6 | 19 | * this list of conditions and the following disclaimer in the documentation |
antseggs | 0:5a49275457c6 | 20 | * and/or other materials provided with the distribution. |
antseggs | 0:5a49275457c6 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
antseggs | 0:5a49275457c6 | 22 | * may be used to endorse or promote products derived from this software |
antseggs | 0:5a49275457c6 | 23 | * without specific prior written permission. |
antseggs | 0:5a49275457c6 | 24 | * |
antseggs | 0:5a49275457c6 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
antseggs | 0:5a49275457c6 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
antseggs | 0:5a49275457c6 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
antseggs | 0:5a49275457c6 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
antseggs | 0:5a49275457c6 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
antseggs | 0:5a49275457c6 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
antseggs | 0:5a49275457c6 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
antseggs | 0:5a49275457c6 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
antseggs | 0:5a49275457c6 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
antseggs | 0:5a49275457c6 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
antseggs | 0:5a49275457c6 | 35 | * |
antseggs | 0:5a49275457c6 | 36 | ****************************************************************************** |
antseggs | 0:5a49275457c6 | 37 | */ |
antseggs | 0:5a49275457c6 | 38 | |
antseggs | 0:5a49275457c6 | 39 | |
antseggs | 0:5a49275457c6 | 40 | /* Define to prevent recursive inclusion -------------------------------------*/ |
antseggs | 0:5a49275457c6 | 41 | #ifndef __MAGNETO_H |
antseggs | 0:5a49275457c6 | 42 | #define __MAGNETO_H |
antseggs | 0:5a49275457c6 | 43 | |
antseggs | 0:5a49275457c6 | 44 | #ifdef __cplusplus |
antseggs | 0:5a49275457c6 | 45 | extern "C" { |
antseggs | 0:5a49275457c6 | 46 | #endif |
antseggs | 0:5a49275457c6 | 47 | |
antseggs | 0:5a49275457c6 | 48 | /* Includes ------------------------------------------------------------------*/ |
antseggs | 0:5a49275457c6 | 49 | #include <stdint.h> |
antseggs | 0:5a49275457c6 | 50 | |
antseggs | 0:5a49275457c6 | 51 | /** @addtogroup BSP |
antseggs | 0:5a49275457c6 | 52 | * @{ |
antseggs | 0:5a49275457c6 | 53 | */ |
antseggs | 0:5a49275457c6 | 54 | |
antseggs | 0:5a49275457c6 | 55 | /** @addtogroup Components |
antseggs | 0:5a49275457c6 | 56 | * @{ |
antseggs | 0:5a49275457c6 | 57 | */ |
antseggs | 0:5a49275457c6 | 58 | |
antseggs | 0:5a49275457c6 | 59 | /** @addtogroup MAGNETO |
antseggs | 0:5a49275457c6 | 60 | * @{ |
antseggs | 0:5a49275457c6 | 61 | */ |
antseggs | 0:5a49275457c6 | 62 | |
antseggs | 0:5a49275457c6 | 63 | /** @defgroup MAGNETO_Exported_Types |
antseggs | 0:5a49275457c6 | 64 | * @{ |
antseggs | 0:5a49275457c6 | 65 | */ |
antseggs | 0:5a49275457c6 | 66 | |
antseggs | 0:5a49275457c6 | 67 | /** |
antseggs | 0:5a49275457c6 | 68 | * @brief MAGNETO init structure definition |
antseggs | 0:5a49275457c6 | 69 | */ |
antseggs | 0:5a49275457c6 | 70 | typedef struct |
antseggs | 0:5a49275457c6 | 71 | { |
antseggs | 0:5a49275457c6 | 72 | uint8_t M_OutputDataRate; |
antseggs | 0:5a49275457c6 | 73 | uint8_t M_OperatingMode; |
antseggs | 0:5a49275457c6 | 74 | uint8_t M_FullScale; |
antseggs | 0:5a49275457c6 | 75 | uint8_t M_XYOperativeMode; |
antseggs | 0:5a49275457c6 | 76 | } MAGNETO_InitTypeDef; |
antseggs | 0:5a49275457c6 | 77 | |
antseggs | 0:5a49275457c6 | 78 | /** |
antseggs | 0:5a49275457c6 | 79 | * @brief MAGNETO status enumerator definition |
antseggs | 0:5a49275457c6 | 80 | */ |
antseggs | 0:5a49275457c6 | 81 | typedef enum |
antseggs | 0:5a49275457c6 | 82 | { |
antseggs | 0:5a49275457c6 | 83 | MAGNETO_OK = 0, |
antseggs | 0:5a49275457c6 | 84 | MAGNETO_ERROR = 1, |
antseggs | 0:5a49275457c6 | 85 | MAGNETO_TIMEOUT = 2, |
antseggs | 0:5a49275457c6 | 86 | MAGNETO_NOT_IMPLEMENTED = 3 |
antseggs | 0:5a49275457c6 | 87 | } MAGNETO_StatusTypeDef; |
antseggs | 0:5a49275457c6 | 88 | |
antseggs | 0:5a49275457c6 | 89 | /** |
antseggs | 0:5a49275457c6 | 90 | * @brief MAGNETO component id enumerator definition |
antseggs | 0:5a49275457c6 | 91 | */ |
antseggs | 0:5a49275457c6 | 92 | typedef enum |
antseggs | 0:5a49275457c6 | 93 | { |
antseggs | 0:5a49275457c6 | 94 | MAGNETO_NONE_COMPONENT = 0, |
antseggs | 0:5a49275457c6 | 95 | MAGNETO_LIS3MDL_COMPONENT = 1 |
antseggs | 0:5a49275457c6 | 96 | } MAGNETO_ComponentTypeDef; |
antseggs | 0:5a49275457c6 | 97 | |
antseggs | 0:5a49275457c6 | 98 | /** |
antseggs | 0:5a49275457c6 | 99 | * @brief MAGNETO driver extended structure definition |
antseggs | 0:5a49275457c6 | 100 | */ |
antseggs | 0:5a49275457c6 | 101 | typedef struct |
antseggs | 0:5a49275457c6 | 102 | { |
antseggs | 0:5a49275457c6 | 103 | MAGNETO_ComponentTypeDef |
antseggs | 0:5a49275457c6 | 104 | id; /* This id must be unique for each component belonging to this class that wants to extend common class */ |
antseggs | 0:5a49275457c6 | 105 | void *pData; /* This pointer is specific for each component */ |
antseggs | 0:5a49275457c6 | 106 | } MAGNETO_DrvExtTypeDef; |
antseggs | 0:5a49275457c6 | 107 | |
antseggs | 0:5a49275457c6 | 108 | /** |
antseggs | 0:5a49275457c6 | 109 | * @brief MAGNETO driver structure definition |
antseggs | 0:5a49275457c6 | 110 | */ |
antseggs | 0:5a49275457c6 | 111 | typedef struct |
antseggs | 0:5a49275457c6 | 112 | { |
antseggs | 0:5a49275457c6 | 113 | MAGNETO_StatusTypeDef (*Init)(MAGNETO_InitTypeDef *); |
antseggs | 0:5a49275457c6 | 114 | MAGNETO_StatusTypeDef (*Read_M_ID)(uint8_t *); |
antseggs | 0:5a49275457c6 | 115 | MAGNETO_StatusTypeDef (*Get_M_Axes)(int32_t *); |
antseggs | 0:5a49275457c6 | 116 | MAGNETO_StatusTypeDef (*Get_M_AxesRaw)(int16_t *); |
antseggs | 0:5a49275457c6 | 117 | MAGNETO_DrvExtTypeDef *extData; |
antseggs | 0:5a49275457c6 | 118 | } MAGNETO_DrvTypeDef; |
antseggs | 0:5a49275457c6 | 119 | |
antseggs | 0:5a49275457c6 | 120 | /** |
antseggs | 0:5a49275457c6 | 121 | * @} |
antseggs | 0:5a49275457c6 | 122 | */ |
antseggs | 0:5a49275457c6 | 123 | |
antseggs | 0:5a49275457c6 | 124 | /** |
antseggs | 0:5a49275457c6 | 125 | * @} |
antseggs | 0:5a49275457c6 | 126 | */ |
antseggs | 0:5a49275457c6 | 127 | |
antseggs | 0:5a49275457c6 | 128 | /** |
antseggs | 0:5a49275457c6 | 129 | * @} |
antseggs | 0:5a49275457c6 | 130 | */ |
antseggs | 0:5a49275457c6 | 131 | |
antseggs | 0:5a49275457c6 | 132 | /** |
antseggs | 0:5a49275457c6 | 133 | * @} |
antseggs | 0:5a49275457c6 | 134 | */ |
antseggs | 0:5a49275457c6 | 135 | |
antseggs | 0:5a49275457c6 | 136 | #ifdef __cplusplus |
antseggs | 0:5a49275457c6 | 137 | } |
antseggs | 0:5a49275457c6 | 138 | #endif |
antseggs | 0:5a49275457c6 | 139 | |
antseggs | 0:5a49275457c6 | 140 | #endif /* __MAGNETO_H */ |
antseggs | 0:5a49275457c6 | 141 | |
antseggs | 0:5a49275457c6 | 142 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |