Friedrich-Alexander-Universität UnivisSuche FAU-Logo
Techn. Fakultät Willkommen am Department Informatik FAU-Logo
Logo I4
Lehrstuhl für Informatik 4
GSPiC
 
  Vorlesung
    - UnivIS-Infos
    - Inhalt
    - Folien
 
  Übungen
    - UnivIS-Infos
    - Inhalt
    - Ergänzendes Material
    - Aufgaben
    - libspicboard-Doku
    - FSI-Forum für Fragen
 
  Prüfung
 
  Evaluation
 
  Intern
Department Informatik  >  Informatik 4  >  Lehre  >  SS 2010  >  GSPiC  >  Übungen  >  Doku  >  libspicboard: Button

SPiCboard library (libspicboard, revision 3032) API documentation

Found a bug or something ambiguous? Mail us to get it fixed!

Button


Files

file  button.h
 The button module enables event-driven and polling access to the buttons of the SPiCboard.

Typedefs

typedef void(* buttoncallback_t )(BUTTON, BUTTONEVENT)
 Type for button event callback functions.

Enumerations

enum  BUTTON { BUTTON0 = 4, BUTTON1 = 8 }
 Identifiers for all available buttons. More...
enum  BUTTONEVENT { BTNPRESSED = 1, BTNRELEASED = 2 }
 Events for buttons. More...

Functions

int8_t sb_button_registerListener (BUTTON btn, BUTTONEVENT eve, buttoncallback_t callback)
 Register a callback function for a button event.
int8_t sb_button_unregisterListener (BUTTON btn, BUTTONEVENT eve, buttoncallback_t callback)
 Unregister a callback function for a button event.
BUTTONEVENT sb_button_getState (BUTTON btn)
 Query the current state of a button.

Typedef Documentation

typedef void(* buttoncallback_t)(BUTTON, BUTTONEVENT)

Type for button event callback functions.

A button callback function is called on the interrupt level whenever an event at a button occurs that the function was registered for. The callback function is passed the button id and the type of event that occurred. This way, the same callback function can be registered for different buttons and events.


Enumeration Type Documentation

enum BUTTON

Identifiers for all available buttons.

Enumerator:
BUTTON0  Button 0
BUTTON1  Button 1

Events for buttons.

Pressed and released events for buttons.

Enumerator:
BTNPRESSED  Button was pressed
BTNRELEASED  Button was released


Function Documentation

BUTTONEVENT sb_button_getState ( BUTTON  btn  ) 

Query the current state of a button.

Parameters:
btn id of the button
Returns:
The buttons current state (pressed or released) as a BUTTONEVENT

int8_t sb_button_registerListener ( BUTTON  btn,
BUTTONEVENT  eve,
buttoncallback_t  callback 
)

Register a callback function for a button event.

Parameters:
btn the id of the button
eve the type of event that the callback function should be invoked for. event types can be bitwise or'd to register a callback for both pressed and released events.
callback pointer to the callback function. This function is called from the interrupt handler.
Return values:
0 success,
!0 error
See also:
sb_button_unregisterListener

buttoncallback_t

int8_t sb_button_unregisterListener ( BUTTON  btn,
BUTTONEVENT  eve,
buttoncallback_t  callback 
)

Unregister a callback function for a button event.

Parameters:
btn the id of the button
eve the type of event that the callback function should be invoked for. event types can be bitwise or'd to register a callback for both pressed and released events.
callback pointer to the callback function
Returns:
0 on success, negative value on error
Return values:
0 success
-1 the callback function was not registered with the given button/event combination
See also:
sb_button_registerListener

  Impressum   Datenschutz Stand: 2010-07-02 13:45   MS