dbutton.h
Go to the documentation of this file.
1 
9 /*
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License
13  * at http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and
18  * limitations under the License.
19  *
20  * The Original Code is legOS code, released October 17, 1999.
21  *
22  * The Initial Developer of the Original Code is Markus L. Noga.
23  * Portions created by Markus L. Noga are Copyright (C) 1999
24  * Markus L. Noga. All Rights Reserved.
25  *
26  * Contributor(s): Markus L. Noga <markus@noga.de>
27  */
28 
29 #ifndef __dbutton_h__
30 #define __dbutton_h__
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
37 //
38 // Definitions
39 //
41 
42 #define BUTTON_ONOFF 0x0002
43 #define BUTTON_RUN 0x0004
44 #define BUTTON_VIEW 0x4000
45 #define BUTTON_PROGRAM 0x8000
46 
47 // buttons are active low
48 //
49 
51 //
52 #define RELEASED(state,button) ((state) & (button))
53 
55 //
56 #define PRESSED(state,button) (!RELEASED(state,button))
57 
59 //
60 // Functions
61 //
63 
65 
67 extern inline int dbutton(void)
68 {
69  int rv;
70  __asm__ __volatile__("\n\
71  mov.b @_PORT4,%0l\n\
72  mov.b @_PORT7,%0h\n\
73 " :"=r"(rv) // output
74  : // input
75  :"cc" // clobbered
76  );
77 
78  return rv;
79 }
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif // __dbutton_h__
int dbutton(void)
get button states
Definition: dbutton.h:67

brickOS is released under the Mozilla Public License.
Original code copyright 1998-2005 by the authors.

Generated for brickOS C by doxygen 1.8.9.1