mbed libraries for KL25Z
Diff: PortInOut.h
- Revision:
- 7:73c5efe92a6c
- Parent:
- 2:e9a661555b58
- Child:
- 8:c14af7958ef5
--- a/PortInOut.h Fri Oct 12 10:06:08 2012 +0000 +++ b/PortInOut.h Tue Oct 23 09:20:18 2012 +0000 @@ -1,7 +1,6 @@ /* mbed Microcontroller Library - PortInOut * Copyright (c) 2006-2011 ARM Limited. All rights reserved. - */ - + */ #ifndef MBED_PORTINOUT_H #define MBED_PORTINOUT_H @@ -9,8 +8,10 @@ #if DEVICE_PORTINOUT -#include "PortNames.h" -#include "PinNames.h" +#include "port_api.h" + +#include "platform.h" +#include "Base.h" namespace mbed { @@ -19,7 +20,6 @@ */ class PortInOut { public: - /* Constructor: PortInOut * Create an PortInOut, connected to the specified port * @@ -28,7 +28,7 @@ * mask - A bitmask to identify which bits in the port should be included (0 - ignore) */ PortInOut(PortName port, int mask = 0xFFFFFFFF); - + /* Function: write * Write the value to the output port * @@ -36,7 +36,7 @@ * value - An integer specifying a bit to write for every corresponding port pin */ void write(int value); - + /* Function: read * Read the value currently output on the port * @@ -44,17 +44,17 @@ * returns - An integer with each bit corresponding to associated port pin setting */ int read(); - + /* Function: output * Set as an output */ void output(); - + /* Function: input * Set as an input */ void input(); - + /* Function: mode * Set the input pin mode * @@ -62,16 +62,16 @@ * mode - PullUp, PullDown, PullNone, OpenDrain */ void mode(PinMode mode); - + /* Function: operator= * A shorthand for <write> */ - PortInOut& operator= (int value) { + PortInOut& operator= (int value) { write(value); return *this; } - PortInOut& operator= (PortInOut& rhs) { + PortInOut& operator= (PortInOut& rhs) { write(rhs.read()); return *this; } @@ -84,11 +84,7 @@ } private: -#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) - LPC_GPIO_TypeDef *_gpio; -#endif - PortName _port; - uint32_t _mask; + port_object _port; }; } // namespace mbed