webradio/buttons.h File Reference


Detailed Description

Simple button interface header.

 *
 * $Log$
 *
 * 

Definition in file buttons.h.

Go to the source code of this file.

Defines

#define KEYCODE_UP   'U'
 Key code of the UP button.
#define KEYCODE_DOWN   'D'
 Key code of the DOWN button.
#define KEYCODE_SELECT   'S'
 Key code of the SELECT button.

Functions

void ButtonInit (void)
 Initialize the button interface.
char ButtonRead (u_long tmo)
 Wait until the user pressed a button.


Define Documentation

#define KEYCODE_UP   'U'

Key code of the UP button.

This code is returned by ButtonRead(), if the user presses the right button.

Definition at line 54 of file buttons.h.

Referenced by ButtonRead(), UserIfMainMenu(), and UserIfThread().

#define KEYCODE_DOWN   'D'

Key code of the DOWN button.

This code is returned by ButtonRead(), if the user presses the left button.

Definition at line 61 of file buttons.h.

Referenced by ButtonRead(), UserIfMainMenu(), and UserIfThread().

#define KEYCODE_SELECT   'S'

Key code of the SELECT button.

This code is returned by ButtonRead(), if the user presses the middle button.

Definition at line 68 of file buttons.h.

Referenced by ButtonRead(), UserIfMainMenu(), and UserIfThread().


Function Documentation

void ButtonInit ( void   ) 

Initialize the button interface.

Configures and starts a continously running timer interrupt, which scans three GPIO lines. A low level on any line indicates, that the related button has been pressed by the user.

The application must call ButtonRead() to read the code of a pressed button.

Definition at line 336 of file buttons.c.

References BTN_DOWN, BTN_PIO_ID, BTN_PIO_OD_REG, BTN_PIO_PE_REG, BTN_PIO_PUE_REG, BTN_SCAN_FREQ, BTN_SELECT, BTN_TC_CC_REG, BTN_TC_CM_REG, BTN_TC_ID, BTN_TC_ID_REG, BTN_TC_IE_REG, BTN_TC_RC_REG, BTN_TC_S_REG, BTN_UP, ScanTimerInterrupt(), and sig_BTN_TC.

Here is the call graph for this function:

ScanTimerInterrupt

char ButtonRead ( u_long  tmo  ) 

Wait until the user pressed a button.

This routine will not handle concurrently pressed buttons, but return the button with the highest priority. SELECT has the highest and UP has the lowest priority.

Parameters:
tmo Maximum number of milliseconds to wait.
Returns:
Key code of the button, either KEYCODE_SELECT, KEYCODE_DOWN or KEYCODE_UP. If no button had been pressed within the given time, then zero is returned.

Definition at line 394 of file buttons.c.

References BTN_DOWN, btn_pressed, btn_que, BTN_SELECT, BTN_UP, KEYCODE_DOWN, KEYCODE_SELECT, and KEYCODE_UP.


© 2008 by egnite GmbH - visit www.ethernut.de