aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/lib/peripherals/include/hal_gyroscope.h
diff options
context:
space:
mode:
authorroccomarco <roccomarco@35acf78f-673a-0410-8e92-d51de3d6d3f4>2016-03-05 19:57:15 +0000
committerroccomarco <roccomarco@35acf78f-673a-0410-8e92-d51de3d6d3f4>2016-03-05 19:57:15 +0000
commitb20d445f4af15433e18b9c4507ceb00d297fbd66 (patch)
tree6bcacefba9ccebd0f7287ab1185cf2fef8385a2e /os/hal/lib/peripherals/include/hal_gyroscope.h
parent8208bfeeaafcbf4c911baf1fd94d3b6e1a957e99 (diff)
downloadChibiOS-b20d445f4af15433e18b9c4507ceb00d297fbd66.tar.gz
ChibiOS-b20d445f4af15433e18b9c4507ceb00d297fbd66.tar.bz2
ChibiOS-b20d445f4af15433e18b9c4507ceb00d297fbd66.zip
Updated peripheral interface headers
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9027 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/lib/peripherals/include/hal_gyroscope.h')
-rw-r--r--os/hal/lib/peripherals/include/hal_gyroscope.h92
1 files changed, 81 insertions, 11 deletions
diff --git a/os/hal/lib/peripherals/include/hal_gyroscope.h b/os/hal/lib/peripherals/include/hal_gyroscope.h
index c593f8fe6..142832094 100644
--- a/os/hal/lib/peripherals/include/hal_gyroscope.h
+++ b/os/hal/lib/peripherals/include/hal_gyroscope.h
@@ -25,6 +25,8 @@
#ifndef _HAL_GYROSCOPE_H_
#define _HAL_GYROSCOPE_H_
+#include "hal_sensors.h"
+
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
@@ -42,6 +44,16 @@
/*===========================================================================*/
/**
+ * @brief BaseGyroscope specific methods.
+ */
+#define _base_gyroscope_methods \
+ _base_sensor_methods \
+ /* Remove the calibration data.*/ \
+ msg_t (*reset_calibration)(void *instance); \
+ /* Invokes the calibration procedure.*/ \
+ msg_t (*calibrate)(void *instance);
+
+/**
* @brief @p BaseGyroscope virtual methods table.
*/
struct BaseGyroscopeVMT {
@@ -49,6 +61,12 @@ struct BaseGyroscopeVMT {
};
/**
+ * @brief @p BaseGyroscope specific data.
+ */
+#define _base_gyroscope_data \
+ _base_sensor_data
+
+/**
* @brief Base gyroscope class.
* @details This class represents a generic gyroscope.
*/
@@ -63,21 +81,73 @@ typedef struct {
/*===========================================================================*/
/**
- * @brief BaseGyroscope specific methods.
+ * @name Macro Functions (BaseGyroscope)
+ * @{
*/
-#define _base_gyroscope_methods \
- _base_sensor_methods \
- /* Remove the calibration data.*/ \
- msg_t (*reset_calibration)(void); \
- /* Invokes the calibration procedure.*/ \
- msg_t (*calibrate)(void);
+/**
+ * @brief Gyroscope get axes number.
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope class.
+ * @return The number of axes of the BaseSensor
+ *
+ * @api
+ */
+#define gyroscopeGetAxesNumber(ip) sensorGetAxesNumber(ip)
/**
- * @brief @p BaseGyroscope specific data.
- * @note It is empty because @p BaseGyroscope is only an interface
- * without implementation.
+ * @brief Gyroscope read raw data.
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope class.
+ * @param[in] dp pointer to a data array.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
*/
-#define _base_gyroscope_data
+#define gyroscopeReadRaw(ip, dp) sensorReadRaw(ip, dp)
+
+/**
+ * @brief Gyroscope read cooked data.
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope class.
+ * @param[in] dp pointer to a data array.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ *
+ * @api
+ */
+#define gyroscopeReadCooked(ip, dp) sensorReadCooked(ip, dp)
+
+/**
+ * @brief Delete calibration data.
+ *
+ * @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 gyroscopeResetCalibration(ip) ((ip)->vmt->reset_calibration(ip))
+
+/**
+ * @brief Gyroscope calibration procedure.
+ *
+ * @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 gyroscopeCalibrate(ip) ((ip)->vmt->calibrate(ip))
+/** @} */
/*===========================================================================*/
/* External declarations. */