Fork of the official mbed C/C++ SDK provides the software platform and libraries to build your applications. The fork has the documentation converted to Doxygen format

Dependents:   NervousPuppySprintOne NervousPuppySprint2602 Robot WarehouseBot1 ... more

Fork of mbed by mbed official

DigitalOut.h

Committer:
simon.ford@mbed.co.uk
Date:
2009-01-22
Revision:
5:62573be585e9
Parent:
4:5d1359a283bc
Child:
11:1c1ebd0324fa

File content as of revision 5:62573be585e9:

/* mbed Microcontroller Library - DigitalOut
 * Copyright (c) 2007-2008, sford
 */
 
#ifndef MBED_DIGITALOUT_H
#define MBED_DIGITALOUT_H

#include "Base.h"
#include "LPC2300.h"

namespace mbed {

/* Class: DigitalOut
 *  A digital output, used for setting the state of a pin
 */
class DigitalOut : public Base {

public:

	/* Group: Configuration Methods */
	
	/* Constructor: DigitalOut
	 *  Create a DigitalOut connected to the specified pin
	 *
	 * Variables:
	 *  pin - DigitalOut pin to connect to (5-30)
	 */
	DigitalOut(int pin, const char* name = NULL);

	/* Group: Access Methods */
		
	/* Function: write
	 *  Set the output, specified as 0 or 1 (int)
	 *
	 * Variables:
	 *  value - An integer specifying the pin output value, 
	 *      0 for logical 0 (0v) and 1 (or any other non-zero value) for logical 1 (3.3v).
	 */
    void write(int value);

	/* Function: read
	 *  Return the output setting, represented as 0 or 1 (int)
	 *
	 * Variables:
	 *  returns - An integer representing the output setting of the pin, 
	 *      0 for logical 0 (0v) and 1 for logical 1 (3.3v)
	 */
    int read();

    virtual const struct rpc_method *get_rpc_methods();
    static struct rpc_class *get_rpc_class();

   	/* Group: Access Method Shorthand */
   	 
	/* Function: operator=
	 *  A shorthand for <write>
	 */
	DigitalOut& operator= (int v);
	DigitalOut& operator= (DigitalOut& rhs);
	
    /* Function: operator int()
     *  A shorthand for <read>
     */
	operator int();

protected:
	
	LPC2300::GPIORF* _rf;
	unsigned int _mask;
	int _id;
				
};

}

#endif