22 #ifndef _RotationSensor_H_ 23 #define _RotationSensor_H_ 29 #if defined(CONF_DSENSOR) && defined(CONF_DSENSOR_ROTATION) 58 #ifdef CONF_DSENSOR_VELOCITY
60 rvelocity((port ==
S1) ? VELOCITY_1 :
61 (port ==
S2) ? VELOCITY_2 :
97 #ifdef CONF_DSENSOR_VELOCITY 102 int velocity()
const {
return rvelocity;}
103 #endif // CONF_DSENSOR_VELOCITY 110 #ifdef CONF_DSENSOR_VELOCITY 114 volatile int& rvelocity;
115 #endif // CONF_DSENSOR_VELOCITY 119 #warning Enable CONF_DSENSOR && CONF_DSENSOR_ROTATION to use RotationSensor.H 120 #endif // CONF_DSENSOR, CONF_DSENSOR_ROTATION 121 #endif // _RotationSensor_H_ Rotation-sensor interface (active mode).
#define ROTATION_2
rotation sensor on input 2
void pos(int position) const
set the current absolute postion
RotationSensor(const Port port, int position=0)
Create an instance of an active rotation sensor which is attached at {port}.
kernel configuration file
C++ Sensor Class Interface.
void on() const
turn on rotation tracking
void ds_rotation_on(volatile unsigned *sensor)
start tracking rotation sensor
int pos() const
get the current absolute postion
volatile int & rsensor
the raw sensor value
#define ROTATION_1
rotation sensor on input 1
void ds_rotation_off(volatile unsigned *sensor)
stop tracking rotation sensor
void ds_rotation_set(volatile unsigned *sensor, int pos)
set rotation to an absolute value
void off() const
turn off rotation tracking
#define ROTATION_3
rotation sensor on input 3
Port
List of sensor identifiers (IDs).
~RotationSensor()
Destroy this instance.
volatile unsigned int & sensor
The address of our sensor value.