Difference between revisions of "Hammer Buzzer Driver"
From eLinux.org
| Line 2: | Line 2: | ||
the buzzer on the carrier board can be accessed from userspace via the sysfs interface. example interfaces are in the directory marked /sys/devices/platform/tct_hammer-beeper.0/input:input1. the directory include a file entry "beep" and "duration". to generate a beep echo a non zero value to the beep file entry: | the buzzer on the carrier board can be accessed from userspace via the sysfs interface. example interfaces are in the directory marked /sys/devices/platform/tct_hammer-beeper.0/input:input1. the directory include a file entry "beep" and "duration". to generate a beep echo a non zero value to the beep file entry: | ||
| − | + | <pre> | |
echo 4096 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep | echo 4096 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep | ||
| − | + | </pre> | |
| − | + | ||
a tone will be generated for the length set in the duration file. to see what the current value is do: | a tone will be generated for the length set in the duration file. to see what the current value is do: | ||
| − | + | <pre> | |
cat /sys/devices/platform/tct_hammer-beeper.0/input\:input1/duration | cat /sys/devices/platform/tct_hammer-beeper.0/input\:input1/duration | ||
| + | </pre> | ||
the duration is measured in .01 seconds, i.e. a value of 100 is 1 second. if the value of duration is set for zero, the tone will be generated continuously until a zero value is echo'd to the beep entry: | the duration is measured in .01 seconds, i.e. a value of 100 is 1 second. if the value of duration is set for zero, the tone will be generated continuously until a zero value is echo'd to the beep entry: | ||
| − | + | <pre> | |
echo 0 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/duration | echo 0 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/duration | ||
| − | |||
echo 4096 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep | echo 4096 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep | ||
| − | |||
(tone generated) | (tone generated) | ||
| − | |||
echo 0 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep | echo 0 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep | ||
| − | |||
(tone stops) | (tone stops) | ||
| + | </pre> | ||
Revision as of 15:14, 29 January 2008
UserSpace Access
the buzzer on the carrier board can be accessed from userspace via the sysfs interface. example interfaces are in the directory marked /sys/devices/platform/tct_hammer-beeper.0/input:input1. the directory include a file entry "beep" and "duration". to generate a beep echo a non zero value to the beep file entry:
echo 4096 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep
a tone will be generated for the length set in the duration file. to see what the current value is do:
cat /sys/devices/platform/tct_hammer-beeper.0/input\:input1/duration
the duration is measured in .01 seconds, i.e. a value of 100 is 1 second. if the value of duration is set for zero, the tone will be generated continuously until a zero value is echo'd to the beep entry:
echo 0 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/duration echo 4096 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep (tone generated) echo 0 > /sys/devices/platform/tct_hammer-beeper.0/input\:input1/beep (tone stops)