STK525 Module

Collaboration diagram for STK525 Module:

This module contains low level hardware abstraction layer for STK525 board. More...


Modules

 Leds Management
 Macros to manage Leds on STK525.
 Joystick Management
 Macros to manage Joystick on STK525.
 HWB button management
 HWB button is connected to PE2 and can also be used as generic push button.
 ATMEL Hardware data flash configuration
 Macros to init the environnement for DF on STK525.

Defines

#define ADC_POT_CH   0x01
 STK 525 ADC Potentiometer Channel Definition.
#define ADC_MIC_CH   0x02
#define ADC_TEMP_CH   0x00
 this define is set in config.h file

Functions

U16 Get_adc_mic_val (void)
 Get_adc_mic_val.
U16 Get_adc_temp_val (void)
 Get_adc_temp_val.
U16 Get_adc_pot_val (void)
 Get_adc_pot_val.
S16 Read_temperature (void)
 Read_temperature.

Detailed Description

This module contains low level hardware abstraction layer for STK525 board.

stk525.gif

Define Documentation

#define ADC_POT_CH   0x01
 

STK 525 ADC Potentiometer Channel Definition.

Definition at line 77 of file stk_525.h.

Referenced by Get_adc_pot_val().

#define ADC_MIC_CH   0x02
 

Definition at line 78 of file stk_525.h.

Referenced by Get_adc_mic_val().

#define ADC_TEMP_CH   0x00
 

this define is set in config.h file

Definition at line 79 of file stk_525.h.

Referenced by Get_adc_temp_val().


Function Documentation

U16 Get_adc_mic_val void   ) 
 

Get_adc_mic_val.

This function performs an ADC conversion from the stk525 MIC channel an returns the 10 bits result in an U16 value.

Warning:
USE_ADC should be defined in config.h
Parameters:
none 
Returns:
U16 microphone sample value.

Definition at line 50 of file stk_525.c.

References ADC_MIC_CH, ADCH, ADCL, Is_adc_conv_finished, and Start_conv_channel.

00051 {
00052    Start_conv_channel(ADC_MIC_CH);
00053    while (!Is_adc_conv_finished());
00054    return (U16)(ADCL+((U16)(ADCH<<8)));
00055 }

U16 Get_adc_temp_val void   ) 
 

Get_adc_temp_val.

This function performs an ADC conversion from the stk525 TEMP channel an returns the 10 bits result in an U16 value.

Warning:
USE_ADC should be defined in config.h
Parameters:
none 
Returns:
U16 analog sensor temperature value.

Definition at line 64 of file stk_525.c.

00065 {
00066    Start_conv_channel(ADC_TEMP_CH);
00067    while (!Is_adc_conv_finished());
00068    return (U16)(ADCL+((U16)(ADCH<<8)));
00069 }

U16 Get_adc_pot_val void   ) 
 

Get_adc_pot_val.

This function performs an ADC conversion from the stk525 POT channel an returns the 10 bits result in an U16 value.

Warning:
USE_ADC should be defined in config.h
Parameters:
none 
Returns:
U16 analog potentiometer value.

Definition at line 57 of file stk_525.c.

References ADC_POT_CH, ADCH, ADCL, Is_adc_conv_finished, and Start_conv_channel.

Referenced by hid_task().

00058 {
00059    Start_conv_channel(ADC_POT_CH);
00060    while (!Is_adc_conv_finished());
00061    return (U16)(ADCL+((U16)(ADCH<<8)));
00062 }

S16 Read_temperature void   ) 
 

Read_temperature.

This function performs an ADC conversion from the stk525 POT channel an returns the 10 bits result of the temperature (in °C) in an S16 value.

Warning:
USE_ADC should be defined in config.h
Parameters:
none 
Returns:
S16 temperature value in °C.

Definition at line 71 of file stk_525.c.

00072 {
00073 #ifndef AVRGCC
00074    U16 adc_code;
00075    S8 index=0;
00076    adc_code=Get_adc_temp_val();
00077    if(adc_code>temperature_code[0])
00078    {
00079       return (S16)(-20);
00080    }
00081    else
00082    {
00083       while(temperature_code[index++]>adc_code);
00084       return (S16)(index-1-20);
00085    }
00086 #else
00087    U16 adc_code;
00088    S8 index=0;
00089    adc_code=Get_adc_temp_val();
00090    if(adc_code>pgm_read_word_near(&temperature_code))
00091    {
00092       return (S16)(-20);
00093    }
00094    else
00095    {
00096       while(pgm_read_word_near(&temperature_code[index++])>adc_code);
00097       return (S16)(index-1-20);
00098    }   
00099 
00100 #endif
00101 }


Generated on Fri Mar 17 16:02:11 2006 for Atmel by  doxygen 1.4.6-NO