ads1115 only
Fork of mbed by
Diff: PortInOut.h
- Revision:
- 55:d722ed6a4237
- Parent:
- 54:71b101360fb9
- Child:
- 59:0883845fe643
--- a/PortInOut.h Tue Jan 08 12:46:36 2013 +0000 +++ b/PortInOut.h Wed Jan 16 12:56:34 2013 +0000 @@ -39,19 +39,19 @@ * * @param port Port to connect to (Port0-Port5) * @param mask A bitmask to identify which bits in the port should be included (0 - ignore) - */ + */ PortInOut(PortName port, int mask = 0xFFFFFFFF) { port_init(&_port, port, mask, PIN_INPUT); } - + /** Write the value to the output port * * @param value An integer specifying a bit to write for every corresponding port pin - */ + */ void write(int value) { port_write(&_port, value); } - + /** Read the value currently output on the port * * @returns @@ -60,19 +60,19 @@ int read() { return port_read(&_port); } - + /** Set as an output */ void output() { port_dir(&_port, PIN_OUTPUT); } - + /** Set as an input */ void input() { port_dir(&_port, PIN_INPUT); } - + /** Set the input pin mode * * @param mode PullUp, PullDown, PullNone, OpenDrain @@ -80,22 +80,22 @@ void mode(PinMode mode) { port_mode(&_port, mode); } - + /** A shorthand for write() - */ + */ PortInOut& operator= (int value) { write(value); return *this; } - + PortInOut& operator= (PortInOut& rhs) { write(rhs.read()); return *this; } - + /** A shorthand for read() */ - operator int() { + operator int() { return read(); }