Virtual base class for sensors that measure motion

Dependents:   FXOS8700Q MAG3110 MMA8451Q MAG3110 ... more

Embed: (wiki syntax)

« Back to documentation index

MotionSensor Class Reference

MotionSensor Class Reference

Motion Sensor Base Class Useful for accessing data in a common way. More...

#include <MotionSensor.h>

Public Member Functions

virtual void enable (void) const =0
 Enable the sensor for operation.
virtual void disable (void) const =0
 disable the sensors operation
virtual uint32_t sampleRate (uint32_t frequency) const =0
 Set the sensor sample rate.
virtual uint32_t dataReady (void) const =0
 Tells of new data is ready.
virtual int16_t getX (int16_t &x) const =0
 Get the x data in counts.
virtual int16_t getY (int16_t &y) const =0
 Get the y data in counts.
virtual int16_t getZ (int16_t &z) const =0
 Get the z data in counts.
virtual float getX (float &x) const =0
 Get the x data in units.
virtual float getY (float &y) const =0
 Get the y data in units.
virtual float getZ (float &z) const =0
 Get the z data in units.
virtual void getAxis (motion_data_counts_t &xyz) const =0
 Get the x,y,z data in counts.
virtual void getAxis (motion_data_units_t &xyz) const =0
 Get the x,y,z data in units.

Detailed Description

Motion Sensor Base Class Useful for accessing data in a common way.

Definition at line 42 of file MotionSensor.h.


Member Function Documentation

virtual uint32_t dataReady ( void   ) const [pure virtual]

Tells of new data is ready.

Returns:
The amount of data samples ready to be read from a device
virtual void disable ( void   ) const [pure virtual]

disable the sensors operation

virtual void enable ( void   ) const [pure virtual]

Enable the sensor for operation.

virtual void getAxis ( motion_data_counts_t xyz ) const [pure virtual]

Get the x,y,z data in counts.

Parameters:
xyzA referene to the variable to put the data in, 0 denotes not used
virtual void getAxis ( motion_data_units_t xyz ) const [pure virtual]

Get the x,y,z data in units.

Parameters:
xyzA referene to the variable to put the data in, 0 denotes not used
virtual float getX ( float &  x ) const [pure virtual]

Get the x data in units.

Parameters:
xA referene to the variable to put the data in, 0 denotes not used
Returns:
The x data in units
virtual int16_t getX ( int16_t &  x ) const [pure virtual]

Get the x data in counts.

Parameters:
xA referene to the variable to put the data in, 0 denotes not used
Returns:
The x data in counts
virtual float getY ( float &  y ) const [pure virtual]

Get the y data in units.

Parameters:
yA referene to the variable to put the data in, 0 denotes not used
Returns:
The y data in units
virtual int16_t getY ( int16_t &  y ) const [pure virtual]

Get the y data in counts.

Parameters:
yA referene to the variable to put the data in, 0 denotes not used
Returns:
The y data in counts
virtual int16_t getZ ( int16_t &  z ) const [pure virtual]

Get the z data in counts.

Parameters:
zA referene to the variable to put the data in, 0 denotes not used
Returns:
The z data in counts
virtual float getZ ( float &  z ) const [pure virtual]

Get the z data in units.

Parameters:
zA referene to the variable to put the data in, 0 denotes not used
Returns:
The z data in units
virtual uint32_t sampleRate ( uint32_t  frequency ) const [pure virtual]

Set the sensor sample rate.

Parameters:
frequencyThe desires sample frequency
Returns:
The amount of error in Hz between desired and actual frequency