Interface: direct reading of sensors.
More...
#include <config.h>
#include <sys/h8.h>
#include <sys/bitops.h>
Go to the source code of this file.
|
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...
|
|
Interface: direct reading of sensors.
- Author
- Markus L. Noga marku.nosp@m.s@no.nosp@m.ga.de
Definition in file dsensor.h.
§ BATTERY
Battery sensor.
Definition at line 64 of file dsensor.h.
§ ds_scale
#define ds_scale |
( |
|
x | ) |
((unsigned int)(x)>>6) |
mask off bottom 6 bits
Definition at line 127 of file dsensor.h.
§ ds_unscale
#define ds_unscale |
( |
|
x | ) |
((unsigned int)(x)<<6) |
leave room for bottom 6 bits
Definition at line 128 of file dsensor.h.
§ LIGHT
#define LIGHT |
( |
|
a | ) |
(147 - ds_scale(a)/7) |
map light sensor to 0..LIGHT_MAX
Definition at line 77 of file dsensor.h.
§ LIGHT_1
light sensor on input 1
Definition at line 83 of file dsensor.h.
§ LIGHT_2
light sensor on input 2
Definition at line 84 of file dsensor.h.
§ LIGHT_3
light sensor on input 3
Definition at line 85 of file dsensor.h.
§ LIGHT_MAX
maximum decoded value
Definition at line 78 of file dsensor.h.
§ LIGHT_RAW_BLACK
#define LIGHT_RAW_BLACK 0xffc0 |
< active light sensor: estimated raw values
active light sensor raw black value
Definition at line 69 of file dsensor.h.
§ LIGHT_RAW_WHITE
#define LIGHT_RAW_WHITE 0x5080 |
active light sensor raw white value
Definition at line 70 of file dsensor.h.
§ ROTATION_1
rotation sensor on input 1
Definition at line 91 of file dsensor.h.
§ ROTATION_2
rotation sensor on input 2
Definition at line 92 of file dsensor.h.
§ ROTATION_3
rotation sensor on input 3
Definition at line 93 of file dsensor.h.
§ SENSOR_1
§ SENSOR_2
§ SENSOR_3
§ TOUCH
#define TOUCH |
( |
|
a | ) |
((unsigned int)(a) < 0x8000) |
Convert raw data to touch sensor (0: off, else pressed)
Definition at line 118 of file dsensor.h.
§ TOUCH_1
touch sensor on input 1
Definition at line 122 of file dsensor.h.
§ TOUCH_2
touch sensor on input 2
Definition at line 123 of file dsensor.h.
§ TOUCH_3
touch sensor on input 3
Definition at line 124 of file dsensor.h.
§ ds_active()
void ds_active |
( |
volatile unsigned * |
sensor | ) |
|
|
inline |
set sensor mode to active (light sensor emits light, rotation works)
- Parameters
-
sensor | &SENSOR_1,&SENSOR_2,&SENSOR_3 |
Definition at line 167 of file dsensor.h.
References SENSOR_1, SENSOR_2, and SENSOR_3.
§ ds_passive()
void ds_passive |
( |
volatile unsigned * |
sensor | ) |
|
|
inline |
§ ds_rotation_off()
void ds_rotation_off |
( |
volatile unsigned * |
sensor | ) |
|
|
inline |
§ ds_rotation_on()
void ds_rotation_on |
( |
volatile unsigned * |
sensor | ) |
|
|
inline |
§ ds_rotation_set()
void ds_rotation_set |
( |
volatile unsigned * |
sensor, |
|
|
int |
pos |
|
) |
| |
set rotation to an absolute value
- Parameters
-
sensor | one of &SENSOR_1, &SENSOR_2, or &SENSOR_3 |
pos | the current rotational postion (typically use 0 here) |
- Returns
- Nothing
The axis should be inert during the function call.
Referenced by ds_passive().
§ ds_activation
unsigned char ds_activation |
§ ds_rotation
unsigned char ds_rotation |
§ ds_rotations
volatile int ds_rotations[3] |