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.
Fork of ReferredCoursework2016 by
Revision 20:c20c8bd5be6b, committed 2015-05-29
- Comitter:
- Wolfgang Betz
- Date:
- Fri May 29 16:29:31 2015 +0200
- Parent:
- 18:1cb4ae9d83e7
- Child:
- 21:34842228d3f9
- Child:
- 23:9da7be2a27c1
- Commit message:
- Use multiple inheritance for combianed sensor components
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/GyroSensor.h Fri May 29 16:29:31 2015 +0200
@@ -0,0 +1,62 @@
+/**
+ ******************************************************************************
+ * @file GyroSensor.h
+ * @author AST / EST
+ * @version V0.0.1
+ * @date 13-April-2015
+ * @brief This file contains the abstract class describing in general
+ * the interfaces of a gyroscope
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+#ifndef __GYRO_SENSOR_CLASS_H
+#define __GYRO_SENSOR_CLASS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "mbed.h"
+
+/* Classes ------------------------------------------------------------------*/
+/** An abstract class for a Gyroscope
+ */
+class GyroSensor
+{
+ public:
+ virtual int Init(void*) = 0;
+ virtual int ReadID(uint8_t*) = 0;
+
+ virtual int Get_G_Axes(int32_t*) = 0;
+ virtual int Get_G_Sensitivity(float*) = 0;
+
+ protected:
+ GyroSensor(void) {};
+};
+
+#endif /* __GYRO_SENSOR_CLASS_H */
--- a/Components/Common/HumTemp.h Fri May 29 14:23:22 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/**
- ******************************************************************************
- * @file HumTemp.h
- * @author AST / EST
- * @version V0.0.1
- * @date 13-April-2015
- * @brief This file contains the abstract class describing in general
- * the interfaces of a humidity and temperature sensor
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-/* Define to prevent from recursive inclusion --------------------------------*/
-#ifndef __HUM_TEMP_CLASS_H
-#define __HUM_TEMP_CLASS_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "mbed.h"
-
-/* Classes ------------------------------------------------------------------*/
-/** An abstract class for HumTemp components
- */
-class HumTemp
-{
- public:
- virtual int Init(void*) = 0;
-
- virtual int PowerOFF(void) = 0;
- virtual int ReadID(uint8_t*) = 0;
- virtual int Reset(void) = 0;
-
- virtual void ConfigIT(uint16_t) = 0;
- virtual void EnableIT(uint8_t) = 0;
- virtual void DisableIT(uint8_t) = 0;
- virtual uint8_t ITStatus(uint16_t, uint16_t) = 0;
- virtual void ClearIT(uint16_t, uint16_t) = 0;
-
- virtual int GetHumidity(float*) = 0;
- virtual int GetTemperature(float*) = 0;
-
- virtual void AttachIT(void (*fptr)(void)) = 0;
-
- protected:
- HumTemp(void) {};
-};
-
-#endif /* __HUM_TEMP_CLASS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/HumiditySensor.h Fri May 29 16:29:31 2015 +0200
@@ -0,0 +1,72 @@
+/**
+ ******************************************************************************
+ * @file HumiditySensor.h
+ * @author AST / EST
+ * @version V0.0.1
+ * @date 13-April-2015
+ * @brief This file contains the abstract class describing in general
+ * the interfaces of a humidity sensor
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+#ifndef __HUMIDITY_SENSOR_CLASS_H
+#define __HUMIDITY_SENSOR_CLASS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "mbed.h"
+
+/* Classes ------------------------------------------------------------------*/
+/** An abstract class for Humidity sensors
+ */
+class HumiditySensor
+{
+ public:
+ virtual int Init(void*) = 0;
+
+ virtual int PowerOff(void) = 0;
+ virtual int ReadID(uint8_t*) = 0;
+ virtual int Reset(void) = 0;
+
+ virtual void ConfigIT(uint16_t) = 0;
+ virtual void EnableIT(uint8_t) = 0;
+ virtual void DisableIT(uint8_t) = 0;
+ virtual uint8_t ITStatus(uint16_t, uint16_t) = 0;
+ virtual void ClearIT(uint16_t, uint16_t) = 0;
+
+ virtual int GetHumidity(float*) = 0;
+
+ virtual void AttachIT(void (*fptr)(void)) = 0;
+
+ protected:
+ HumiditySensor(void) {};
+};
+
+#endif /* __HUMIDITY_SENSOR_CLASS_H */
--- a/Components/Common/Imu6Axes.h Fri May 29 14:23:22 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/**
- ******************************************************************************
- * @file Imu6Axes.h
- * @author AST / EST
- * @version V0.0.1
- * @date 13-April-2015
- * @brief This file contains the abstract class describing in general
- * the interfaces of a 6-axes accelerometer and gyroscope
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-/* Define to prevent from recursive inclusion --------------------------------*/
-#ifndef __IMU_6AXES_CLASS_H
-#define __IMU_6AXES_CLASS_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "mbed.h"
-
-/* Classes ------------------------------------------------------------------*/
-/** An abstract class for Imu6Axes components
- */
-class Imu6Axes
-{
- public:
- virtual int Init(void*) = 0;
- virtual int Read_XG_ID(uint8_t*) = 0;
- virtual int Get_X_Axes(int32_t*) = 0;
- virtual int Get_G_Axes(int32_t*) = 0;
- virtual int Get_X_Sensitivity(float*) = 0;
- virtual int Get_G_Sensitivity(float*) = 0;
-
- protected:
- Imu6Axes(void) {};
-};
-
-#endif /* __IMU_6AXES_CLASS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/MagneticSensor.h Fri May 29 16:29:31 2015 +0200
@@ -0,0 +1,61 @@
+/**
+ ******************************************************************************
+ * @file MagneticSensor.h
+ * @author AST / EST
+ * @version V0.0.1
+ * @date 13-April-2015
+ * @brief This file contains the abstract class describing in general
+ * the interfaces of a magnetometer
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+#ifndef __MAGNETIC_SENSOR_CLASS_H
+#define __MAGNETIC_SENSOR_CLASS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "mbed.h"
+
+/* Classes ------------------------------------------------------------------*/
+/** An abstract class for a magnetometer
+ */
+class MagneticSensor
+{
+ public:
+ virtual int Init(void*) = 0;
+ virtual int ReadID(uint8_t*) = 0;
+
+ virtual int Get_M_Axes(int32_t*) = 0;
+
+ protected:
+ MagneticSensor(void) {};
+};
+
+#endif /* __MAGNETIC_SENSOR_CLASS_H */
--- a/Components/Common/Magneto.h Fri May 29 14:23:22 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/**
- ******************************************************************************
- * @file Magneto.h
- * @author AST / EST
- * @version V0.0.1
- * @date 13-April-2015
- * @brief This file contains the abstract class describing in general
- * the interfaces of a magnetometer
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-/* Define to prevent from recursive inclusion --------------------------------*/
-#ifndef __MAGNETO_CLASS_H
-#define __MAGNETO_CLASS_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "mbed.h"
-
-/* Classes ------------------------------------------------------------------*/
-/** An abstract class for Magneto components
- */
-class Magneto
-{
- public:
- virtual int Init(void*) = 0;
- virtual int Read_M_ID(uint8_t*) = 0;
- virtual int Get_M_Axes(int32_t*) = 0;
-
- protected:
- Magneto(void) {};
-};
-
-#endif /* __MAGNETO_CLASS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/MotionSensor.h Fri May 29 16:29:31 2015 +0200
@@ -0,0 +1,62 @@
+/**
+ ******************************************************************************
+ * @file MotionSensor.h
+ * @author AST / EST
+ * @version V0.0.1
+ * @date 13-April-2015
+ * @brief This file contains the abstract class describing in general
+ * the interfaces of an accelerometer
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+#ifndef __MOTION_SENSOR_CLASS_H
+#define __MOTION_SENSOR_CLASS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "mbed.h"
+
+/* Classes ------------------------------------------------------------------*/
+/** An abstract class for an Accelerometer
+ */
+class MotionSensor
+{
+ public:
+ virtual int Init(void*) = 0;
+ virtual int ReadID(uint8_t*) = 0;
+
+ virtual int Get_X_Axes(int32_t*) = 0;
+ virtual int Get_X_Sensitivity(float*) = 0;
+
+ protected:
+ MotionSensor(void) {};
+};
+
+#endif /* __MOTION_SENSOR_CLASS_H */
--- a/Components/Common/Pressure.h Fri May 29 14:23:22 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/**
- ******************************************************************************
- * @file Pressure.h
- * @author AST / EST
- * @version V0.0.1
- * @date 13-April-2015
- * @brief This file contains the abstract class describing in general
- * the interfaces of a pressure sensor
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-/* Define to prevent from recursive inclusion --------------------------------*/
-#ifndef __PRESSURE_CLASS_H
-#define __PRESSURE_CLASS_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "mbed.h"
-
-/* Classes ------------------------------------------------------------------*/
-/** An abstract class for Pressure components
- */
-class Pressure
-{
- public:
- virtual int Init(void*) = 0;
-
- virtual int PowerOff(void) = 0;
- virtual int ReadID(uint8_t*) = 0;
- virtual int Reset(void) = 0;
-
- virtual void ConfigIT(uint16_t) = 0;
- virtual void EnableIT(uint8_t) = 0;
- virtual void DisableIT(uint8_t) = 0;
- virtual uint8_t ITStatus(uint16_t, uint16_t) = 0;
- virtual void ClearIT(uint16_t, uint16_t) = 0;
-
- virtual int GetPressure(float*) = 0;
- virtual int GetTemperature(float*) = 0;
- virtual void SlaveAddrRemap(uint8_t) = 0;
-
- virtual void AttachIT(void (*fptr)(void)) = 0;
-
- protected:
- Pressure(void) {};
-};
-
-#endif /* __PRESSURE_CLASS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/PressureSensor.h Fri May 29 16:29:31 2015 +0200
@@ -0,0 +1,72 @@
+/**
+ ******************************************************************************
+ * @file PressureSensor.h
+ * @author AST / EST
+ * @version V0.0.1
+ * @date 13-April-2015
+ * @brief This file contains the abstract class describing in general
+ * the interfaces of a pressure sensor
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+#ifndef __PRESSURE_SENSOR_CLASS_H
+#define __PRESSURE_SENSOR_CLASS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "mbed.h"
+
+/* Classes ------------------------------------------------------------------*/
+/** An abstract class for a Pressure Sensor
+ */
+class PressureSensor
+{
+ public:
+ virtual int Init(void*) = 0;
+
+ virtual int PowerOff(void) = 0;
+ virtual int ReadID(uint8_t*) = 0;
+ virtual int Reset(void) = 0;
+
+ virtual void ConfigIT(uint16_t) = 0;
+ virtual void EnableIT(uint8_t) = 0;
+ virtual void DisableIT(uint8_t) = 0;
+ virtual uint8_t ITStatus(uint16_t, uint16_t) = 0;
+ virtual void ClearIT(uint16_t, uint16_t) = 0;
+
+ virtual int GetPressure(float*) = 0;
+
+ virtual void AttachIT(void (*fptr)(void)) = 0;
+
+ protected:
+ PressureSensor(void) {};
+};
+
+#endif /* __PRESSURE_SENSOR_CLASS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/TempSensor.h Fri May 29 16:29:31 2015 +0200
@@ -0,0 +1,72 @@
+/**
+ ******************************************************************************
+ * @file TempSensor.h
+ * @author AST / EST
+ * @version V0.0.1
+ * @date 13-April-2015
+ * @brief This file contains the abstract class describing in general
+ * the interfaces of a temperature sensor
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+#ifndef __TEMP_SENSOR_CLASS_H
+#define __TEMP_SENSOR_CLASS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "mbed.h"
+
+/* Classes ------------------------------------------------------------------*/
+/** An abstract class for Temperature sensors
+ */
+class TempSensor
+{
+ public:
+ virtual int Init(void*) = 0;
+
+ virtual int PowerOff(void) = 0;
+ virtual int ReadID(uint8_t*) = 0;
+ virtual int Reset(void) = 0;
+
+ virtual void ConfigIT(uint16_t) = 0;
+ virtual void EnableIT(uint8_t) = 0;
+ virtual void DisableIT(uint8_t) = 0;
+ virtual uint8_t ITStatus(uint16_t, uint16_t) = 0;
+ virtual void ClearIT(uint16_t, uint16_t) = 0;
+
+ virtual int GetTemperature(float*) = 0;
+
+ virtual void AttachIT(void (*fptr)(void)) = 0;
+
+ protected:
+ TempSensor(void) {};
+};
+
+#endif /* __TEMP_SENSOR_CLASS_H */
--- a/Components/hts221/hts221_class.h Fri May 29 14:23:22 2015 +0200
+++ b/Components/hts221/hts221_class.h Fri May 29 16:29:31 2015 +0200
@@ -41,18 +41,19 @@
/* Includes ------------------------------------------------------------------*/
#include "mbed.h"
#include "DevI2C.h"
-#include "../Common/HumTemp.h"
+#include "../Common/HumiditySensor.h"
+#include "../Common/TempSensor.h"
#include "hts221.h"
/* Classes -------------------------------------------------------------------*/
/** Class representing a HTS221 sensor component
*/
-class HTS221 : public HumTemp {
+class HTS221 : public HumiditySensor, public TempSensor {
public:
/** Constructor
* @param i2c device I2C to be used for communication
*/
- HTS221(DevI2C &i2c) : HumTemp(), dev_i2c(i2c) {
+ HTS221(DevI2C &i2c) : HumiditySensor(), TempSensor(), dev_i2c(i2c) {
T0_degC = T1_degC = H0_rh = H1_rh = 0.0;
T0_out = T1_out = H0_T0_out = H1_T0_out = 0;
}
@@ -62,7 +63,7 @@
return HTS221_Init((HUM_TEMP_InitTypeDef*)init_struct);
}
- virtual int PowerOFF(void) {
+ virtual int PowerOff(void) {
return HTS221_Power_OFF();
}
--- a/Components/lis3mdl/lis3mdl_class.h Fri May 29 14:23:22 2015 +0200
+++ b/Components/lis3mdl/lis3mdl_class.h Fri May 29 16:29:31 2015 +0200
@@ -41,18 +41,18 @@
/* Includes ------------------------------------------------------------------*/
#include "mbed.h"
#include "DevI2C.h"
-#include "../Common/Magneto.h"
+#include "../Common/MagneticSensor.h"
#include "lis3mdl.h"
/* Classes -------------------------------------------------------------------*/
/** Class representing a LIS3MDL sensor component
*/
-class LIS3MDL : public Magneto {
+class LIS3MDL : public MagneticSensor {
public:
/** Constructor
* @param i2c device I2C to be used for communication
*/
- LIS3MDL(DevI2C &i2c) : Magneto(), dev_i2c(i2c) {
+ LIS3MDL(DevI2C &i2c) : MagneticSensor(), dev_i2c(i2c) {
}
/*** Interface Methods ***/
@@ -60,7 +60,7 @@
return LIS3MDL_Init((MAGNETO_InitTypeDef*)init_struct);
}
- virtual int Read_M_ID(uint8_t *m_id) {
+ virtual int ReadID(uint8_t *m_id) {
return LIS3MDL_Read_M_ID(m_id);
}
--- a/Components/lps25h/lps25h_class.h Fri May 29 14:23:22 2015 +0200
+++ b/Components/lps25h/lps25h_class.h Fri May 29 16:29:31 2015 +0200
@@ -41,18 +41,19 @@
/* Includes ------------------------------------------------------------------*/
#include "mbed.h"
#include "DevI2C.h"
-#include "../Common/Pressure.h"
+#include "../Common/PressureSensor.h"
+#include "../Common/TempSensor.h"
#include "lps25h.h"
/* Classes -------------------------------------------------------------------*/
/** Class representing a LPS25H sensor component
*/
-class LPS25H : public Pressure {
+class LPS25H : public PressureSensor, public TempSensor {
public:
/** Constructor
* @param i2c device I2C to be used for communication
*/
- LPS25H(DevI2C &i2c) : Pressure(), dev_i2c(i2c) {
+ LPS25H(DevI2C &i2c) : PressureSensor(), TempSensor(), dev_i2c(i2c) {
LPS25H_SlaveAddress = LPS25H_ADDRESS_HIGH;
}
@@ -87,12 +88,12 @@
return LPS25H_GetTemperature(pfData);
}
- virtual void SlaveAddrRemap(uint8_t SA0_Bit_Status) {
+ virtual void AttachIT(void (*fptr)(void)) { /* not yet implemented */ }
+
+ void SlaveAddrRemap(uint8_t SA0_Bit_Status) {
LPS25H_SlaveAddrRemap(SA0_Bit_Status);
}
- virtual void AttachIT(void (*fptr)(void)) { /* not yet implemented */ }
-
protected:
/*** Methods ***/
PRESSURE_StatusTypeDef LPS25H_Init(PRESSURE_InitTypeDef *LPS25H_Init);
--- a/Components/lsm6ds0/lsm6ds0_class.h Fri May 29 14:23:22 2015 +0200
+++ b/Components/lsm6ds0/lsm6ds0_class.h Fri May 29 16:29:31 2015 +0200
@@ -41,18 +41,19 @@
/* Includes ------------------------------------------------------------------*/
#include "mbed.h"
#include "DevI2C.h"
-#include "../Common/Imu6Axes.h"
+#include "../Common/GyroSensor.h"
+#include "../Common/MotionSensor.h"
#include "lsm6ds0.h"
/* Classes -------------------------------------------------------------------*/
/** Class representing a LSM6DS0 sensor component
*/
-class LSM6DS0 : public Imu6Axes {
+class LSM6DS0 : public GyroSensor, public MotionSensor {
public:
/** Constructor
* @param i2c device I2C to be used for communication
*/
- LSM6DS0(DevI2C &i2c) : Imu6Axes(), dev_i2c(i2c) {
+ LSM6DS0(DevI2C &i2c) : GyroSensor(), MotionSensor(), dev_i2c(i2c) {
}
/*** Interface Methods ***/
@@ -60,7 +61,7 @@
return LSM6DS0_Init((IMU_6AXES_InitTypeDef*)init_struct);
}
- virtual int Read_XG_ID(uint8_t *xg_id) {
+ virtual int ReadID(uint8_t *xg_id) {
return LSM6DS0_Read_XG_ID(xg_id);
}
--- a/x_nucleo_iks01a1.cpp Fri May 29 14:23:22 2015 +0200
+++ b/x_nucleo_iks01a1.cpp Fri May 29 16:29:31 2015 +0200
@@ -132,7 +132,7 @@
return false;
}
- if(magnetometer.Read_M_ID(&m_id) != MAGNETO_OK)
+ if(magnetometer.ReadID(&m_id) != MAGNETO_OK)
{
return false;
}
@@ -205,7 +205,7 @@
return false;
}
- if(gyroscope.Read_XG_ID(&xg_id) != IMU_6AXES_OK)
+ if(gyroscope.ReadID(&xg_id) != IMU_6AXES_OK)
{
return false;
}