USBKEY Module

Collaboration diagram for USBKEY Module:

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


Modules

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

Defines

#define ADC_TEMP_CH   0x00
 this define is set in config.h file

Functions

U16 Get_adc_temp_val (void)
 This function performs an ADC conversion from the USB KEY TEMP channel an returns the 10 bits result in an U16 value.
S16 Read_temperature (void)
 This function performs an ADC conversion from the USB KEY TEMP channel an returns the 10 bits result of the temperature (in °C) in an S16 value.

Detailed Description

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

avrusbkey.gif

Define Documentation

#define ADC_TEMP_CH   0x00
 

this define is set in config.h file

Definition at line 80 of file usb_key.h.


Function Documentation

U16 Get_adc_temp_val void   ) 
 

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

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.

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

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

S16 Read_temperature void   ) 
 

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

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.

References Get_adc_temp_val(), and temperature_code.

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 }

Here is the call graph for this function:


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