This will become a hardware abstraction layer for my mbed projects. It will make it easier to port sketches from Arduino to mbed

Dependents:   Potentiometer

Arduino.c

Committer:
rbohne
Date:
2011-06-04
Revision:
4:40396527a068
Parent:
0:a4ee09d0d765

File content as of revision 4:40396527a068:

#include "Arduino.h"
#include "mbed.h"



static DigitalInOut allpins[] = {LED1, LED2, LED3, LED4, NC, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30};

void digitalWrite(int pin, int value) 
{
    //allpins[pin].output();
    allpins[pin].write(value);
}

void pinMode(int pin, int mode) 
{
    if(mode == INPUT)
    {
        allpins[pin].input();
    }
    if(mode == OUTPUT)
    {
        allpins[pin].output();
    }    
   
}

int digitalRead(int pin)
{
    //allpins[pin].input();
    return allpins[pin].read();
}