ui.h By Zhi-Hern Loh

Home
Design
Results
A 2nd try
Schematics
Code
Files
Links
Contact

//ui.h                  
//State machine state names
#define NoPush 		1 
#define MaybePush 	2
#define Pushed 		3
#define MaybeNoPush 	4

unsigned char PushState;
//Macros
#define Button_PORT PORTE
#define Button_DDR  DDRE
#define Button_PIN  PINE
#define T3_Ovf	    ETIFR & (1<<2)   //Overflow flag
#define T3_Ovf_Clr  ETIFR = ETIFR & ~(1<<2)
#define T3_Reset    TCNT3 = 0x00

//Button names, pin number
#define Btn_Start  (1<<0)
#define Btn_Stop   (1<<1)
#define Btn_Vol_Up (1<<2)
#define Btn_Vol_Dn (1<<3)

/*
when a button is depressed,
the button number is stored in Current_Butnum
when the button is released, New_Butnum is set.
The main program must detect that New_Butnum is set
and read Current_Butnum and reset New_Butnum
*/                           


#define Clr_Butnum New_Butnum = 0
#define Set_Butnum New_Butnum = 1    

unsigned char Current_Butnum;
unsigned char New_Butnum;           
unsigned char vol_attn_l, vol_attn_r;//DLA,DRA registers for STA013

//Prototypes
void UI_Init(void);
void debounce(void);

Home | Design | Results | A 2nd try | Schematics | Code | Files | Links | Contact

For problems or questions regarding this web contact Zhi-Hern Loh.
Last updated: 05/02/02.