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 
00041 extern void digitalWrite(int sfbPin, int value);
00042 
00048 extern int digitalRead(int sfbPin);
00049 
00055 inline void ledOn(int sfbPin) { digitalWrite(sfbPin,LOW); }
00056 
00061 inline void ledOff(int sfbPin) { digitalWrite(sfbPin,HIGH); }
00066 inline void ledSet(int sfbPin,bool on) { digitalWrite(sfbPin,on?LOW:HIGH); }
00067 
00073 inline bool ledIsOn(int sfbPin) { return digitalRead(sfbPin)==LOW; }
00074 
00079 void ledToggle(int sfbPin) ;
00080 
00086 static inline bool buttonDown() { return digitalRead(BODY_SWITCH0_PIN)==LOW; }
00087 extern bool buttonDown();
00088 
00093 extern void pinMode(int sfbPin, int mode);
00094 
00095 #ifdef HOST_MODE
00096 
00101 extern u32 micros();
00102 
00107 extern u32 millis();
00108 
00114 extern u64 microseconds();
00115 
00121 extern u32 milliseconds();
00122 
00127 extern u32 seconds();
00128 
00129 #else
00130 
00131 #include "lpc/timer.h"
00132 
00133 #endif
00134 
00138 extern void delayMicroseconds(u32 usecondsToWait);
00139 
00140 extern void delayMicrosecondsApproximate(u32 usecondsToWait);
00141 
00145 extern void delay(u32 millissecondToWait) ;
00146 
00150 extern void shiftOut(int dataPin, int clockPin, int bitOrder, u8 val);
00151 
00155 extern u32 pulseIn(int pin, int state, u32 timeoutUsec = 1000000);
00156 
00157 #endif  /* SFBWIRING_H */

Generated on Thu Sep 17 07:37:51 2009 for SFB by doxygen 1.5.9