1 /*!
2  * \file      mag3110.h
3  *
4  * \brief     MAG3110 Magnetometer driver implementation
5  *
6  * \copyright Revised BSD License, see section \ref LICENSE.
7  *
8  * \code
9  *                ______                              _
10  *               / _____)             _              | |
11  *              ( (____  _____ ____ _| |_ _____  ____| |__
12  *               \____ \| ___ |    (_   _) ___ |/ ___)  _ \
13  *               _____) ) ____| | | || |_| ____( (___| | | |
14  *              (______/|_____)_|_|_| \__)_____)\____)_| |_|
15  *              (C)2013-2017 Semtech
16  *
17  * \endcode
18  *
19  * \author    Miguel Luis ( Semtech )
20  *
21  * \author    Gregory Cristian ( Semtech )
22  */
23 #ifndef __MAG3110_H__
24 #define __MAG3110_H__
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
31 #include <stdint.h>
32 #include "utilities.h"
33 
34 /*!
35  * MAG3110 I2C address
36  */
37 #define MAG3110_I2C_ADDRESS                             0x0E
38 
39 /*!
40  * MAG3110 Registers
41  */
42 #define MAG3110_ID                                      0x07
43 
44 /*!
45  * \brief Initializes the device
46  *
47  * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
48  */
49 LmnStatus_t MAG3110Init( void );
50 
51 /*!
52  * \brief Resets the device
53  *
54  * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
55  */
56 LmnStatus_t MAG3110Reset( void );
57 
58 /*!
59  * \brief Writes a byte at specified address in the device
60  *
61  * \param [IN]: addr
62  * \param [IN]: data
63  * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
64  */
65 LmnStatus_t MAG3110Write( uint8_t addr, uint8_t data );
66 
67 /*!
68  * \brief Writes a buffer at specified address in the device
69  *
70  * \param [IN]: addr
71  * \param [IN]: data
72  * \param [IN]: size
73  * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
74  */
75 LmnStatus_t MAG3110WriteBuffer( uint8_t addr, uint8_t *data, uint8_t size );
76 
77 /*!
78  * \brief Reads a byte at specified address in the device
79  *
80  * \param [IN]: addr
81  * \param [OUT]: data
82  * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
83  */
84 LmnStatus_t MAG3110Read( uint8_t addr, uint8_t *data );
85 
86 /*!
87  * \brief Reads a buffer at specified address in the device
88  *
89  * \param [IN]: addr
90  * \param [OUT]: data
91  * \param [IN]: size
92  * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
93  */
94 LmnStatus_t MAG3110ReadBuffer( uint8_t addr, uint8_t *data, uint8_t size );
95 
96 /*!
97  * \brief Sets the I2C device slave address
98  *
99  * \param [IN]: addr
100  */
101 void MAG3110SetDeviceAddr( uint8_t addr );
102 
103 /*!
104  * \brief Gets the I2C device slave address
105  *
106  * \retval: addr Current device slave address
107  */
108 uint8_t MAG3110GetDeviceAddr( void );
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif // __MAG3110_H__
115