-ne button.h Source File
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
    - Inhalt
    - Ergänzendes Material
    - Aufgaben
    - UnivIS-Infos
    - libspicboard-Doku
    - FSI-Forum für Fragen
 
  Prüfung
 
  Evaluation
 
  Intern
Department Informatik  >  Informatik 4  >  Lehre  >  SS 2014  >  GSPiC  >  Übungen  >  Doku  >  button.h Source File

SPiCboard library (libspicboard, revision exportiert) API documentation

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

button.h
Go to the documentation of this file.
1 #ifndef BUTTON_H
2 #define BUTTON_H
3 
4 #include <stdint.h>
5 
6 
7 /**
8 
9  *
10  * \addtogroup Button
11  *
12  * \brief The button module enables event-driven and polling access
13  * to the buttons of the SPiCboard.
14  *
15  * The SPiCboard is equipped with two buttons. Button 0 is debounced in
16  * hardware, whereas Button 1 needs to be debounced in software by the
17  * button module. Debouncing is transparent to the application, that
18  * can use both buttons through the provided interface without the
19  * need to care about debouncing.
20  *
21  * The debouncing code makes use of the timer module. When no listeners
22  * are registered for Button 1, the debouncing code is disabled and all
23  * alarms registered at the timer should be canceled.
24  *
25  * The button module uses dynamic memory management to maintain the
26  * listener queues.
27  *
28  * @{
29  * \file button.h
30  * \version \$Rev$
31  */
32 
33 /**
34  * \brief Identifiers for all available buttons.
35  *
36  */
37 typedef enum {
38  BUTTON0 = 4, /**< Button 0 */
39  BUTTON1 = 8 /**< Button 1 */
40 } BUTTON;
41 
42 /**
43  * \brief Events for buttons.
44  *
45  * Pressed and released events for buttons.
46  */
47 typedef enum {
48  BTNPRESSED = 1, /**< Button was pressed */
49  BTNRELEASED = 2 /**< Button was released */
50 } BUTTONEVENT;
51 
52 /**
53  * \brief Type for button event callback functions.
54  *
55  * A button callback function is called on the interrupt level whenever
56  * an event at a button occurs that the function was registered for.
57  * The callback function is passed the button id and the type of event
58  * that occurred. This way, the same callback function can be registered
59  * for different buttons and events.
60  */
61 typedef void (*buttoncallback_t) (BUTTON, BUTTONEVENT);
62 
63 /**
64  * \brief Register a callback function for a button event.
65  *
66  * \param btn the id of the button
67  * \param eve the type of event that the callback function should be invoked for.
68  * event types can be bitwise or'd to register a callback for both
69  * pressed and released events.
70  * \param callback pointer to the callback function. This function is called from the
71  * interrupt handler.
72  * \retval 0 success,
73  * \retval !0 error
74  * \sa sb_button_unregisterListener
75  * \sa buttoncallback_t
76  */
78 
79 /**
80  * \brief Unregister a callback function for a button event.
81  *
82  *
83  * \param btn the id of the button
84  * \param eve the type of event that the callback function should be invoked for.
85  * event types can be bitwise or'd to register a callback for both
86  * pressed and released events.
87  * \param callback pointer to the callback function
88  * \return 0 on success, negative value on error
89  * \retval 0 success
90  * \retval -1 the callback function was not registered with the given button/event combination
91  * \sa sb_button_registerListener
92  *
93  */
95 
96 /**
97  * \brief Query the current state of a button.
98  *
99  * \param btn id of the button
100  * \return The buttons current state (pressed or released) as a \ref BUTTONEVENT
101  */
103 
104 /** @}*/
105 
106 #endif
107 
  Impressum   Datenschutz Stand: 2014-05-23 19:23   MS