Difference between revisions of "Hammer Buzzer Driver"

From eLinux.org
Jump to: navigation, search
(Add Category Hammer)
Line 18: Line 18:
 
(tone stops)
 
(tone stops)
 
</pre>
 
</pre>
 +
 +
[[Category:Hammer]]

Revision as of 13:13, 13 May 2011

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)