#include <config.h>
#include <sys/h8.h>
#include <sys/bitops.h>
Include dependency graph for dsensor.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Defines | |
#define | SENSOR_1 AD_C |
Sensor on input pad 1. More... | |
#define | SENSOR_2 AD_B |
Sensor on input pad 2. More... | |
#define | SENSOR_3 AD_A |
Sensor on input pad 3. More... | |
#define | BATTERY AD_D |
Battery sensor. More... | |
#define | LIGHT_RAW_BLACK 0xffc0 |
active light sensor raw black value. More... | |
#define | LIGHT_RAW_WHITE 0x5080 |
active light sensor raw white value. More... | |
#define | LIGHT(a) (147 - ds_scale(a)/7) |
map light sensor to 0..LIGHT_MAX. More... | |
#define | LIGHT_MAX LIGHT(LIGHT_RAW_WHITE) |
maximum decoded value. More... | |
#define | LIGHT_1 LIGHT(SENSOR_1) |
light sensor on input 1. More... | |
#define | LIGHT_2 LIGHT(SENSOR_2) |
light sensor on input 2. More... | |
#define | LIGHT_3 LIGHT(SENSOR_3) |
light sensor on input 3. More... | |
#define | ROTATION_1 (ds_rotations[2]) |
rotation sensor on input 1. More... | |
#define | ROTATION_2 (ds_rotations[1]) |
rotation sensor on input 2. More... | |
#define | ROTATION_3 (ds_rotations[0]) |
rotation sensor on input 3. More... | |
#define | TOUCH(a) ((unsigned int)(a) < 0x8000) |
Convert raw data to touch sensor (0: off, else pressed). More... | |
#define | TOUCH_1 TOUCH(SENSOR_1) |
touch sensor on input 1. More... | |
#define | TOUCH_2 TOUCH(SENSOR_2) |
touch sensor on input 2. More... | |
#define | TOUCH_3 TOUCH(SENSOR_3) |
touch sensor on input 3. More... | |
#define | ds_scale(x) ((unsigned int)(x)>>6) |
mask off bottom 6 bits. More... | |
#define | ds_unscale(x) ((unsigned int)(x)<<6) |
leave room for bottom 6 bits. More... | |
Functions | |
void | ds_active (volatile unsigned *sensor) |
set sensor mode to active (light sensor emits light, rotation works). More... | |
void | ds_passive (volatile unsigned *sensor) |
set sensor mode to passive (light sensor detects ambient light). More... | |
void | ds_rotation_set (volatile unsigned *sensor, int pos) |
set rotation to an absolute value. More... | |
void | ds_rotation_on (volatile unsigned *sensor) |
start tracking rotation sensor. More... | |
void | ds_rotation_off (volatile unsigned *sensor) |
stop tracking rotation sensor. More... | |
Variables | |
unsigned char | ds_activation |
activation bitmask. More... | |
unsigned char | ds_rotation |
rotation bitmask. More... | |
volatile int | ds_rotations [3] |
rotational position. More... |
Definition in file dsensor.h.
|
Battery sensor.
Definition at line 64 of file dsensor.h. Referenced by Sensor::Sensor(). |
|
mask off bottom 6 bits.
|
|
leave room for bottom 6 bits.
|
|
map light sensor to 0..LIGHT_MAX.
Definition at line 77 of file dsensor.h. Referenced by LightSensor::get(). |
|
light sensor on input 1.
|
|
light sensor on input 2.
|
|
light sensor on input 3.
|
|
maximum decoded value.
|
|
active light sensor raw black value.
|
|
active light sensor raw white value.
|
|
rotation sensor on input 1.
Definition at line 91 of file dsensor.h. Referenced by RotationSensor::RotationSensor(). |
|
rotation sensor on input 2.
Definition at line 92 of file dsensor.h. Referenced by RotationSensor::RotationSensor(). |
|
rotation sensor on input 3.
Definition at line 93 of file dsensor.h. Referenced by RotationSensor::RotationSensor(). |
|
Sensor on input pad 1.
Definition at line 61 of file dsensor.h. Referenced by ds_active(), ds_passive(), ds_rotation_off(), ds_rotation_on(), and Sensor::Sensor(). |
|
Sensor on input pad 2.
Definition at line 62 of file dsensor.h. Referenced by ds_active(), ds_passive(), ds_rotation_off(), ds_rotation_on(), and Sensor::Sensor(). |
|
Sensor on input pad 3.
Definition at line 63 of file dsensor.h. Referenced by ds_active(), ds_passive(), ds_rotation_off(), ds_rotation_on(), and Sensor::Sensor(). |
|
Convert raw data to touch sensor (0: off, else pressed).
Definition at line 118 of file dsensor.h. Referenced by TouchSensor::pressed(). |
|
touch sensor on input 1.
|
|
touch sensor on input 2.
|
|
touch sensor on input 3.
|
|
set sensor mode to active (light sensor emits light, rotation works).
Definition at line 167 of file dsensor.h. References bit_set, ds_activation, SENSOR_1, SENSOR_2, and SENSOR_3. Referenced by Sensor::active(). |
|
set sensor mode to passive (light sensor detects ambient light).
Definition at line 180 of file dsensor.h. References bit_clear, ds_activation, PORT6, SENSOR_1, SENSOR_2, and SENSOR_3. Referenced by Sensor::passive(). |
|
stop tracking rotation sensor.
Definition at line 220 of file dsensor.h. References bit_clear, ds_rotation, SENSOR_1, SENSOR_2, and SENSOR_3. Referenced by RotationSensor::off(). |
|
start tracking rotation sensor.
Definition at line 207 of file dsensor.h. References bit_set, ds_rotation, SENSOR_1, SENSOR_2, and SENSOR_3. Referenced by RotationSensor::on(). |
|
set rotation to an absolute value.
Referenced by RotationSensor::pos(). |
|
activation bitmask.
Definition at line 140 of file dsensor.h. Referenced by ds_active(), and ds_passive(). |
|
rotation bitmask.
Definition at line 143 of file dsensor.h. Referenced by ds_rotation_off(), and ds_rotation_on(). |
|
rotational position.
|
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |