Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed by
Diff: DigitalInOut.h
- Revision:
- 27:7110ebee3484
- Parent:
- 18:b3c9f16cbb96
- Child:
- 43:e2ed12d17f06
--- 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; };