Buttons.h File Reference


Detailed Description

Defines and prototypes for Buttons.c.

Application note:
AVR064: A Temperature Monitoring System with LCD Output
Documentation:
For comprehensive code documentation, supported compilers, compiler settings and supported devices see readme.html
Author:
Atmel Corporation: http://www.atmel.com
Support email: avr@atmel.com
Name
RELEASE_1_1
Revision
1.3
RCSfile
Buttons.h,v
Date
2006/02/16 18:11:22

Definition in file Buttons.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define Button1   0x80
#define Button2   0x40
#define Button3   0x20

Functions

void CheckButtons (void)
 Check if any input from the Buttons.
void Execute (unsigned char)
 Increase or decrease a variable selected by LCD_Menu1/2.


Define Documentation

#define Button1   0x80
 

Definition at line 25 of file Buttons.h.

Referenced by CheckButtons().

#define Button2   0x40
 

Definition at line 26 of file Buttons.h.

Referenced by CheckButtons().

#define Button3   0x20
 

Definition at line 27 of file Buttons.h.


Function Documentation

void CheckButtons void   ) 
 

Check if any input from the Buttons.

Returns:
Input from user on the STK500-Buttons in global variable Buttons

Definition at line 49 of file Buttons.c.

References Button1, Button2, Buttons, Execute(), LCD_Menu1, LCD_Menu2, and LCD_Menu3.

Referenced by main().

00050 {
00051     unsigned char Temp_buttons;
00052 
00053     Temp_buttons = ~PINE;               // read PINE,
00054     Temp_buttons &= 0xE0;               // mask away other bits
00055 
00056     // if anything applied on the buttons, and that differs from the last time
00057     if(Temp_buttons && (Temp_buttons != Buttons))
00058     {
00059         Buttons = Temp_buttons; // load the temporary stored buttons to the global Buttons
00060 
00061         if(Buttons == Button1)  // if Button1 is pressed
00062         {
00063             if(LCD_Menu2)           // if LCD menu 2 is active
00064             {
00065                 if(LCD_Menu3)           // if LCD menu 3 is active
00066                     Execute(1);             // call the Exectcute function
00067                 else
00068                 {
00069                     LCD_Menu2++;        // increment LCD menu 2
00070 
00071                     if(LCD_Menu2 > 3)   // if LCD menu 2 is greater than 3
00072                         LCD_Menu2 = 1;      // set LCD menu 2 to 1
00073                 }
00074             }
00075             else
00076             {
00077                 LCD_Menu1++;        // increment LCD menu 1
00078 
00079                 if(LCD_Menu1 > 6)   // if LCD menu 1 is greater than 6
00080                     LCD_Menu1 = 1;      // set LCD menu 1 to 1
00081             }
00082         }
00083         else if(Buttons == Button2)   // if Button2 is pressed
00084         {
00085             if(LCD_Menu1)       // if LCD menu 1 is active
00086             {
00087                 if(LCD_Menu2)       // if LCD menu 2 is active
00088                 {
00089                     if(LCD_Menu3)       // if LCD menu 3 is active
00090                         Execute(0);         // call the Execute function
00091                     else
00092                         LCD_Menu3 = 1;      // activate LCD menu 3
00093                 }
00094                 else
00095                     LCD_Menu2 = 1;  // activate LCD menu 2
00096             }
00097         }
00098         else if(Buttons == Button3)   // if Button3 is pressed
00099         {
00100             if(LCD_Menu1)       // if LCD menu 1 is active
00101             {
00102                 if(LCD_Menu2)       // if LCD menu 2 is active
00103                 {
00104                     if(LCD_Menu3)       // if LCD menu 3 is active
00105                         LCD_Menu3 = 0;      // deactivate LCD menu 3
00106                     else
00107                         LCD_Menu2 = 0;      // deactivate LCD menu 2
00108                 }
00109                 else
00110                     LCD_Menu1 = 0;  // deactivate LCD menu 1
00111             }
00112         }
00113 
00114         LCDsetupData();     // set up with the new LCD menu X settings
00115     }
00116     else
00117         Buttons = Temp_buttons;     // load the input on PINE to the global Buttons
00118 }

Here is the call graph for this function:

void Execute unsigned char  Adjust  ) 
 

Increase or decrease a variable selected by LCD_Menu1/2.

Parameters:
Adjust (TRUE or FALSE)

Definition at line 125 of file Buttons.c.

References LCD_Menu1, LCD_Menu2, and SRAM_values.

Referenced by CheckButtons().

00126 {
00127     if(SRAM_values[LCD_Menu1-1][LCD_Menu2-1])      // if there is a value to adjust
00128     {
00129         if(Adjust)
00130             *SRAM_values[LCD_Menu1-1][LCD_Menu2-1] += 1; // if TRUE, then increase the variable by one
00131         else
00132             *SRAM_values[LCD_Menu1-1][LCD_Menu2-1] -= 1; // else decrease the variable by one
00133     }
00134 }


Generated on Fri Feb 17 12:28:30 2006 for AVR064: A Temperature Monitoring System with LCD Output by  doxygen 1.4.5