- Main Page
- Modules
- Data Structures
- Files
- Directories

# e_ad_conv.c File Reference

Module for the advance Analogic/Digital conversion. More...

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

## Functions
void | e_init_ad_scan (unsigned char only_micro)
| Initialize all the A/D register needed.
void | __attribute__ ((__interrupt__, auto_psv))
| Save the AD buffer registers in differents arrays.
unsigned char | e_ad_is_acquisition_completed (void)
| To know if the ADC acquisitionn is completed.
unsigned char | e_ad_is_array_filled (void)
| To know if the ADC acquisitionn of microphone only is completed.
void | e_ad_scan_on (void)
| Enable the ADC conversion.
void | e_ad_scan_off (void)
| Disable the ADC conversion.
## Variables
int | e_mic_scan [3][MIC_SAMP_NB]
int | e_acc_scan [3][ACC_SAMP_NB]
unsigned int | e_last_mic_scan_id = 0
unsigned int | e_last_acc_scan_id = 0
int | e_ambient_ir [8]
int | e_ambient_and_reflected_ir [8]
static unsigned char | is_ad_acquisition_completed = 0
static unsigned char | is_ad_array_filled = 0
static unsigned char | micro_only = 0

## Detailed Description

Module for the advance Analogic/Digital conversion.

Author:
  Code: Francesco Mondada, Michael-Bonani & Borter Jean-Joel
  Doc: Jonathan Besuchet

## Function Documentation

void __attribute__ | ( | (__interrupt__, auto_psv) |  | ) |

Save the AD buffer registers in differents arrays.

Interrupt from timer3.

Interrupt from timer2.

Parse the chained list of agenda.
Increment counter only.
Check if agenda has to be treated according to the cycle value and current counter value.
Do it for number of cycle positive or null.
Check if a service has to be activated.

unsigned char e_ad_is_acquisition_completed | ( | void |  | ) |

To know if the ADC acquisitionn is completed.

Returns:
  0 if the new acquisition is not made, 1 if completed.

unsigned char e_ad_is_array_filled | ( | void |  | ) |

To know if the ADC acquisitionn of microphone only is completed.

Returns:
  0 if the new acquisition is not made, 1 if completed.

void e_ad_scan_off | ( | void |  | ) |

Disable the ADC conversion.

void e_ad_scan_on | ( | void |  | ) |

Enable the ADC conversion.

void e_init_ad_scan | ( | unsigned char | only_micro | ) |

Initialize all the A/D register needed.

Set up the different ADC register to process the AD conversion by scanning the used AD channels. Each value of the channels will be stored in a different AD buffer register and an inturrupt will occure at the end of the scan.

Parameters:

  | only_micro | Put MICRO_ONLY to use only the three microphones at 33kHz. Put ALL_ADC to use all the stuff using the ADC.

## Variable Documentation

int e_acc_scan[3][ACC_SAMP_NB]

Array to store the acc values

int e_ambient_and_reflected_ir[8]

Array to store the light when IR led is on

int e_ambient_ir[8]

Array to store the ambient light measurement

unsigned int e_last_acc_scan_id = 0

unsigned int e_last_mic_scan_id = 0

int e_mic_scan[3][MIC_SAMP_NB]

Array to store the mic values

unsigned char is_ad_acquisition_completed = 0`[static]`

unsigned char is_ad_array_filled = 0`[static]`

unsigned char micro_only = 0`[static]`