Go to the documentation of this file.
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_
void off() const
turn off rotation tracking
~RotationSensor()
Destroy this instance.
volatile unsigned int & sensor
The address of our sensor value.
#define ROTATION_3
rotation sensor on input 3
void ds_rotation_set(volatile unsigned *sensor, int pos)
set rotation to an absolute value
volatile int & rsensor
the raw sensor value
void ds_rotation_off(volatile unsigned *sensor)
stop tracking rotation sensor
#define ROTATION_2
rotation sensor on input 2
C++ Sensor Class Interface.
RotationSensor(const Port port, int position=0)
Create an instance of an active rotation sensor which is attached at {port}.
void ds_rotation_on(volatile unsigned *sensor)
start tracking rotation sensor
kernel configuration file
void on() const
turn on rotation tracking
void pos(int position) const
set the current absolute postion
Port
List of sensor identifiers (IDs).
#define ROTATION_1
rotation sensor on input 1
int pos() const
get the current absolute postion
Generated for brickOS Kernel Developer by
1.8.16