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 :
96 int pos()
const {
return rsensor;}
97 #ifdef CONF_DSENSOR_VELOCITY
102 int velocity()
const {
return rvelocity;}
103 #endif // CONF_DSENSOR_VELOCITY
109 volatile int& rsensor;
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).
int pos() const
get the current absolute postion
void pos(int position) const
set the current absolute postion
#define ROTATION_2
rotation sensor on input 2
void off() const
turn off rotation tracking
void on() const
turn on rotation tracking
RotationSensor(const Port port, int position=0)
Create an instance of an active rotation sensor which is attached at {port}.
C++ Sensor Class Interface.
void ds_rotation_on(volatile unsigned *sensor)
start tracking rotation sensor
#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
#define ROTATION_3
rotation sensor on input 3
Port
List of sensor identifiers (IDs).
Interface: direct reading of sensors.
~RotationSensor()
Destroy this instance.
volatile unsigned int & sensor
The address of our sensor value.