Hammer Buzzer Driver

From eLinux.org
Revision as of 08:42, 14 May 2011 by Jsujjava (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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)