ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9


3 - A Single Tone to Start

First off we'll look at individual tone generation:
  void piezo_play_1tone(struct piezo_tone t, int flags);

The flags represent how tones are handled, and can be zero or any of the following:
  • PIEZO_FLAG_WAIT - Queue up the tone to play after the current one finishes. Note however that the function returns immediately.
  • PIEZO_FLAG_4EVER - Repeatedly play tone(s).
  • PIEZO_FLAG_NOQUIET - Play even if volume of the ebm has been turned down or off (quiet mode). Can be combined with the other flags.
If zero is passed then the note plays a single time, and can be immediately preempted by another piezo play call. Of course, there are times you want to stop the tone without playing another one; for this use the macro piezo_stop().

The first parameter to the call is the piezo_tone structure, which looks like this:
  struct piezo_tone
  { 
    unsigned char tone;
    unsigned char man;
    unsigned char exp;
    unsigned char unused; // always set to zero
  };


Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice