led -- enable soekris hardware specific options like the error LED
#include <dev/led/led.h>
typedef void led_t(void *priv, int onoff);
dev_t
led_create(led_t *func, void *priv, char const *name);
void
led_destroy(dev_t dev);
The led driver provides generic support for handling LEDs, lamps and
other announciators.
The hardware driver must supply a function to turn the announciator on
and off and the device name of the announciator relative "/dev/led/".
The priv argument is passed back to this on/off function and can be used
however the hardware driver sees fit.
The lamp can be controlled by opening and writing ascii strings to the
"/dev/led/bla" device.
In the following we will use this special notation to indicate the
resulting output of the announciator:
* The announciator is on for 1/10th secound.
_ The announciator is off for 1/10th secound.
State can be set directly, and since the change happens immediately, it
is possible to flash the announciator with very short periods and synchronize
it with program events. It should be noted that there is a nontrivial
overhead, so this may not be usable for benchmarking or measuring
short intervals.
0 Turn the announciator off immediately.
1 Turn the announciator on immediately.
Flashing can be set with a given period. The pattern continues endlessly.
f _*
f1 _*
f2 __**
f3 ___***
...
f9 _________*********
Three high-level commands are available:
d%d numbers. Each digit is blinked out at 1/10th second, zero
as ten pulses. Between digits a one second pause and after
the last digit a two second pause after which the sequence
is repeated.
s%s string. This gives full control over the announciator.
Letters 'A' ... 'J' turns the announciator on for from
1/10th to one full second. Letters 'a' ... 'j' turns the
announciator off for 1/10th to one full second. The
sequence is immediately repeated.
m%s morse.
'.' becomes _*
'-' becomes _***
' ' becomes __
'\n' becomes ____
The sequence is repeated after a one second pause.
A 'd12' flashes the lamp
*__________*_*______________________________
A 'sAaAbBa' flashes
_*_**__*
/usr/games/morse -l "Soekris rocks" > /dev/led/error
/dev/led/*
morse(6)
The led driver first appeared in FreeBSD 5.2.
This software was written by Poul-Henning Kamp <[email protected]>.
This manual page was written by Sergey A. Osokin <[email protected]> and
Poul-Henning Kamp <[email protected]>.
FreeBSD 5.2.1 November 3, 2003 FreeBSD 5.2.1 [ Back ] |