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 |
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
Definition in file buzzer.c.
void buzzer_set_frequency | ( | int | hz | ) |
Sets the frequency of the buzzer.
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().
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().