Skip to content

Commit

Permalink
Added accelerometer classes that conform to the sensor spec
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcdorman committed Feb 16, 2013
1 parent c24d5ce commit a7b5afa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
19 changes: 19 additions & 0 deletions include/kovan/accel.hpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _ACCEL_HPP_ #define _ACCEL_HPP_


#include "export.h" #include "export.h"
#include "sensor.hpp"


class Acceleration class Acceleration
{ {
Expand All @@ -15,4 +16,22 @@ class Acceleration
static bool s_setup; 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 #endif
15 changes: 15 additions & 0 deletions src/accel.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -95,3 +95,18 @@ bool Acceleration::calibrate()


return false; // fail return false; // fail
} }

short AccelX::value() const
{
return Acceleration::x();
}

short AccelY::value() const
{
return Acceleration::y();
}

short AccelZ::value() const
{
return Acceleration::z();
}

0 comments on commit a7b5afa

Please sign in to comment.