Digital InOut
Revision 1:b4bc3430a055, committed 2014-09-27
- Comitter:
- kiran_mbed
- Date:
- Sat Sep 27 18:42:42 2014 +0000
- Parent:
- 0:b2ebb454185a
- Commit message:
- Recent;
Changed in this revision
Digital_InOut.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r b2ebb454185a -r b4bc3430a055 Digital_InOut.h --- a/Digital_InOut.h Thu Jun 12 03:00:34 2014 +0000 +++ b/Digital_InOut.h Sat Sep 27 18:42:42 2014 +0000 @@ -30,8 +30,8 @@ */ -#ifndef DIGITAL_IN_H - #define DIGITAL_IN_H +#ifndef DIGITAL_INOUT_H + #define DIGITAL_INOUT_H #include "mbed.h" @@ -227,6 +227,8 @@ }; #endif /* Pin_Name */ + #ifndef _PIN_MODE_ + #define _PIN_MODE_ enum Pin_Mode { pull_up = 0, @@ -234,12 +236,16 @@ neither = 2, repeater = 3 }; + #endif /* _PIN_MODE_ */ + #ifndef _PIN_DIRECTION_ + #define _PIN_DIRECTION_ enum Pin_Direction { input = 0, output = 1 }; + #endif/* _PIN_DIRECTION_ */ class Digital_InOut { @@ -330,7 +336,8 @@ int read() { - return ((*(uint32_t*)(_FIOPIN_BASE +_pin.port*0x20) & (1 << _pin.pin)) >> _pin.pin); //Read + int FIOPINvalue = *(uint32_t*)(_FIOPIN_BASE +_pin.port*0x20); + return ((FIOPINvalue & (1 << _pin.pin)) >> _pin.pin); } void write(int value) @@ -387,4 +394,4 @@ } }; -#endif /* DIGITAL_IN_H */ \ No newline at end of file +#endif /* DIGITAL_INOUT_H */ \ No newline at end of file