aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/lib
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-02-05 10:27:13 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-02-05 10:27:13 +0000
commit46133587396a2c6c47f09bbcdd229ae10090f5de (patch)
tree86882b2cbfe8b557dc68cfe5d36330a63042f35d /os/hal/lib
parent4af47b5889971271efceea9391b87b37ca2a6a71 (diff)
downloadChibiOS-46133587396a2c6c47f09bbcdd229ae10090f5de.tar.gz
ChibiOS-46133587396a2c6c47f09bbcdd229ae10090f5de.tar.bz2
ChibiOS-46133587396a2c6c47f09bbcdd229ae10090f5de.zip
Added instance getter macros (Fixing Bug #915).
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11438 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/lib')
-rw-r--r--os/hal/lib/peripherals/sensors/hal_accelerometer.h7
-rw-r--r--os/hal/lib/peripherals/sensors/hal_barometer.h7
-rw-r--r--os/hal/lib/peripherals/sensors/hal_compass.h7
-rw-r--r--os/hal/lib/peripherals/sensors/hal_gyroscope.h7
-rw-r--r--os/hal/lib/peripherals/sensors/hal_hygrometer.h7
-rw-r--r--os/hal/lib/peripherals/sensors/hal_sensors.h7
-rw-r--r--os/hal/lib/peripherals/sensors/hal_thermometer.h7
7 files changed, 49 insertions, 0 deletions
diff --git a/os/hal/lib/peripherals/sensors/hal_accelerometer.h b/os/hal/lib/peripherals/sensors/hal_accelerometer.h
index 31e12637e..91bc6fd0a 100644
--- a/os/hal/lib/peripherals/sensors/hal_accelerometer.h
+++ b/os/hal/lib/peripherals/sensors/hal_accelerometer.h
@@ -95,6 +95,13 @@ typedef struct {
* @{
*/
/**
+ * @brief Instance getter.
+ * @details This special method is used to get the instance of this class
+ * object from a derived class.
+ */
+#define getBaseAccelerometer(ip) ((BaseAccelerometer *)&(ip)->vmt_accelerometer)
+
+/**
* @brief Accelerometer get axes number.
*
* @param[in] ip pointer to a @p BaseAccelerometer class.
diff --git a/os/hal/lib/peripherals/sensors/hal_barometer.h b/os/hal/lib/peripherals/sensors/hal_barometer.h
index 079d569ac..1ab4552cb 100644
--- a/os/hal/lib/peripherals/sensors/hal_barometer.h
+++ b/os/hal/lib/peripherals/sensors/hal_barometer.h
@@ -95,6 +95,13 @@ typedef struct {
* @{
*/
/**
+ * @brief Instance getter.
+ * @details This special method is used to get the instance of this class
+ * object from a derived class.
+ */
+#define getBaseBarometer(ip) ((BaseBarometer *)&(ip)->vmt_barometer)
+
+/**
* @brief Barometer get channels number.
*
* @param[in] ip pointer to a @p BaseBarometer class.
diff --git a/os/hal/lib/peripherals/sensors/hal_compass.h b/os/hal/lib/peripherals/sensors/hal_compass.h
index 34473e04a..83ab8b2ab 100644
--- a/os/hal/lib/peripherals/sensors/hal_compass.h
+++ b/os/hal/lib/peripherals/sensors/hal_compass.h
@@ -95,6 +95,13 @@ typedef struct {
* @{
*/
/**
+ * @brief Instance getter.
+ * @details This special method is used to get the instance of this class
+ * object from a derived class.
+ */
+#define getBaseCompass(ip) ((BaseCompass *)&(ip)->vmt_compass)
+
+/**
* @brief Compass get axes number.
*
* @param[in] ip pointer to a @p BaseCompass class.
diff --git a/os/hal/lib/peripherals/sensors/hal_gyroscope.h b/os/hal/lib/peripherals/sensors/hal_gyroscope.h
index 00786607e..47b3708c8 100644
--- a/os/hal/lib/peripherals/sensors/hal_gyroscope.h
+++ b/os/hal/lib/peripherals/sensors/hal_gyroscope.h
@@ -98,6 +98,13 @@ typedef struct {
* @{
*/
/**
+ * @brief Instance getter.
+ * @details This special method is used to get the instance of this class
+ * object from a derived class.
+ */
+#define getBaseGyroscope(ip) ((BaseGyroscope *)&(ip)->vmt_gyroscope)
+
+/**
* @brief Gyroscope get axes number.
*
* @param[in] ip pointer to a @p BaseGyroscope class.
diff --git a/os/hal/lib/peripherals/sensors/hal_hygrometer.h b/os/hal/lib/peripherals/sensors/hal_hygrometer.h
index 6cf5eef21..3feace0bc 100644
--- a/os/hal/lib/peripherals/sensors/hal_hygrometer.h
+++ b/os/hal/lib/peripherals/sensors/hal_hygrometer.h
@@ -95,6 +95,13 @@ typedef struct {
* @{
*/
/**
+ * @brief Instance getter.
+ * @details This special method is used to get the instance of this class
+ * object from a derived class.
+ */
+#define getBaseHygrometer(ip) ((BaseHygrometer *)&(ip)->vmt_hygrometer)
+
+/**
* @brief Hygrometer get channels number.
*
* @param[in] ip pointer to a @p BaseHygrometer class.
diff --git a/os/hal/lib/peripherals/sensors/hal_sensors.h b/os/hal/lib/peripherals/sensors/hal_sensors.h
index 6a97ddaed..0a09a3b21 100644
--- a/os/hal/lib/peripherals/sensors/hal_sensors.h
+++ b/os/hal/lib/peripherals/sensors/hal_sensors.h
@@ -92,6 +92,13 @@ typedef struct {
* @{
*/
/**
+ * @brief Instance getter.
+ * @details This special method is used to get the instance of this class
+ * object from a derived class.
+ */
+#define getBaseSensor(ip) ((BaseSensor *)&(ip)->vmt_sensor)
+
+/**
* @brief Sensors get channels number.
*
* @param[in] ip pointer to a @p BaseSensor or derived class.
diff --git a/os/hal/lib/peripherals/sensors/hal_thermometer.h b/os/hal/lib/peripherals/sensors/hal_thermometer.h
index 4620cbd0a..2094d9c0a 100644
--- a/os/hal/lib/peripherals/sensors/hal_thermometer.h
+++ b/os/hal/lib/peripherals/sensors/hal_thermometer.h
@@ -95,6 +95,13 @@ typedef struct {
* @{
*/
/**
+ * @brief Instance getter.
+ * @details This special method is used to get the instance of this class
+ * object from a derived class.
+ */
+#define getBaseThermometer(ip) ((BaseThermometer *)&(ip)->vmt_thermometer)
+
+/**
* @brief Thermometer get channels number.
*
* @param[in] ip pointer to a @p BaseThermometer class.