e_micro.c File Reference

Accessing the microphone data. More...

#include "p30f6014A.h"
#include "e_ad_conv.h"
#include "../../motor_led/e_epuck_ports.h"

Functions

int e_get_micro (unsigned int micro_id)
 Get the last value of a given micro.
int e_get_micro_average (unsigned int micro_id, unsigned int filter_size)
 Get the average on a given number of sample from a micro.
int e_get_micro_volume (unsigned int micro_id)
 Get the difference between the highest and lowest sample.
void e_get_micro_last_values (int micro_id, int *result, unsigned samples_nb)
 Write to a given array, the last values of one micro.

Variables

int e_mic_scan [3][MIC_SAMP_NB]
unsigned int e_last_mic_scan_id


Detailed Description

Accessing the microphone data.

The functions of this file are made to deal with the microphones data. You can simply get the current value of a given microphone. You can know the volume of noise that the e-puck is enduring. You can average the signal with a specified size.

Author:
Code: Borter Jean-Joel
Doc: Jonathan Besuchet

Function Documentation

int e_get_micro ( unsigned int  micro_id  ) 

Get the last value of a given micro.

Parameters:
micro_id micro's ID (0, 1, or 2) (use MIC0_BUFFER, MIC1_BUFFER , MIC2_BUFFER defined in e_micro.h)
Returns:
result last value of the micro

int e_get_micro_average ( unsigned int  micro_id,
unsigned int  filter_size 
)

Get the average on a given number of sample from a micro.

Parameters:
micro_id micro's ID (0, 1, or 2) (use MIC0_BUFFER, MIC1_BUFFER , MIC2_BUFFER defined in e_micro.h)
filter_size number of sample to average
Returns:
result last value of the micro

void e_get_micro_last_values ( int  micro_id,
int *  result,
unsigned  samples_nb 
)

Write to a given array, the last values of one micro.

Write to a given array, the last values of one micro. The values are stored with the last one first, and the older one at the end of the array.
[ t ][ t-1 ][ t-2 ][ t-3 ]...[ t-(samples_nb-1) ][ t-samples_nb ]

Parameters:
micro_id micro's ID (0, 1, or 2) (use MIC0_BUFFER, MIC1_BUFFER , MIC2_BUFFER defined in e_micro.h)
*result pointer on the result array
samples_nb size of the result array (must be between 1 and MIC_SAMP_NB)

int e_get_micro_volume ( unsigned int  micro_id  ) 

Get the difference between the highest and lowest sample.

Parameters:
micro_id micro's ID (0, 1, or 2) (use MIC0_BUFFER, MIC1_BUFFER , MIC2_BUFFER defined in e_micro.h)
Returns:
result volume


Variable Documentation

unsigned int e_last_mic_scan_id

int e_mic_scan[3][MIC_SAMP_NB]

Array to store the mic values


Generated on Fri Feb 29 14:26:53 2008 for e-puck by  doxygen 1.5.4