fremoclock  1_3A01
FREMO Clock - Software for UTG
PushButton.h File Reference

Push button debouncing module for Atmel AVR. More...

Go to the source code of this file.

Functions

void PushButtonInit (void)
 Initialization of module. More...
 
bool PushButtonSingleShotEnter (void)
 Test if button enter is pressed. More...
 
bool PushButtonSingleShotBack (void)
 Test if button back is pressed. More...
 
bool PushButtonSingleShotUp (void)
 Test if button up is pressed. More...
 
bool PushButtonSingleShotDown (void)
 Test if button down is pressed. More...
 
uint8_t PushButtonGetUpDownValue (uint8_t ucbut, uint8_t ucmin, uint8_t ucmax)
 Get selection value by up and down button. More...
 
void PushButtonInterrupt (void)
 Called by timer interrupt every 10ms. More...
 

Detailed Description

Push button debouncing module for Atmel AVR.

Supplies debouncing for push buttons incl. autorepeat.

History:

  • 2007-02-25 ba: First implementation.
  • 2015-04-24 StS: Remove unnecessary whitespace and change to unified format
  • 2015-04-28 StS: Add Single Shot Actions (Enter, Back,...)
  • 2016-08-17 Pi: localize, bool, uint8_t, uint16_t, button_t const instead of #define where possible
Version
$Id: PushButton.h 159 2016-09-03 06:51:47Z pischky $
Author
Bernd Wisotzki

Definition in file PushButton.h.

Function Documentation

uint8_t PushButtonGetUpDownValue ( uint8_t  ucbut,
uint8_t  ucmin,
uint8_t  ucmax 
)

Get selection value by up and down button.

Parameters
ucbutcurrent value
ucminminimal allowed value
ucmaxamximal allowd value
Returns
the selected value (between ucmin and ucmax)

Definition at line 217 of file PushButton.c.

Here is the call graph for this function:

void PushButtonInit ( void  )

Initialization of module.

Call once in main after start.

Definition at line 92 of file PushButton.c.

void PushButtonInterrupt ( void  )

Called by timer interrupt every 10ms.

Runs with global interrupts disabled. Read the ports used by push buttons and increment uiButtonDebounce when pressed. Update ucButtonStatus when uiButtonDebounce reaches BUTTON_PRESSED_VALUE or BUTTON_REPEAT_VALUE.

Definition at line 292 of file PushButton.c.

Here is the call graph for this function:

bool PushButtonSingleShotBack ( void  )

Test if button back is pressed.

Returns
  • true - button was pressed
  • false - button was not pressed

Definition at line 158 of file PushButton.c.

Here is the call graph for this function:

bool PushButtonSingleShotDown ( void  )

Test if button down is pressed.

Returns
  • true - button was pressed
  • false - button was not pressed

Definition at line 180 of file PushButton.c.

Here is the call graph for this function:

bool PushButtonSingleShotEnter ( void  )

Test if button enter is pressed.

Returns
  • true - button was pressed
  • false - button was not pressed

Definition at line 147 of file PushButton.c.

Here is the call graph for this function:

bool PushButtonSingleShotUp ( void  )

Test if button up is pressed.

Returns
  • true - button was pressed
  • false - button was not pressed

Definition at line 169 of file PushButton.c.

Here is the call graph for this function: