diff options
author | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-03-16 18:16:30 +0000 |
---|---|---|
committer | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-03-16 18:16:30 +0000 |
commit | 49dac4f825c0d8a29d8641688e6ee08a9137dd74 (patch) | |
tree | e397156ce4ffc50091ca5103d8f81898f1e94bbb /os/hal/lib/peripherals/sensors | |
parent | 13375b4faaeb666b0684161d90426a62efaf0829 (diff) | |
download | ChibiOS-49dac4f825c0d8a29d8641688e6ee08a9137dd74.tar.gz ChibiOS-49dac4f825c0d8a29d8641688e6ee08a9137dd74.tar.bz2 ChibiOS-49dac4f825c0d8a29d8641688e6ee08a9137dd74.zip |
Improved BaseGyroscope interface. Updated L3GD20.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9128 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/lib/peripherals/sensors')
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_gyroscope.h | 102 |
1 files changed, 95 insertions, 7 deletions
diff --git a/os/hal/lib/peripherals/sensors/hal_gyroscope.h b/os/hal/lib/peripherals/sensors/hal_gyroscope.h index e61d06b0f..5a2db78b6 100644 --- a/os/hal/lib/peripherals/sensors/hal_gyroscope.h +++ b/os/hal/lib/peripherals/sensors/hal_gyroscope.h @@ -49,9 +49,20 @@ #define _base_gyroscope_methods_alone \
/* Invoke the sample bias procedure.*/ \
msg_t (*sample_bias)(void *instance); \
+ /* Invoke the set bias procedure.*/ \
+ msg_t (*set_bias)(void *instance, int32_t biases[]); \
/* Remove bias stored data.*/ \
- msg_t (*reset_bias)(void *instance);
-
+ 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); \
+ /* Enable temperature drift effect compensation.*/ \
+ msg_t (*enable_temperature_compensation)(void *instance); \
+ /* Disable temperature drift effect compensation.*/ \
+ msg_t (*disable_temperature_compensation)(void *instance);
+
+
/**
* @brief BaseGyroscope specific methods with inherited ones.
*/
@@ -134,8 +145,8 @@ typedef struct { /**
* @brief Gyroscope bias sampling procedure.
* @note During this procedure gyroscope must be kept hold in the rest
- * position. Sampled bias will be automatically removed after calling
- * this procedure.
+ * position. Sampled bias will be automatically removed after
+ * calling this procedure.
*
* @param[in] ip pointer to a @p BaseGyroscope class.
*
@@ -145,11 +156,28 @@ typedef struct { *
* @api
*/
-#define gyroscopeSampleBias(ip) \
+#define gyroscopeSampleBias(ip) \
(ip)->vmt_basegyroscope->sample_bias(ip)
/**
- * @brief Reset bias data restoring it to zero.
+ * @brief Updates gyroscope bias data from received buffer.
+ * @note The bias buffer must have the same length of the
+ * the gyroscope axes number.
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope 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 gyroscopeSetBias(ip, bp) \
+ (ip)->vmt_basegyroscope->set_bias(ip, bp)
+
+/**
+ * @brief Reset gyroscope bias data restoring it to zero.
*
* @param[in] ip pointer to a @p BaseGyroscope class.
*
@@ -159,8 +187,68 @@ typedef struct { *
* @api
*/
-#define gyroscopeResetCalibration(ip) \
+#define gyroscopeResetBias(ip) \
(ip)->vmt_basegyroscope->reset_bias(ip)
+
+/**
+ * @brief Updates gyroscope sensitivity data from received buffer.
+ * @note The sensitivity buffer must have the same length of the
+ * the gyroscope axes number.
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope 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 gyroscopeSetSensitivity(ip, sp) \
+ (ip)->vmt_basegyroscope->set_sensitivity(ip, sp)
+
+/**
+ * @brief Reset gyroscope sensitivity data restoring it to its typical
+ * value.
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope class.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
+ */
+#define gyroscopeResetSensitivity(ip) \
+ (ip)->vmt_basegyroscope->reset_sensitivity(ip)
+
+/**
+ * @brief Enables data compensation removing temperature drift.
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope class.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
+ */
+#define gyroscopeEnableTempCompensation(ip) \
+ (ip)->vmt_basegyroscope->enable_temperature_compensation(ip)
+
+/**
+ * @brief Disable data compensation.
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope class.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
+ */
+#define gyroscopeDisableTempCompensation(ip) \
+ (ip)->vmt_basegyroscope->disable_temperature_compensation(ip)
/** @} */
/*===========================================================================*/
|