Main Page | Data Structures | File List | Data Fields | Globals

ATAVRBFLY_FILES/main.h File Reference


Detailed Description

Atmel Corporation

Revision
1.2
Date
Wednesday, January 26, 2005 10:43:44 UTC

Definition in file main.h.

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

Included by dependency graph

Go to the source code of this file.

Defines

#define cbi(port, bit)   (port &= ~(1<<bit))
#define sbi(port, bit)   (port |= (1<<bit))

Enumerations

enum  input {
  KEY_NULL, KEY_ENTER, KEY_NEXT, KEY_PREV,
  KEY_PLUS, KEY_MINUS
}
 Enumeration of key inputs. More...

enum  states {
  ST_AVR_IDLE = 10, ST_AVR_INIT_MODEM, ST_AVR_READY, ST_AVR_NO_ECHO,
  ST_AVR_WRONG_STORAGE, ST_AVR_WRONG_OPTION, ST_AVR_NEW_SMS, ST_AVR_NEW_SMS_function,
  ST_AVR_DELETE, ST_AVR_DELETE_function, ST_AVR_READ, ST_AVR_READ_function,
  ST_AVR_DISPLAY, ST_AVR_SEND, ST_AVR_SEND_function
}
 Enumeration of states, starting at 10. More...


Functions

char getInput (void)
void Initialization (void)
 This function setup the hardware.

unsigned char StateMachine (char state, unsigned char stimuli)
 This function controls the state machine.


Define Documentation

#define cbi port,
bit   )     (port &= ~(1<<bit))
 

Definition at line 26 of file main.h.

Referenced by Button_Init().

#define sbi port,
bit   )     (port |= (1<<bit))
 

Definition at line 25 of file main.h.


Enumeration Type Documentation

enum input
 

Enumeration of key inputs.

Enumeration values:
KEY_NULL 
KEY_ENTER 
KEY_NEXT 
KEY_PREV 
KEY_PLUS 
KEY_MINUS 

Definition at line 59 of file main.h.

Referenced by CHAR2BCD2(), CHAR2BCD3(), main(), and SetContrast().

00060 { 00061 00062 KEY_NULL, //0 00063 KEY_ENTER, //1 00064 KEY_NEXT, //2 00065 KEY_PREV, //3 00066 KEY_PLUS, //4 00067 KEY_MINUS, //5 00068 }input;

enum states
 

Enumeration of states, starting at 10.

Enumeration values:
ST_AVR_IDLE 
ST_AVR_INIT_MODEM 
ST_AVR_READY 
ST_AVR_NO_ECHO 
ST_AVR_WRONG_STORAGE 
ST_AVR_WRONG_OPTION 
ST_AVR_NEW_SMS 
ST_AVR_NEW_SMS_function 
ST_AVR_DELETE 
ST_AVR_DELETE_function 
ST_AVR_READ 
ST_AVR_READ_function 
ST_AVR_DISPLAY 
ST_AVR_SEND 
ST_AVR_SEND_function 

Definition at line 31 of file main.h.

00032 { 00033 00034 ST_AVR_IDLE = 10, //<! Idle state, before the phone is connected 00035 ST_AVR_INIT_MODEM, //<! This state will call the modem init function 00036 ST_AVR_READY, //<! Ready state, waiting for new message or key input 00037 00038 ST_AVR_NO_ECHO, //<! State to give error message to user during API_modem_init() 00039 ST_AVR_WRONG_STORAGE, //<! State to give error message to user during API_modem_init() 00040 ST_AVR_WRONG_OPTION, //<! State to give error message to user during API_modem_init() 00041 00042 ST_AVR_NEW_SMS, //<! Will display that a new message has arrived, user must push enter to read 00043 ST_AVR_NEW_SMS_function, //<! In this state the index of the new message will be extracted 00044 00045 ST_AVR_DELETE, //<! Display "DELETE MESSAGE" 00046 ST_AVR_DELETE_function, //<! Call the API_delete() function 00047 ST_AVR_READ, //<! Display "READ MESSAGE" 00048 ST_AVR_READ_function, //<! Call API_readmsg() 00049 00050 ST_AVR_DISPLAY, //<! Display new message 00051 00052 ST_AVR_SEND, //<! Dispaly "SEND SMS " 00053 ST_AVR_SEND_function //<! Call API_sendmsg 00054 }states;


Function Documentation

char getInput void   ) 
 

void Initialization void   ) 
 

This function setup the hardware.

Set up:
*PORTB
*PORTE
*Serial communication
*Buttons
*LCD

Parameters:
void 
Return values:
none 

Definition at line 206 of file main.c.

References Button_Init(), COM_init(), and LCD_Init().

Referenced by main().

00207 { 00208 00209 PORTB = (15<<PORTB0); // Enable pullup on 00210 PORTE = (15<<PORTE4); 00211 00212 COM_init( 51 ); //9600bps @ 8MHz 00213 Button_Init( ); // Initialize pin change interrupt on joystick 00214 LCD_Init( ); // initialize the LCD 00215 }

Here is the call graph for this function:

unsigned char StateMachine char  state,
unsigned char  stimuli
 

This function controls the state machine.

Parameters:
state Present state
stimuli Input from joypad
Return values:
nextstate New state of the system

Definition at line 171 of file main.c.

References MENU_NEXTSTATE::input, menu_nextstate, MENU_NEXTSTATE::nextstate, MENU_NEXTSTATE::state, and state.

Referenced by main().

00172 { 00173 00174 unsigned char nextstate = state; // Default stay in same state 00175 unsigned char i; 00176 00177 for ( i=0; menu_nextstate[i].state; i++ ) 00178 { 00179 00180 if ( ( menu_nextstate[i].state == state ) && ( menu_nextstate[i].input == stimuli ) ) 00181 { 00182 00183 // This is the one! 00184 nextstate = menu_nextstate[i].nextstate; 00185 break; 00186 } 00187 } 00188 00189 return nextstate; 00190 }


Generated on Tue Nov 1 16:21:40 2005 for AVR323 Interfacing GSM modems by doxygen 1.3.7