diff options
author | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-04-29 22:57:04 +0000 |
---|---|---|
committer | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-04-29 22:57:04 +0000 |
commit | 8a15207235a9e59c1d1f0a64810ab9861de15b06 (patch) | |
tree | 813f18e310d6b5c278900d6661ed5f18f9714e14 /os/hal/lib | |
parent | 37ff02bca728921ab490a6409c4097e580f9567b (diff) | |
download | ChibiOS-8a15207235a9e59c1d1f0a64810ab9861de15b06.tar.gz ChibiOS-8a15207235a9e59c1d1f0a64810ab9861de15b06.tar.bz2 ChibiOS-8a15207235a9e59c1d1f0a64810ab9861de15b06.zip |
ChibiOS/HAL: improved hal_compass.h,
ChibiOS/EX: ultimated lis3mdl support
Added STM32L4xx/I2C-LIS3MLD demo
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9382 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/lib')
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_compass.h | 75 |
1 files changed, 74 insertions, 1 deletions
diff --git a/os/hal/lib/peripherals/sensors/hal_compass.h b/os/hal/lib/peripherals/sensors/hal_compass.h index 041c82bdd..83efc9852 100644 --- a/os/hal/lib/peripherals/sensors/hal_compass.h +++ b/os/hal/lib/peripherals/sensors/hal_compass.h @@ -46,7 +46,16 @@ /**
* @brief BaseCompass specific methods.
*/
-#define _base_compass_methods_alone
+#define _base_compass_methods_alone \
+ /* Invoke the set bias procedure.*/ \
+ msg_t (*set_bias)(void *instance, int32_t biases[]); \
+ /* Remove bias stored data.*/ \
+ msg_t (*reset_bias)(void *instance); \
+ /* Invoke the set sensitivity procedure.*/ \
+ msg_t (*set_sensitivity)(void *instance, float sensitivities[]); \
+ /* Restore sensitivity stored data to default.*/ \
+ msg_t (*reset_sensitivity)(void *instance);
+
/**
* @brief BaseCompass specific methods with inherited ones.
@@ -125,6 +134,70 @@ typedef struct { */
#define compassReadCooked(ip, dp) \
(ip)->vmt_basecompass->read_cooked(ip, dp)
+
+/**
+ * @brief Updates compass bias data from received buffer.
+ * @note The bias buffer must have the same length of the
+ * the compass axes number. Bias must be computed on
+ * raw data and is a signed integer.
+ *
+ * @param[in] ip pointer to a @p BaseCompass class.
+ * @param[in] bp pointer to a buffer of bias values.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
+ */
+#define compassSetBias(ip, bp) \
+ (ip)->vmt_basecompass->set_bias(ip, bp)
+
+/**
+ * @brief Reset compass bias data restoring it to zero.
+ *
+ * @param[in] ip pointer to a @p BaseCompass class.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
+ */
+#define compassResetBias(ip) \
+ (ip)->vmt_basecompass->reset_bias(ip)
+
+/**
+ * @brief Updates compass sensitivity data from received buffer.
+ * @note The sensitivity buffer must have the same length of the
+ * the compass axes number.
+ *
+ * @param[in] ip pointer to a @p BaseCompass class.
+ * @param[in] sp pointer to a buffer of sensitivity values.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
+ */
+#define compassSetSensitivity(ip, sp) \
+ (ip)->vmt_basecompass->set_sensitivity(ip, sp)
+
+/**
+ * @brief Reset compass sensitivity data restoring it to its typical
+ * value.
+ *
+ * @param[in] ip pointer to a @p BaseCompass class.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
+ */
+#define compassResetSensitivity(ip) \
+ (ip)->vmt_basecompass->reset_sensitivity(ip)
/** @} */
/*===========================================================================*/
|