# 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
    00097 #include "SFBHWPinsHost.h"
    00098
    00099 #else
    00100
    00101 #include "lpc/timer.h"
    00102
    00103 #endif
    00104
    00108 extern void delayMicroseconds(u32 usecondsToWait);
    00109
    00110 extern void delayMicrosecondsApproximate(u32 usecondsToWait);
    00111
    00115 extern void delay(u32 millissecondToWait) ;
    00116
    00120 extern void shiftOut(int dataPin, int clockPin, int bitOrder, u8 val);
    00121
    00125 extern u32 pulseIn(int pin, int state, u32 timeoutUsec = 1000000);
    00126
    00127 #endif  /* SFBWIRING_H */