00001 00013 /* 00014 * The contents of this file are subject to the Mozilla Public License 00015 * Version 1.0 (the "License"); you may not use this file except in 00016 * compliance with the License. You may obtain a copy of the License 00017 * at http://www.mozilla.org/MPL/ 00018 * 00019 * Software distributed under the License is distributed on an "AS IS" 00020 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00021 * the License for the specific language governing rights and 00022 * limitations under the License. 00023 * 00024 * The Original Code is legOS code, released October 17, 1999. 00025 * 00026 * The Initial Developer of the Original Code is Markus L. Noga. 00027 * Portions created by Markus L. Noga are Copyright (C) 1999 00028 * Markus L. Noga. All Rights Reserved. 00029 * 00030 * Contributor(s): Mark Falco (falcom@onebox.com) 00031 */ 00032 00033 #ifndef SWMUX_H 00034 #define SWMUX_H 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 #include <config.h> 00041 #ifdef CONF_DSENSOR 00042 #ifdef CONF_DSENSOR_SWMUX 00043 00044 00045 00046 /*bit masks for for checking the parsed value*/ 00047 #define SWMUX_A_MASK 1 00048 #define SWMUX_B_MASK 2 00049 #define SWMUX_C_MASK 4 00050 #define SWMUX_D_MASK 8 00051 #define SWMUX_ERROR_MASK 16 //value not recognized 00052 00053 00054 /*Takes in raw sensor values and converts into a bitfield 00055 indicating the state of the attached touch sensors. 00056 If there is an error interepting the raw sensor value 00057 the error bit will be set, in which case the other bits 00058 should be ignored. The bitfield is EDCBA, and can be examined 00059 by "anding" the field with the above masks. The E in EDCBA is 00060 error in case you're wondering. 00061 */ 00062 unsigned char swmux_bits(unsigned int raw); 00063 00064 //these macros will make do the anding for you 00065 #define SWMUX_A(bitfield) (bitfield & SWMUX_A_MASK) 00066 #define SWMUX_B(bitfield) (bitfield & SWMUX_B_MASK) 00067 #define SWMUX_C(bitfield) (bitfield & SWMUX_C_MASK) 00068 #define SWMUX_D(bitfield) (bitfield & SWMUX_D_MASK) 00069 #define SWMUX_ERROR(bitfield) (bitfield & SWMUX_ERROR_MASK) 00070 00071 #ifdef __cplusplus 00072 }//extern C 00073 #endif 00074 00075 #endif //CONF_DSENSOR_SWMUX 00076 #endif //CONF_DSENSOR 00077 00078 #endif //SWMUX_H
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |