Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

include/dbutton.h

Go to the documentation of this file.
00001 
00009 /*
00010  *  The contents of this file are subject to the Mozilla Public License
00011  *  Version 1.0 (the "License"); you may not use this file except in
00012  *  compliance with the License. You may obtain a copy of the License
00013  *  at http://www.mozilla.org/MPL/
00014  *
00015  *  Software distributed under the License is distributed on an "AS IS"
00016  *  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  *  the License for the specific language governing rights and
00018  *  limitations under the License.
00019  *
00020  *  The Original Code is legOS code, released October 17, 1999.
00021  *
00022  *  The Initial Developer of the Original Code is Markus L. Noga.
00023  *  Portions created by Markus L. Noga are Copyright (C) 1999
00024  *  Markus L. Noga. All Rights Reserved.
00025  *
00026  *  Contributor(s): Markus L. Noga <markus@noga.de>
00027  */
00028 
00029 #ifndef __dbutton_h__
00030 #define __dbutton_h__
00031 
00032 #ifdef  __cplusplus
00033 extern "C" {
00034 #endif
00035 
00037 //
00038 // Definitions
00039 //
00041 
00042 #define BUTTON_ONOFF    0x0002  
00043 #define BUTTON_RUN      0x0004  
00044 #define BUTTON_VIEW     0x4000  
00045 #define BUTTON_PROGRAM  0x8000  
00046 
00047 // buttons are active low
00048 //
00049 
00051 //
00052 #define RELEASED(state,button)  ((state) & (button))
00053 
00055 //
00056 #define PRESSED(state,button)   (!RELEASED(state,button))
00057 
00059 //
00060 // Functions
00061 //
00063 
00065 
00067 extern inline int dbutton(void)
00068 {
00069   int rv;
00070   __asm__ __volatile__("\n\
00071         mov.b @_PORT4,%0l\n\
00072         mov.b @_PORT7,%0h\n\
00073 "             :"=r"(rv) // output
00074               :         // input
00075               :"cc"     // clobbered
00076   );
00077 
00078   return rv;
00079 }
00080 
00081 #ifdef  __cplusplus
00082 }
00083 #endif
00084 
00085 #endif // __dbutton_h__

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

Generated on Mon Feb 16 21:01:52 2004 for brickOS C by doxygen 1.3.5