Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

115 lines
2.6 KiB

  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. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. #include <stdint.h>
  30. #include "utilities.h"
  31. /*!
  32. * MAG3110 I2C address
  33. */
  34. #define MAG3110_I2C_ADDRESS 0x0E
  35. /*!
  36. * MAG3110 Registers
  37. */
  38. #define MAG3110_ID 0x07
  39. /*!
  40. * \brief Initializes the device
  41. *
  42. * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
  43. */
  44. LmnStatus_t MAG3110Init( void );
  45. /*!
  46. * \brief Resets the device
  47. *
  48. * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
  49. */
  50. LmnStatus_t MAG3110Reset( void );
  51. /*!
  52. * \brief Writes a byte at specified address in the device
  53. *
  54. * \param [IN]: addr
  55. * \param [IN]: data
  56. * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
  57. */
  58. LmnStatus_t MAG3110Write( uint8_t addr, uint8_t data );
  59. /*!
  60. * \brief Writes a buffer at specified address in the device
  61. *
  62. * \param [IN]: addr
  63. * \param [IN]: data
  64. * \param [IN]: size
  65. * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
  66. */
  67. LmnStatus_t MAG3110WriteBuffer( uint8_t addr, uint8_t *data, uint8_t size );
  68. /*!
  69. * \brief Reads a byte at specified address in the device
  70. *
  71. * \param [IN]: addr
  72. * \param [OUT]: data
  73. * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
  74. */
  75. LmnStatus_t MAG3110Read( uint8_t addr, uint8_t *data );
  76. /*!
  77. * \brief Reads a buffer at specified address in the device
  78. *
  79. * \param [IN]: addr
  80. * \param [OUT]: data
  81. * \param [IN]: size
  82. * \retval status [LMN_STATUS_OK, LMN_STATUS_ERROR]
  83. */
  84. LmnStatus_t MAG3110ReadBuffer( uint8_t addr, uint8_t *data, uint8_t size );
  85. /*!
  86. * \brief Sets the I2C device slave address
  87. *
  88. * \param [IN]: addr
  89. */
  90. void MAG3110SetDeviceAddr( uint8_t addr );
  91. /*!
  92. * \brief Gets the I2C device slave address
  93. *
  94. * \retval: addr Current device slave address
  95. */
  96. uint8_t MAG3110GetDeviceAddr( void );
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif // __MAG3110_H__