openchronos-ng
opensource firmware for the ez430 chronos
Typedefs | Functions
buzzer.h File Reference

Buzzer subsystem functions. More...

Go to the source code of this file.

Typedefs

typedef uint16_t note
 Note type.

Functions

void buzzer_init (void)
 Initialize buzzer subsystem.
void buzzer_play (note *notes)
 Play a sequence of notes using the buzzer.

Detailed Description

Buzzer subsystem functions.

This file contains all the methods used for \ playing tones with buzzer. The buzzer can play a number of different tones, represented as a note array. The buzzer output frequency can be calculated using:

\[ \frac{T_{\mathrm{ACLK}}}{2*\mathrm{TA1CCR0}} \]


Typedef Documentation

typedef uint16_t note

Note type.

This is a type representing a note. It is composed by:

  • The first 4 MSB represent the pitch
  • The next 2 bits represent the octave
  • The following 10 bits are the duration in ms of the note.

There are two "meta" notes:

  • The note xxx0 represents no tone (a rest).
  • The note xxxF represents the "stop note" marking the \ end of a note sequence.
Note:
The stop note is needed in the play loop to determine \ when to end the melody.

Function Documentation

void buzzer_play ( note notes)

Play a sequence of notes using the buzzer.

Parameters:
notesAn array of notes to play.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines