Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_COMMON X_NUCLEO_IKS01A1 ST_INTERFACES
Diff: Components/Common/MagneticSensor.h
- Revision:
- 28:501726e9220d
- Parent:
- 24:92cc9c6e4b2b
- Child:
- 30:7b36639ee80a
--- a/Components/Common/MagneticSensor.h Wed Jun 03 15:12:38 2015 +0200
+++ b/Components/Common/MagneticSensor.h Thu Jun 04 11:51:44 2015 +0200
@@ -41,7 +41,7 @@
#define __MAGNETIC_SENSOR_CLASS_H
/* Includes ------------------------------------------------------------------*/
-#include "mbed.h"
+#include <stdint.h>
/* Classes ------------------------------------------------------------------*/
/** An abstract class for a magnetometer
@@ -49,14 +49,43 @@
class MagneticSensor
{
public:
+ /**
+ * @brief Initialization of magnetometer
+ * @param[out] Pointer to device specific initalization structure
+ * @retval 0 in case of success, an error code otherwise
+ */
virtual int Init(void*) = 0;
+
+ /**
+ * @brief Get ID of magnetometer
+ * @param[out] Pointer to where to store the ID to
+ * @retval 0 in case of success, an error code otherwise
+ */
virtual int ReadID(uint8_t*) = 0;
+ /**
+ * @brief Get current magnetometer magnetic X/Y/Z-axes values
+ * in standard data units [mgauss]
+ * @param[out] Pointer to where to store magnetic values to.
+ * Pointer must point to an array of (at least) three elements, where:
+ * ptr[0] corresponds to X-axis
+ * ptr[1] corresponds to Y-axis
+ * ptr[2] corresponds to Z-axis
+ * @retval 0 in case of success, an error code otherwise
+ */
virtual int Get_M_Axes(int32_t*) = 0;
- virtual int Get_M_AxesRaw(int16_t *) = 0;
- protected:
- MagneticSensor(void) {};
+ /**
+ * @brief Get current magnetometer raw data X/Y/Z-axes values
+ * in device sepcific LSB units
+ * @param[out] Pointer to where to store magnetometer raw data to.
+ * Pointer must point to an array of (at least) three elements, where:
+ * ptr[0] corresponds to X-axis
+ * ptr[1] corresponds to Y-axis
+ * ptr[2] corresponds to Z-axis
+ * @retval 0 in case of success, an error code otherwise
+ */
+ virtual int Get_M_AxesRaw(int16_t *) = 0;
};
#endif /* __MAGNETIC_SENSOR_CLASS_H */