Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
Diff: DigitalInOut.h
- Revision:
- 27:7110ebee3484
- Parent:
- 18:b3c9f16cbb96
- Child:
- 43:e2ed12d17f06
diff -r 63bcd7ba4912 -r 7110ebee3484 DigitalInOut.h --- a/DigitalInOut.h Fri Feb 11 10:33:02 2011 +0000 +++ b/DigitalInOut.h Tue Nov 29 14:59:27 2011 +0000 @@ -1,6 +1,5 @@ /* mbed Microcontroller Library - DigitalInOut - * Copyright (c) 2006-2009 ARM Limited. All rights reserved. - * sford + * Copyright (c) 2006-2011 ARM Limited. All rights reserved. */ #ifndef MBED_DIGITALINOUT_H @@ -36,11 +35,22 @@ * 0 for logical 0 and 1 (or any other non-zero value) for logical 1 */ void write(int value) { +#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) + if(value) { _gpio->FIOSET = _mask; } else { _gpio->FIOCLR = _mask; } + +#elif defined(TARGET_LPC11U24) + + if(value) { + LPC_GPIO->SET[_index] = _mask; + } else { + LPC_GPIO->CLR[_index] = _mask; + } +#endif } /* Function: read @@ -51,7 +61,12 @@ * or read the input if set as an input */ int read() { +#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) + return ((_gpio->FIOPIN & _mask) ? 1 : 0); +#elif defined(TARGET_LPC11U24) + return ((LPC_GPIO->PIN[_index] & _mask) ? 1 : 0); +#endif } @@ -103,7 +118,13 @@ protected: PinName _pin; + +#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) LPC_GPIO_TypeDef *_gpio; +#elif defined(TARGET_LPC11U24) + int _index; +#endif + uint32_t _mask; };