Ultra low-power, high performance 3-axis magnetometer.

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Dependents:   HelloWorld_ST_Sensors MOTENV_Mbed mbed-os-mqtt-client DISCO-IOT01_HomeEnv ... more

Committer:
mapellil
Date:
Wed Oct 18 11:14:26 2017 +0200
Revision:
6:308889c4d074
Parent:
1:d85092ab306e
Fixed sensor initialization

Who changed what in which revision?

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