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 sensor.
Definition at line 64 of file dsensor.h.
#define ds_scale |
( |
|
x | ) |
((unsigned int)(x)>>6) |
mask off bottom 6 bits
Definition at line 127 of file dsensor.h.
#define ds_unscale |
( |
|
x | ) |
((unsigned int)(x)<<6) |
leave room for bottom 6 bits
Definition at line 128 of file dsensor.h.
#define LIGHT |
( |
|
a | ) |
(147 - ds_scale(a)/7) |
map light sensor to 0..LIGHT_MAX
Definition at line 77 of file dsensor.h.
light sensor on input 1
Definition at line 83 of file dsensor.h.
light sensor on input 2
Definition at line 84 of file dsensor.h.
light sensor on input 3
Definition at line 85 of file dsensor.h.
maximum decoded value
Definition at line 78 of file dsensor.h.
#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.
#define LIGHT_RAW_WHITE 0x5080 |
active light sensor raw white value
Definition at line 70 of file dsensor.h.
rotation sensor on input 1
Definition at line 91 of file dsensor.h.
rotation sensor on input 2
Definition at line 92 of file dsensor.h.
rotation sensor on input 3
Definition at line 93 of file dsensor.h.
#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 sensor on input 1
Definition at line 122 of file dsensor.h.
touch sensor on input 2
Definition at line 123 of file dsensor.h.
touch sensor on input 3
Definition at line 124 of file dsensor.h.
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.
void ds_passive |
( |
volatile unsigned * |
sensor | ) |
|
|
inline |
set sensor mode to passive (light sensor detects ambient light)
- Parameters
-
sensor | &SENSOR_1,&SENSOR_2,&SENSOR_3 |
Definition at line 180 of file dsensor.h.
References SENSOR_1, SENSOR_2, and SENSOR_3.
void ds_rotation_off |
( |
volatile unsigned * |
sensor | ) |
|
|
inline |
void ds_rotation_on |
( |
volatile unsigned * |
sensor | ) |
|
|
inline |
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.
unsigned char ds_activation |
unsigned char ds_rotation |
volatile int ds_rotations[3] |