Lab3
Functions

speaker

Functions

int speaker_ctrl (unsigned char on)
 Enables/disables speaker.
int speaker_test (unsigned long freq, unsigned long time)
 Programs speaker to generate tone for the given time interval.

Detailed Description

Functions that control the speaker output


Function Documentation

int speaker_ctrl ( unsigned char  on)

Enables/disables speaker.

Enables/disables speaker, by both enabling/disabling Timer 2 and its output gate

Parameters:
onIf zero disable speaker, otherwise enable it
Returns:
Return 0 upon success and non-zero otherwise
int speaker_test ( unsigned long  freq,
unsigned long  time 
)

Programs speaker to generate tone for the given time interval.

Parameters:
freqFrequency of tone to generate in Hz
timeDuration of tone in s
Returns:
Return 0 upon success and non-zero otherwise