buzzer.c File Reference

Control of the buzzer on the UI board. More...

Go to the source code of this file.

Defines

#define PI   3.14159265

Functions

void buzzer_off (void)
 Turns the buzzer off.
void buzzer_on (void)
 Turns the buzzer on.
void buzzer_set_frequency (int hz)
 Sets the frequency of the buzzer.
void buzzer_sine (int period)

Variables

int buzzer_hz = 4000
 The frequency of the buzzer.
int buzzer_hz_init = 600
int buzzer_hz_range = 300
int buzzer_is_on = 0
int buzzer_period = 3000

Detailed Description

Control of the buzzer on the UI board.

Example hardware/register setup of PWM for buzzer:

  // *******************************************************************************
  // Buzzer PWM Setup
  // *******************************************************************************
  PINSEL1 &= ~(3<<10);
  PINSEL1 |= (1<<10);  //PWM 5 on Pin P0.21 Enabled (bits 10/11)
  PWMPR = 0; //Will run at maximum rate
  PWMMR0 = 15000; 
  PWMMR5 = 0;
  PWMMCR = (1<<1); //Should set Timer Counter to reset upon reaching Match Register 0
  PWMTCR = (1<<0)|(1<<3); //Enables Timer Counter and PWM Mode.
  PWMPCR = (1<<13); //enable PWM5
  PWMLER = (1<<0)|(1<<5); //update PWMMR values
Author:
Nicolas Williamson
Date:
July 2009

Definition in file buzzer.c.


Function Documentation

void buzzer_set_frequency ( int  hz  ) 

Sets the frequency of the buzzer.

Parameters:
hz The new frequency of the buzzer.

Definition at line 58 of file buzzer.c.

References buzzer_hz, and buzzer_on().

Referenced by song_update().

00058                                  {
00059   buzzer_hz = hz;
00060   if (buzzer_is_on){
00061     buzzer_on();
00062   }
00063 }


Variable Documentation

int buzzer_hz = 4000

The frequency of the buzzer.

Definition at line 31 of file buzzer.c.

Referenced by buzzer_on(), and buzzer_set_frequency().

Generated on Tue Jun 29 16:36:14 2010 by  doxygen 1.6.3