buzzer.h

00001 /* 
00002   buzzer.h
00003   
00004   Nicolas Williamson - July 2009
00005 */
00006 
00007 #ifndef __H_BUZZER__
00008 #define __H_BUZZER__
00009 
00010 void buzzer_on(void);
00011 void buzzer_off(void);
00012 void buzzer_set_frequency(int hz);
00013 void buzzer_sine(int period);
00014 
00015 /* HARDWARE SETUP
00016 
00017   // *******************************************************************************
00018   // Buzzer PWM Setup
00019   // *******************************************************************************
00020   PINSEL1 &= ~(3<<10);
00021   PINSEL1 |= (1<<10);  //PWM 5 on Pin P0.21 Enabled (bits 10/11)
00022   PWMPR = 0; //Will run at maximum rate
00023   PWMMR0 = 15000; 
00024   PWMMR5 = 0;
00025   PWMMCR = (1<<1); //Should set Timer Counter to reset upon reaching Match Register 0
00026   PWMTCR = (1<<0)|(1<<3); //Enables Timer Counter and PWM Mode.
00027   PWMPCR = (1<<13); //enable PWM5
00028   PWMLER = (1<<0)|(1<<5); //update PWMMR values
00029   
00030 */
00031 
00032 #endif
Generated on Tue Jun 29 16:36:14 2010 by  doxygen 1.6.3