aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARM7-LPC214x-GCC/buzzer.c
diff options
context:
space:
mode:
Diffstat (limited to 'demos/ARM7-LPC214x-GCC/buzzer.c')
-rw-r--r--demos/ARM7-LPC214x-GCC/buzzer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/demos/ARM7-LPC214x-GCC/buzzer.c b/demos/ARM7-LPC214x-GCC/buzzer.c
index b0abf9657..a93bafa98 100644
--- a/demos/ARM7-LPC214x-GCC/buzzer.c
+++ b/demos/ARM7-LPC214x-GCC/buzzer.c
@@ -80,3 +80,13 @@ void PlaySound(int freq, t_time duration) {
chSysUnlock();
}
+
+void PlaySoundWait(int freq, t_time duration) {
+ TC *tc = T1Base;
+
+ StopCounter(tc);
+ tc->TC_MR0 = tc->TC_MR1 = (PCLK / (freq * 2));
+ StartCounter(tc);
+ chThdSleep(duration);
+ StopCounter(tc);
+} \ No newline at end of file