#include <config.h>
#include <sys/h8.h>
#include <sys/bitops.h>
Include dependency graph for dsensor.h:

Go to the source code of this file.
Defines | |
| #define | SENSOR_1 AD_C |
| Sensor on input pad 1. | |
| #define | SENSOR_2 AD_B |
| Sensor on input pad 2. | |
| #define | SENSOR_3 AD_A |
| Sensor on input pad 3. | |
| #define | BATTERY AD_D |
| Battery sensor. | |
| #define | LIGHT_RAW_BLACK 0xffc0 |
| active light sensor raw black value | |
| #define | LIGHT_RAW_WHITE 0x5080 |
| active light sensor raw white value | |
| #define | LIGHT(a) (147 - ds_scale(a)/7) |
| map light sensor to 0..LIGHT_MAX | |
| #define | LIGHT_MAX LIGHT(LIGHT_RAW_WHITE) |
| maximum decoded value | |
| #define | LIGHT_1 LIGHT(SENSOR_1) |
| light sensor on input 1 | |
| #define | LIGHT_2 LIGHT(SENSOR_2) |
| light sensor on input 2 | |
| #define | LIGHT_3 LIGHT(SENSOR_3) |
| light sensor on input 3 | |
| #define | ROTATION_1 (ds_rotations[2]) |
| rotation sensor on input 1 | |
| #define | ROTATION_2 (ds_rotations[1]) |
| rotation sensor on input 2 | |
| #define | ROTATION_3 (ds_rotations[0]) |
| rotation sensor on input 3 | |
| #define | TOUCH(a) ((unsigned int)(a) < 0x8000) |
| Convert raw data to touch sensor (0: off, else pressed). | |
| #define | TOUCH_1 TOUCH(SENSOR_1) |
| touch sensor on input 1 | |
| #define | TOUCH_2 TOUCH(SENSOR_2) |
| touch sensor on input 2 | |
| #define | TOUCH_3 TOUCH(SENSOR_3) |
| touch sensor on input 3 | |
| #define | ds_scale(x) ((unsigned int)(x)>>6) |
| mask off bottom 6 bits | |
| #define | ds_unscale(x) ((unsigned int)(x)<<6) |
| leave room for bottom 6 bits | |
Functions | |
| void | ds_active (volatile unsigned *sensor) |
| set sensor mode to active (light sensor emits light, rotation works) | |
| void | ds_passive (volatile unsigned *sensor) |
| set sensor mode to passive (light sensor detects ambient light) | |
| void | ds_rotation_set (volatile unsigned *sensor, int pos) |
| set rotation to an absolute value | |
| void | ds_rotation_on (volatile unsigned *sensor) |
| start tracking rotation sensor | |
| void | ds_rotation_off (volatile unsigned *sensor) |
| stop tracking rotation sensor | |
Variables | |
| unsigned char | ds_activation |
| activation bitmask | |
| unsigned char | ds_rotation |
| rotation bitmask | |
| volatile int | ds_rotations [3] |
| rotational position | |
Definition in file dsensor.h.
|
|
Battery sensor.
|
|
|
mask off bottom 6 bits
|
|
|
leave room for bottom 6 bits
|
|
|
map light sensor to 0..LIGHT_MAX
|
|
|
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
|
|
|
rotation sensor on input 2
|
|
|
rotation sensor on input 3
|
|
|
Sensor on input pad 1.
Definition at line 61 of file dsensor.h. Referenced by ds_active(), ds_passive(), ds_rotation_off(), and ds_rotation_on(). |
|
|
Sensor on input pad 2.
Definition at line 62 of file dsensor.h. Referenced by ds_active(), ds_passive(), ds_rotation_off(), and ds_rotation_on(). |
|
|
Sensor on input pad 3.
Definition at line 63 of file dsensor.h. Referenced by ds_active(), ds_passive(), ds_rotation_off(), and ds_rotation_on(). |
|
|
Convert raw data to touch sensor (0: off, else 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 ds_activation, SENSOR_1, SENSOR_2, and SENSOR_3. |
|
|
set sensor mode to passive (light sensor detects ambient light)
Definition at line 180 of file dsensor.h. References ds_activation, SENSOR_1, SENSOR_2, and SENSOR_3. |
|
|
stop tracking rotation sensor
Definition at line 220 of file dsensor.h. References ds_rotation, SENSOR_1, SENSOR_2, and SENSOR_3. |
|
|
start tracking rotation sensor
Definition at line 207 of file dsensor.h. References ds_rotation, SENSOR_1, SENSOR_2, and SENSOR_3. |
|
||||||||||||
|
set rotation to an absolute value
|
|
|
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. |
1.3.5