SFBWiring.h

Go to the documentation of this file.
00001 /*                                             -*- mode:C++; fill-column:100 -*-
00002   SFBWiring.h - The 'Arduinoesque API' provided by the SFB.
00003   Copyright (C) 2008 The Regents of the University of New Mexico.  All rights reserved.
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014 
00015   You should have received a copy of the GNU General Public License
00016   along with this library; if not, write to the Free Software
00017   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
00018   USA
00019 
00020   $Id$
00021 */
00022 
00029 #ifndef SFBWIRING_H
00030 #define SFBWIRING_H
00031 
00032 #include "SFBTypes.h"
00033 #include "SFBConstants.h"
00034 #include "SFBPins.h"
00035 
00046 extern void digitalWrite(int sfbPin, int value);
00047 
00053 extern int digitalRead(int sfbPin);
00054 
00060 inline void ledOn(int sfbPin) { digitalWrite(sfbPin,LOW); }
00061 
00066 inline void ledOff(int sfbPin) { digitalWrite(sfbPin,HIGH); }
00071 inline void ledSet(int sfbPin,bool on) { digitalWrite(sfbPin,on?LOW:HIGH); }
00072 
00078 inline bool ledIsOn(int sfbPin) { return digitalRead(sfbPin)==LOW; }
00079 
00084 void ledToggle(int sfbPin) ;
00085 
00091 static inline bool buttonDown() { return digitalRead(BODY_SWITCH0_PIN)==LOW; }
00092 extern bool buttonDown();
00093 
00098 extern void pinMode(int sfbPin, int mode);
00099 
00119 extern u32 isPinMode(int sfbPin, int mode);
00120 
00121 #ifdef HOST_MODE
00122 
00123 #include "SFBHWPinsHost.h"
00124 
00125 #else
00126 
00127 #include "lpc/timer.h"
00128 
00129 #endif
00130 
00137 extern void delayMicroseconds(u32 usecondsToWait);
00138 
00145 extern void delayMicrosecondsApproximate(u32 usecondsToWait);
00146 
00154 extern void delay(u32 millissecondToWait) ;
00155 
00159 extern void shiftOut(int dataPin, int clockPin, int bitOrder, u8 val);
00160 
00164 extern u32 pulseIn(int pin, int state, u32 timeoutUsec = 1000000);
00165 
00166 #endif  /* SFBWIRING_H */

Generated on Fri Apr 22 06:54:12 2011 for SFB by doxygen 1.5.9