1 .\" Copyright (c) 2003 Sergey A. Osokin <osa@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd API for manipulating LED's, lamps and other annunciators
36 .Fd "typedef void led_t(void *priv, int onoff);"
38 .Fn led_create_state "led_t *func" "void *priv" "char const *name" "int state"
40 .Fn led_create "led_t *func" "void *priv" "char const *name"
42 .Fn led_destroy "struct cdev *"
46 driver provides generic support for handling LEDs, lamps and other
49 The hardware driver must supply a function to turn the annunciator on and off
52 of the annunciator relative to
56 argument is passed back to this on/off function and can be used however
57 the hardware driver sees fit.
59 The lamp can be controlled by opening and writing
65 In the following, we will use this special notation to indicate the resulting
66 output of the annunciator:
68 .Bl -tag -width indent -offset indent -compact
70 The annunciator is on for 1/10th second.
72 The annunciator is off for 1/10th second.
75 State can be set directly, and since the change happens immediately,
76 it is possible to flash the annunciator with very short periods and
77 synchronize it with program events.
78 It should be noted that there is a non-trivial overhead, so this may
79 not be usable for benchmarking or measuring short intervals.
81 .Bl -tag -width indent -offset indent -compact
83 Turn the annunciator off immediately.
85 Turn the annunciator on immediately.
88 Flashing can be set with a given period.
89 The pattern continues endlessly.
91 .Bl -tag -width indent -offset indent -compact
105 Three high-level commands are available:
106 .Bl -tag -width indent -offset indent
109 Each digit is blinked out at 1/10th second, zero as ten pulses.
110 Between digits a one second pause and after the last
111 digit a two second pause after which the sequence is repeated.
114 This gives full control over the annunciator.
119 turn the annunciator on for from 1/10th to one full
125 turn the annunciator off for 1/10th
131 turn the annunciator off and on respectively when the next
133 Unless terminated with a
135 the sequence is immediately repeated.
139 .Bl -tag -width indent -offset indent -compact
155 The sequence is repeated after a one second pause.
157 .Bl -tag -width ".Pa /dev/led/*"
165 .Dl *__________*_*______________________________
174 /usr/games/morse -l "Soekris rocks" > /dev/led/error
181 driver first appeared in
185 This software was written by
186 .An Poul-Henning Kamp
187 .Aq phk@FreeBSD.org .
189 This manual page was written by
193 .An Poul-Henning Kamp
194 .Aq phk@FreeBSD.org .