Main Page | File List | Globals

robotsound.h File Reference

#include <avr/io.h>
#include <avr/signal.h>
#include <avr/pgmspace.h>
#include "basic.h"

Go to the source code of this file.

Defines

#define START_BEEP(nbeeps)   start_sound(beeps+40-4*nbeeps,0)
 starts the beeping of nbeeps sounds. nbeeps should not be greater than 10


Functions

void play (u16 Hz)
 Plays a tone in Herz The tone in Herz. 0-17 for switching off.

void playt (u08 tone)
 Plays a tone described in start_sound(u08 *soundtostart, u08 override).

int playi ()
 This function is called from SIGNAL(SIG_OVERFLOW0).

int start_sound (u08 *soundtostart, u08 override)
 With this function you can enable a sound (melodie). The sound bites are in program memory and have the following structure:.


Variables

u08 __ATTR_PROGMEM__ start_up []
u08 __ATTR_PROGMEM__ go_sleep []
u08 __ATTR_PROGMEM__ wake_up []
u08 __ATTR_PROGMEM__ go_hungry []
u08 __ATTR_PROGMEM__ go_empty []
u08 __ATTR_PROGMEM__ snore []
u08 __ATTR_PROGMEM__ beeps []
u08 __ATTR_PROGMEM__ get_connected []
u08 soundplaying
 if the sound is playing this variable is set to 1


Detailed Description

Definition in file robotsound.h.


Function Documentation

void play u16  Hz  ) 
 

Plays a tone in Herz The tone in Herz. 0-17 for switching off.

This function should not be invoced directly (just for testing purposes) because it overrides the normal sound and doesn't stop brawling.

Parameters:
Hz 

Definition at line 32 of file robotsound.c.

Referenced by playt().

int playi  ) 
 

This function is called from SIGNAL(SIG_OVERFLOW0).

Here the sound is playied. It is called every 16,3ms which is the fastest Tick in a sound.

Definition at line 78 of file robotsound.c.

Referenced by SIGNAL().

int start_sound u08 soundtostart,
u08  override
 

With this function you can enable a sound (melodie). The sound bites are in program memory and have the following structure:.

[ticks, tone],[ticks,tone],...[0, 0].

One tick is about 16ms and by setting tone to 0 you can make a pause. The tones start at a C [33Hz] and go up 7 octaves. tone = 60 is the standart pitch 440Hz max is 83. a value of 85 plaies rising tones. and 86 does the same downwards.

Parameters:
soundtostart A pointer to the sound which is ended by 0,0
override Set this to one if the sound should replace a playing sound.

Definition at line 95 of file robotsound.c.

Referenced by do_boredom(), do_sleep(), and main().


Generated on Wed Feb 2 20:03:50 2005 for Robot by doxygen 1.3.6