swmux.h
Go to the documentation of this file.
1 
13 /*
14  * The contents of this file are subject to the Mozilla Public License
15  * Version 1.0 (the "License"); you may not use this file except in
16  * compliance with the License. You may obtain a copy of the License
17  * at http://www.mozilla.org/MPL/
18  *
19  * Software distributed under the License is distributed on an "AS IS"
20  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
21  * the License for the specific language governing rights and
22  * limitations under the License.
23  *
24  * The Original Code is legOS code, released October 17, 1999.
25  *
26  * The Initial Developer of the Original Code is Markus L. Noga.
27  * Portions created by Markus L. Noga are Copyright (C) 1999
28  * Markus L. Noga. All Rights Reserved.
29  *
30  * Contributor(s): Mark Falco (falcom@onebox.com)
31  */
32 
33 #ifndef SWMUX_H
34 #define SWMUX_H
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include <config.h>
41 #ifdef CONF_DSENSOR
42 #ifdef CONF_DSENSOR_SWMUX
43 
44 
45 
46 /*bit masks for for checking the parsed value*/
47 #define SWMUX_A_MASK 1
48 #define SWMUX_B_MASK 2
49 #define SWMUX_C_MASK 4
50 #define SWMUX_D_MASK 8
51 #define SWMUX_ERROR_MASK 16 //value not recognized
52 
53 
54 /*Takes in raw sensor values and converts into a bitfield
55  indicating the state of the attached touch sensors.
56  If there is an error interepting the raw sensor value
57  the error bit will be set, in which case the other bits
58  should be ignored. The bitfield is EDCBA, and can be examined
59  by "anding" the field with the above masks. The E in EDCBA is
60  error in case you're wondering.
61 */
62 unsigned char swmux_bits(unsigned int raw);
63 
64  //these macros will make do the anding for you
65 #define SWMUX_A(bitfield) (bitfield & SWMUX_A_MASK)
66 #define SWMUX_B(bitfield) (bitfield & SWMUX_B_MASK)
67 #define SWMUX_C(bitfield) (bitfield & SWMUX_C_MASK)
68 #define SWMUX_D(bitfield) (bitfield & SWMUX_D_MASK)
69 #define SWMUX_ERROR(bitfield) (bitfield & SWMUX_ERROR_MASK)
70 
71 #ifdef __cplusplus
72 }//extern C
73 #endif
74 
75 #endif //CONF_DSENSOR_SWMUX
76 #endif //CONF_DSENSOR
77 
78 #endif //SWMUX_H

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

Generated for brickOS C++ by doxygen 1.8.11