Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added accelerometer classes that conform to the sensor spec

  • Loading branch information...
commit a7b5afa48eb2fa15eb198df56fee2f724f474a1f 1 parent c24d5ce
@bmcdorman bmcdorman authored
Showing with 34 additions and 0 deletions.
  1. +19 −0 include/kovan/accel.hpp
  2. +15 −0 src/accel.cpp
View
19 include/kovan/accel.hpp
@@ -2,6 +2,7 @@
#define _ACCEL_HPP_
#include "export.h"
+#include "sensor.hpp"
class Acceleration
{
@@ -15,4 +16,22 @@ class Acceleration
static bool s_setup;
};
+class AccelX : public Sensor<short>
+{
+public:
+ virtual short value() const;
+};
+
+class AccelY : public Sensor<short>
+{
+public:
+ virtual short value() const;
+};
+
+class AccelZ : public Sensor<short>
+{
+public:
+ virtual short value() const;
+};
+
#endif
View
15 src/accel.cpp
@@ -95,3 +95,18 @@ bool Acceleration::calibrate()
return false; // fail
}
+
+short AccelX::value() const
+{
+ return Acceleration::x();
+}
+
+short AccelY::value() const
+{
+ return Acceleration::y();
+}
+
+short AccelZ::value() const
+{
+ return Acceleration::z();
+}
Please sign in to comment.
Something went wrong with that request. Please try again.