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
Revision 43:aff670d0d510, committed 2012-10-24
- Comitter:
- screamer
- Date:
- Wed Oct 24 10:44:49 2012 +0000
- Parent:
- 42:cd19af002ccc
- Commit message:
- Conversion of the classes documentation to Doxygen format
Changed in this revision
--- a/AnalogIn.h Wed Aug 29 12:44:47 2012 +0100 +++ b/AnalogIn.h Wed Oct 24 10:44:49 2012 +0000 @@ -16,67 +16,62 @@ namespace mbed { -/* Class: AnalogIn - * An analog input, used for reading the voltage on a pin +/** An analog input, used for reading the voltage on a pin * * Example: - * > // Print messages when the AnalogIn is greater than 50% - * > - * > #include "mbed.h" - * > - * > AnalogIn temperature(p20); - * > - * > int main() { - * > while(1) { - * > if(temperature > 0.5) { - * > printf("Too hot! (%f)", temperature.read()); - * > } - * > } - * > } + * @code + * // Print messages when the AnalogIn is greater than 50% + * + * #include "mbed.h" + * + * AnalogIn temperature(p20); + * + * int main() { + * while(1) { + * if(temperature > 0.5) { + * printf("Too hot! (%f)", temperature.read()); + * } + * } + * } + * @endcode */ class AnalogIn : public Base { public: - /* Constructor: AnalogIn - * Create an AnalogIn, connected to the specified pin + /** Create an AnalogIn, connected to the specified pin * - * Variables: - * pin - AnalogIn pin to connect to - * name - (optional) A string to identify the object + * @param pin AnalogIn pin to connect to + * @param name (optional) A string to identify the object */ - AnalogIn(PinName pin, const char *name = NULL); - - /* Function: read - * Read the input voltage, represented as a float in the range [0.0, 1.0] + AnalogIn(PinName pin, const char *name = NULL); + + /** Read the input voltage, represented as a float in the range [0.0, 1.0] * - * Variables: - * returns - A floating-point value representing the current input voltage, - * measured as a percentage + * @returns A floating-point value representing the current input voltage, measured as a percentage */ - float read(); + float read(); - /* Function: read_u16 - * Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF] + /** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF] * - * Variables: - * returns - 16-bit unsigned short representing the current input voltage, - * normalised to a 16-bit value + * @returns + * 16-bit unsigned short representing the current input voltage, normalised to a 16-bit value */ unsigned short read_u16(); #ifdef MBED_OPERATORS - /* Function: operator float - * An operator shorthand for <read()> + /** An operator shorthand for read() * - * The float() operator can be used as a shorthand for <read()> to simplify common code sequences + * The float() operator can be used as a shorthand for read() to simplify common code sequences * * Example: - * > float x = volume.read(); - * > float x = volume; - * > - * > if(volume.read() > 0.25) { ... } - * > if(volume > 0.25) { ... } + * @code + * float x = volume.read(); + * float x = volume; + * + * if(volume.read() > 0.25) { ... } + * if(volume > 0.25) { ... } + * @endcode */ operator float(); #endif
--- a/AnalogOut.h Wed Aug 29 12:44:47 2012 +0100 +++ b/AnalogOut.h Wed Oct 24 10:44:49 2012 +0000 @@ -16,82 +16,74 @@ namespace mbed { -/* Class: AnalogOut - * An analog output, used for setting the voltage on a pin +/** An analog output, used for setting the voltage on a pin * * Example: - * > // Make a sawtooth output - * > - * > #include "mbed.h" - * > - * > AnalogOut tri(p18); - * > int main() { - * > while(1) { - * > tri = tri + 0.01; - * > wait_us(1); - * > if(tri == 1) { - * > tri = 0; - * > } - * > } - * > } + * @code + * // Make a sawtooth output + * + * #include "mbed.h" + * + * AnalogOut tri(p18); + * int main() { + * while(1) { + * tri = tri + 0.01; + * wait_us(1); + * if(tri == 1) { + * tri = 0; + * } + * } + * } + * @endcode */ class AnalogOut : public Base { public: - /* Constructor: AnalogOut - * Create an AnalogOut connected to the specified pin - * - * Variables: - * pin - AnalogOut pin to connect to (18) - */ - AnalogOut(PinName pin, const char *name = NULL); - - /* Function: write - * Set the output voltage, specified as a percentage (float) + /** Create an AnalogOut connected to the specified pin + * + * @param AnalogOut pin to connect to (18) + */ + AnalogOut(PinName pin, const char *name = NULL); + + /** Set the output voltage, specified as a percentage (float) * - * Variables: - * percent - A floating-point value representing the output voltage, + * @param value A floating-point value representing the output voltage, * specified as a percentage. The value should lie between * 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%). - * Values outside this range will be saturated to 0.0f or 1.0f. + * Values outside this range will be saturated to 0.0f or 1.0f. */ void write(float value); - /* Function: write_u16 - * Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF] + /** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF] * - * Variables: - * value - 16-bit unsigned short representing the output voltage, - * normalised to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v) + * @param value 16-bit unsigned short representing the output voltage, + * normalised to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v) */ void write_u16(unsigned short value); - /* Function: read - * Return the current output voltage setting, measured as a percentage (float) + /** Return the current output voltage setting, measured as a percentage (float) * - * Variables: - * returns - A floating-point value representing the current voltage being output on the pin, + * @returns + * A floating-point value representing the current voltage being output on the pin, * measured as a percentage. The returned value will lie between * 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%). * - * Note: - * This value may not match exactly the value set by a previous <write>. - */ + * @note + * This value may not match exactly the value set by a previous write(). + */ float read(); #ifdef MBED_OPERATORS - /* Function: operator= - * An operator shorthand for <write()> + /** An operator shorthand for write() */ - AnalogOut& operator= (float percent); - AnalogOut& operator= (AnalogOut& rhs); + AnalogOut& operator= (float percent); + AnalogOut& operator= (AnalogOut& rhs); - /* Function: operator float() - * An operator shorthand for <read()> - */ - operator float(); + /** An operator shorthand for read() + */ + operator float(); #endif #ifdef MBED_RPC @@ -101,7 +93,7 @@ protected: - DACName _dac; + DACName _dac; };
--- a/Base.h Wed Aug 29 12:44:47 2012 +0100 +++ b/Base.h Wed Oct 24 10:44:49 2012 +0000 @@ -26,8 +26,7 @@ }; #endif -/* Class Base - * The base class for most things +/** The base class for most things */ class Base { @@ -37,66 +36,63 @@ virtual ~Base(); - /* Function register_object - * Registers this object with the given name, so that it can be + /** Registers this object with the given name, so that it can be * looked up with lookup. If this object has already been * registered, then this just changes the name. * - * Variables - * name - The name to give the object. If NULL we do nothing. + * @param name The name to give the object. If NULL we do nothing. */ void register_object(const char *name); - /* Function name - * Returns the name of the object, or NULL if it has no name. + /** Returns the name of the object + * + * @returns + * The name of the object, or NULL if it has no name. */ const char *name(); #ifdef MBED_RPC - /* Function rpc - * Call the given method with the given arguments, and write the + /** Call the given method with the given arguments, and write the * result into the string pointed to by result. The default * implementation calls rpc_methods to determine the supported * methods. * - * Variables - * method - The name of the method to call. - * arguments - A list of arguments separated by spaces. - * result - A pointer to a string to write the result into. May - * be NULL, in which case nothing is written. + * @param method The name of the method to call. + * @param arguments A list of arguments separated by spaces. + * @param result A pointer to a string to write the result into. May be NULL, in which case nothing is written. * - * Returns - * true if method corresponds to a valid rpc method, or - * false otherwise. + * @returns + * true if method corresponds to a valid rpc method, or + * false otherwise. */ - virtual bool rpc(const char *method, const char *arguments, char *result); + virtual bool rpc(const char *method, const char *arguments, char *result); - /* Function get_rpc_methods - * Returns a pointer to an array describing the rpc methods + /** Returns a pointer to an array describing the rpc methods * supported by this object, terminated by either * RPC_METHOD_END or RPC_METHOD_SUPER(Superclass). * * Example - * > class Example : public Base { - * > int foo(int a, int b) { return a + b; } - * > virtual const struct rpc_method *get_rpc_methods() { - * > static const rpc_method rpc_methods[] = { - * > { "foo", generic_caller<int, Example, int, int, &Example::foo> }, - * > RPC_METHOD_SUPER(Base) - * > }; - * > return rpc_methods; - * > } - * > }; + * @code + * class Example : public Base { + * int foo(int a, int b) { return a + b; } + * virtual const struct rpc_method *get_rpc_methods() { + * static const rpc_method rpc_methods[] = { + * { "foo", generic_caller<int, Example, int, int, &Example::foo> }, + * RPC_METHOD_SUPER(Base) + * }; + * return rpc_methods; + * } + * }; + * @endcode */ virtual const struct rpc_method *get_rpc_methods(); - /* Function rpc - * Use the lookup function to lookup an object and, if + /** Use the lookup function to lookup an object and, if * successful, call its rpc method * - * Variables - * returns - false if name does not correspond to an object, + * @returns + * false if name does not correspond to an object, * otherwise the return value of the call to the object's rpc * method. */ @@ -104,12 +100,10 @@ #endif - /* Function lookup - * Lookup and return the object that has the given name. + /** Lookup and return the object that has the given name. * - * Variables - * name - the name to lookup. - * len - the length of name. + * @param name the name to lookup. + * @param len the length of name. */ static Base *lookup(const char *name, unsigned int len); @@ -141,8 +135,7 @@ public: #ifdef MBED_RPC - /* Function add_rpc_class - * Add the class to the list of classes which can have static + /** Add the class to the list of classes which can have static * methods called via rpc (the static methods which can be called * are defined by that class' get_rpc_class() static method). */ @@ -206,15 +199,13 @@ }; -/* Macro MBED_OBJECT_NAME_MAX - * The maximum size of object name (including terminating null byte) +/** The maximum size of object name (including terminating null byte) * that will be recognised when using fopen to open a FileLike * object, or when using the rpc function. */ #define MBED_OBJECT_NAME_MAX 32 -/* Macro MBED_METHOD_NAME_MAX - * The maximum size of rpc method name (including terminating null +/** The maximum size of rpc method name (including terminating null * byte) that will be recognised by the rpc function (in rpc.h). */ #define MBED_METHOD_NAME_MAX 32
--- a/BusIn.h Wed Aug 29 12:44:47 2012 +0100 +++ b/BusIn.h Wed Oct 24 10:44:49 2012 +0000 @@ -13,22 +13,17 @@ namespace mbed { -/* Class: BusIn - * A digital input bus, used for reading the state of a collection of pins +/** A digital input bus, used for reading the state of a collection of pins */ class BusIn : public Base { public: - /* Group: Configuration Methods */ - - /* Constructor: BusIn - * Create an BusIn, connected to the specified pins + /** Create an BusIn, connected to the specified pins * - * Variables: - * p<n> - DigitalIn pin to connect to bus bit <n> (p5-p30, NC) + * @param <n> DigitalIn pin to connect to bus bit <n> (p5-p30, NC) * - * Note: + * @note * It is only required to specify as many pin variables as is required * for the bus; the rest will default to NC (not connected) */ @@ -39,24 +34,18 @@ const char *name = NULL); BusIn(PinName pins[16], const char *name = NULL); - - virtual ~BusIn(); - - /* Group: Access Methods */ - - /* Function: read - * Read the value of the input bus - * - * Variables: - * returns - An integer with each bit corresponding to the value read from the associated DigitalIn pin - */ + + virtual ~BusIn(); + + /** Read the value of the input bus + * + * @returns + * An integer with each bit corresponding to the value read from the associated DigitalIn pin + */ int read(); #ifdef MBED_OPERATORS - /* Group: Access Method Shorthand */ - - /* Function: operator int() - * A shorthand for <read> + /** A shorthand for read() */ operator int(); #endif @@ -67,7 +56,7 @@ #endif protected: - + DigitalIn* _pin[16]; #ifdef MBED_RPC
--- a/BusInOut.h Wed Aug 29 12:44:47 2012 +0100 +++ b/BusInOut.h Wed Oct 24 10:44:49 2012 +0000 @@ -13,25 +13,20 @@ namespace mbed { -/* Class: BusInOut - * A digital input output bus, used for setting the state of a collection of pins +/** A digital input output bus, used for setting the state of a collection of pins */ class BusInOut : public Base { public: - /* Group: Configuration Methods */ - - /* Constructor: BusInOut - * Create an BusInOut, connected to the specified pins + /** Create an BusInOut, connected to the specified pins + * + * @param p<n> DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC) * - * Variables: - * p<n> - DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC) - * - * Note: - * It is only required to specify as many pin variables as is required - * for the bus; the rest will default to NC (not connected) - */ + * @note + * It is only required to specify as many pin variables as is required + * for the bus; the rest will default to NC (not connected) + */ BusInOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, @@ -43,53 +38,42 @@ virtual ~BusInOut(); /* Group: Access Methods */ - - /* Function: write - * Write the value to the output bus + + /** Write the value to the output bus * - * Variables: - * value - An integer specifying a bit to write for every corresponding DigitalInOut pin + * @param value An integer specifying a bit to write for every corresponding DigitalInOut pin */ void write(int value); - - /* Function: read - * Read the value currently output on the bus + + /** Read the value currently output on the bus * - * Variables: - * returns - An integer with each bit corresponding to associated DigitalInOut pin setting + * @returns + * An integer with each bit corresponding to associated DigitalInOut pin setting */ int read(); - /* Function: output - * Set as an output + /** Set as an output */ void output(); - /* Function: input - * Set as an input + /** Set as an input */ void input(); - /* Function: mode - * Set the input pin mode + /** Set the input pin mode * - * Variables: - * mode - PullUp, PullDown, PullNone + * @param mode PullUp, PullDown, PullNone */ void mode(PinMode pull); #ifdef MBED_OPERATORS - /* Group: Access Method Shorthand */ - - /* Function: operator= - * A shorthand for <write> + /** A shorthand for write() */ BusInOut& operator= (int v); BusInOut& operator= (BusInOut& rhs); - /* Function: operator int() - * A shorthand for <read> + /** A shorthand for read() */ operator int(); #endif @@ -106,7 +90,7 @@ #ifdef MBED_RPC static void construct(const char *arguments, char *res); #endif - + }; } // namespace mbed
--- a/BusOut.h Wed Aug 29 12:44:47 2012 +0100 +++ b/BusOut.h Wed Oct 24 10:44:49 2012 +0000 @@ -13,25 +13,20 @@ namespace mbed { -/* Class: BusOut - * A digital output bus, used for setting the state of a collection of pins +/** A digital output bus, used for setting the state of a collection of pins */ class BusOut : public Base { public: - /* Group: Configuration Methods */ - - /* Constructor: BusOut - * Create an BusOut, connected to the specified pins + /** Create an BusOut, connected to the specified pins + * + * @param p<n> DigitalOut pin to connect to bus bit <n> (p5-p30, NC) * - * Variables: - * p<n> - DigitalOut pin to connect to bus bit <n> (p5-p30, NC) - * - * Note: - * It is only required to specify as many pin variables as is required - * for the bus; the rest will default to NC (not connected) - */ + * @note + * It is only required to specify as many pin variables as is required + * for the bus; the rest will default to NC (not connected) + */ BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, @@ -41,37 +36,29 @@ BusOut(PinName pins[16], const char *name = NULL); virtual ~BusOut(); - - /* Group: Access Methods */ - - /* Function: write - * Write the value to the output bus + + /** Write the value to the output bus * - * Variables: - * value - An integer specifying a bit to write for every corresponding DigitalOut pin + * @param value An integer specifying a bit to write for every corresponding DigitalOut pin */ void write(int value); - - /* Function: read - * Read the value currently output on the bus + + /** Read the value currently output on the bus * - * Variables: - * returns - An integer with each bit corresponding to associated DigitalOut pin setting + * @returns + * An integer with each bit corresponding to associated DigitalOut pin setting */ int read(); #ifdef MBED_OPERATORS - /* Group: Access Method Shorthand */ - - /* Function: operator= - * A shorthand for <write> + + /** A shorthand for write() */ BusOut& operator= (int v); BusOut& operator= (BusOut& rhs); - /* Function: operator int() - * A shorthand for <read> + /** A shorthand for read() */ operator int(); #endif @@ -88,7 +75,7 @@ #ifdef MBED_RPC static void construct(const char *arguments, char *res); #endif - + }; } // namespace mbed
--- a/CAN.h Wed Aug 29 12:44:47 2012 +0100 +++ b/CAN.h Wed Oct 24 10:44:49 2012 +0000 @@ -21,15 +21,13 @@ namespace mbed { -/* Class: CANMessage - * +/** CANMessage class */ class CANMessage : public CAN_Message { public: - /* Constructor: CANMessage - * Creates empty CAN message. + /** Creates empty CAN message. */ CANMessage() { len = 8; @@ -39,8 +37,7 @@ memset(data, 0, 8); } - /* Constructor: CANMessage - * Creates CAN message with specific content. + /** Creates CAN message with specific content. */ CANMessage(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) { len = _len & 0xF; @@ -50,8 +47,7 @@ memcpy(data, _data, _len); } - /* Constructor: CANMessage - * Creates CAN remote message. + /** Creates CAN remote message. */ CANMessage(int _id, CANFormat _format = CANStandard) { len = 0; @@ -62,30 +58,26 @@ } #if 0 // Inhereted from CAN_Message, for documentation only - /* Variable: id - * The message id. + /** The message id. * - * If format is CANStandard it must be an 11 bit long id - * If format is CANExtended it must be an 29 bit long id + * - If format is CANStandard it must be an 11 bit long id. + * - If format is CANExtended it must be an 29 bit long id. */ unsigned int id; - /* Variable: data - * Space for 8 byte payload. + /** Space for 8 byte payload. * * If type is CANData data can store up to 8 byte data. */ unsigned char data[8]; - /* Variable: len - * Length of data in bytes. + /** Length of data in bytes. * * If type is CANData data can store up to 8 byte data. */ unsigned char len; - /* Variable: format - * Defines if the message has standard or extended format. + /** Defines if the message has standard or extended format. * * Defines the type of message id: * Default is CANStandard which implies 11 bit id. @@ -93,8 +85,7 @@ */ CANFormat format; - /* Variable: type - * Defines the type of a message. + /** Defines the type of a message. * * The message type can rather be CANData for a message with data (default). * Or CANRemote for a request of a specific CAN message. @@ -103,128 +94,115 @@ #endif }; -/* Class: CAN - * A can bus client, used for communicating with can devices +/** A can bus client, used for communicating with can devices */ class CAN : public Base { public: - /* Constructor: CAN - * Creates an CAN interface connected to specific pins. + /** Creates an CAN interface connected to specific pins. + * + * @param rd read from transmitter + * @param td transmit to transmitter * * Example: - * > #include "mbed.h" - * > - * > Ticker ticker; - * > DigitalOut led1(LED1); - * > DigitalOut led2(LED2); - * > CAN can1(p9, p10); - * > CAN can2(p30, p29); - * > - * > char counter = 0; - * > - * > void send() { - * > if(can1.write(CANMessage(1337, &counter, 1))) { - * > printf("Message sent: %d\n", counter); - * > counter++; - * > } - * > led1 = !led1; - * > } - * > - * > int main() { - * > ticker.attach(&send, 1); - * > CANMessage msg; - * > while(1) { - * > if(can2.read(msg)) { - * > printf("Message received: %d\n\n", msg.data[0]); - * > led2 = !led2; - * > } - * > wait(0.2); - * > } - * > } - * - * Variables: - * rd - read from transmitter - * td - transmit to transmitter + * @code + * #include "mbed.h" + * + * Ticker ticker; + * DigitalOut led1(LED1); + * DigitalOut led2(LED2); + * CAN can1(p9, p10); + * CAN can2(p30, p29); + * + * char counter = 0; + * + * void send() { + * if(can1.write(CANMessage(1337, &counter, 1))) { + * printf("Message sent: %d\n", counter); + * counter++; + * } + * led1 = !led1; + * } + * + * int main() { + * ticker.attach(&send, 1); + * CANMessage msg; + * while(1) { + * if(can2.read(msg)) { + * printf("Message received: %d\n\n", msg.data[0]); + * led2 = !led2; + * } + * wait(0.2); + * } + * } + * @endcode */ CAN(PinName rd, PinName td); virtual ~CAN(); - /* Function: frequency - * Set the frequency of the CAN interface + /** Set the frequency of the CAN interface + * + * @param hz The bus frequency in hertz * - * Variables: - * hz - The bus frequency in hertz - * returns - 1 if successful, 0 otherwise + * @returns + * 1 if successful, + * 0 otherwise */ int frequency(int hz); - /* Function: write - * Write a CANMessage to the bus. + /** Write a CANMessage to the bus. + * + * @param msg The CANMessage to write. * - * Variables: - * msg - The CANMessage to write. - * - * Returns: - * 0 - If write failed. - * 1 - If write was successful. + * @returns + * 0 if write failed, + * 1 if write was successful */ int write(CANMessage msg); - /* Function: read - * Read a CANMessage from the bus. + /** Read a CANMessage from the bus. * - * Variables: - * msg - A CANMessage to read to. + * @param msg A CANMessage to read to. * - * Returns: - * 0 - If no message arrived. - * 1 - If message arrived. + * @returns + * 0 if no message arrived, + * 1 if message arrived */ int read(CANMessage &msg); - /* Function: reset - * Reset CAN interface. + /** Reset CAN interface. * * To use after error overflow. */ void reset(); - /* Function: monitor - * Puts or removes the CAN interface into silent monitoring mode + /** Puts or removes the CAN interface into silent monitoring mode * - * Variables: - * silent - boolean indicating whether to go into silent mode or not + * @param silent boolean indicating whether to go into silent mode or not */ void monitor(bool silent); - /* Function: rderror - * Returns number of read errors to detect read overflow errors. + /** Returns number of read errors to detect read overflow errors. */ unsigned char rderror(); - /* Function: tderror - * Returns number of write errors to detect write overflow errors. + /** Returns number of write errors to detect write overflow errors. */ unsigned char tderror(); - /* Function: attach - * Attach a function to call whenever a CAN frame received interrupt is + /** Attach a function to call whenever a CAN frame received interrupt is * generated. * - * Variables: - * fptr - A pointer to a void function, or 0 to set as none + * @param fptr A pointer to a void function, or 0 to set as none */ void attach(void (*fptr)(void)); - /* Function attach - * Attach a member function to call whenever a CAN frame received interrupt + /** Attach a member function to call whenever a CAN frame received interrupt * is generated. * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called */ template<typename T> void attach(T* tptr, void (T::*mptr)(void)) {
--- a/DigitalIn.h Wed Aug 29 12:44:47 2012 +0100 +++ b/DigitalIn.h Wed Oct 24 10:44:49 2012 +0000 @@ -12,45 +12,43 @@ namespace mbed { -/* Class: DigitalIn - * A digital input, used for reading the state of a pin +/** A digital input, used for reading the state of a pin * * Example: - * > // Flash an LED while a DigitalIn is true - * > - * > #include "mbed.h" - * > - * > DigitalIn enable(p5); - * > DigitalOut led(LED1); - * > - * > int main() { - * > while(1) { - * > if(enable) { - * > led = !led; - * > } - * > wait(0.25); - * > } - * > } + * @code + * // Flash an LED while a DigitalIn is true + * + * #include "mbed.h" + * + * DigitalIn enable(p5); + * DigitalOut led(LED1); + * + * int main() { + * while(1) { + * if(enable) { + * led = !led; + * } + * wait(0.25); + * } + * } + * @endcode */ class DigitalIn : public Base { public: - /* Constructor: DigitalIn - * Create a DigitalIn connected to the specified pin + /** Create a DigitalIn connected to the specified pin * - * Variables: - * pin - DigitalIn pin to connect to - * name - (optional) A string to identify the object + * @param pin DigitalIn pin to connect to + * @param name (optional) A string to identify the object */ DigitalIn(PinName pin, const char *name = NULL); - /* Function: read - * Read the input, represented as 0 or 1 (int) + /** Read the input, represented as 0 or 1 (int) * - * Variables: - * returns - An integer representing the state of the input pin, - * 0 for logical 0 and 1 for logical 1 + * @returns + * An integer representing the state of the input pin, + * 0 for logical 0, 1 for logical 1 */ int read() { #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) @@ -61,17 +59,14 @@ } - /* Function: mode - * Set the input pin mode + /** Set the input pin mode * - * Variables: - * mode - PullUp, PullDown, PullNone, OpenDrain + * @param mode PullUp, PullDown, PullNone, OpenDrain */ void mode(PinMode pull); #ifdef MBED_OPERATORS - /* Function: operator int() - * An operator shorthand for <read()> + /** An operator shorthand for read() */ operator int() { return read();
--- a/DigitalInOut.h Wed Aug 29 12:44:47 2012 +0100 +++ b/DigitalInOut.h Wed Oct 24 10:44:49 2012 +0000 @@ -12,27 +12,22 @@ namespace mbed { -/* Class: DigitalInOut - * A digital input/output, used for setting or reading a bi-directional pin +/** A digital input/output, used for setting or reading a bi-directional pin */ class DigitalInOut : public Base { public: - /* Constructor: DigitalInOut - * Create a DigitalInOut connected to the specified pin + /** Create a DigitalInOut connected to the specified pin * - * Variables: - * pin - DigitalInOut pin to connect to + * @param pin DigitalInOut pin to connect to */ DigitalInOut(PinName pin, const char* name = NULL); - /* Function: write - * Set the output, specified as 0 or 1 (int) + /** Set the output, specified as 0 or 1 (int) * - * Variables: - * value - An integer specifying the pin output value, - * 0 for logical 0 and 1 (or any other non-zero value) for logical 1 + * @param value An integer specifying the pin output value, + * 0 for logical 0, 1 (or any other non-zero value) for logical 1 */ void write(int value) { #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) @@ -53,12 +48,11 @@ #endif } - /* Function: read - * Return the output setting, represented as 0 or 1 (int) + /** Return the output setting, represented as 0 or 1 (int) * - * Variables: - * returns - An integer representing the output setting of the pin if it is an output, - * or read the input if set as an input + * @returns + * an integer representing the output setting of the pin if it is an output, + * or read the input if set as an input */ int read() { #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) @@ -70,27 +64,22 @@ } - /* Function: output - * Set as an output + /** Set as an output */ void output(); - /* Function: input - * Set as an input + /** Set as an input */ void input(); - /* Function: mode - * Set the input pin mode + /** Set the input pin mode * - * Variables: - * mode - PullUp, PullDown, PullNone, OpenDrain + * @param mode PullUp, PullDown, PullNone, OpenDrain */ void mode(PinMode pull); #ifdef MBED_OPERATORS - /* Function: operator= - * A shorthand for <write> + /** A shorthand for write() */ DigitalInOut& operator= (int value) { write(value); @@ -102,8 +91,7 @@ return *this; } - /* Function: operator int() - * A shorthand for <read> + /** A shorthand for read() */ operator int() { return read();
--- a/DigitalOut.h Wed Aug 29 12:44:47 2012 +0100 +++ b/DigitalOut.h Wed Oct 24 10:44:49 2012 +0000 @@ -12,40 +12,37 @@ namespace mbed { -/* Class: DigitalOut - * A digital output, used for setting the state of a pin +/** A digital output, used for setting the state of a pin * * Example: - * > // Toggle a LED - * > #include "mbed.h" - * > - * > DigitalOut led(LED1); - * > - * > int main() { - * > while(1) { - * > led = !led; - * > wait(0.2); - * > } - * > } + * @code + * // Toggle a LED + * #include "mbed.h" + * + * DigitalOut led(LED1); + * + * int main() { + * while(1) { + * led = !led; + * wait(0.2); + * } + * } + * @endcode */ class DigitalOut : public Base { public: - /* Constructor: DigitalOut - * Create a DigitalOut connected to the specified pin + /** Create a DigitalOut connected to the specified pin * - * Variables: - * pin - DigitalOut pin to connect to + * @param pin DigitalOut pin to connect to */ DigitalOut(PinName pin, const char* name = NULL); - /* Function: write - * Set the output, specified as 0 or 1 (int) + /** Set the output, specified as 0 or 1 (int) * - * Variables: - * value - An integer specifying the pin output value, - * 0 for logical 0 and 1 (or any other non-zero value) for logical 1 + * @param value An integer specifying the pin output value, + * 0 for logical 0, 1 (or any other non-zero value) for logical 1 */ void write(int value) { @@ -68,12 +65,11 @@ } - /* Function: read - * Return the output setting, represented as 0 or 1 (int) + /** 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 and 1 for logical 1 + * @returns + * an integer representing the output setting of the pin, + * 0 for logical 0, 1 for logical 1 */ int read() { #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) @@ -86,8 +82,7 @@ #ifdef MBED_OPERATORS - /* Function: operator= - * A shorthand for <write> + /** A shorthand for write() */ DigitalOut& operator= (int value) { write(value); @@ -100,8 +95,7 @@ } - /* Function: operator int() - * A shorthand for <read> + /** A shorthand for read() */ operator int() { return read();
--- a/DirHandle.h Wed Aug 29 12:44:47 2012 +0100 +++ b/DirHandle.h Wed Oct 24 10:44:49 2012 +0000 @@ -19,8 +19,7 @@ namespace mbed { -/* Class DirHandle - * Represents a directory stream. Objects of this type are returned +/** Represents a directory stream. Objects of this type are returned * by a FileSystemLike's opendir method. Implementations must define * at least closedir, readdir and rewinddir. * @@ -36,44 +35,39 @@ class DirHandle { public: - /* Function closedir - * Closes the directory. + /** Closes the directory. * - * Variables - * returns - 0 on success, or -1 on error. + * @returns + * 0 on success, + * -1 on error. */ virtual int closedir()=0; - /* Function readdir - * Return the directory entry at the current position, and + /** Return the directory entry at the current position, and * advances the position to the next entry. * - * Returns - * A pointer to a dirent structure representing the - * directory entry at the current position, or NULL on reaching - * end of directory or error. + * @returns + * A pointer to a dirent structure representing the + * directory entry at the current position, or NULL on reaching + * end of directory or error. */ virtual struct dirent *readdir()=0; - /* Function rewinddir - * Resets the position to the beginning of the directory. + /** Resets the position to the beginning of the directory. */ virtual void rewinddir()=0; - /* Function telldir - * Returns the current position of the DirHandle. + /** Returns the current position of the DirHandle. * - * Returns - * The current position, or -1 on error. + * @returns + * the current position, + * -1 on error. */ virtual off_t telldir() { return -1; } - /* Function seekdir - * Sets the position of the DirHandle. + /** Sets the position of the DirHandle. * - * Variables - * location - The location to seek to. Must be a value returned - * by telldir. + * @param location The location to seek to. Must be a value returned by telldir. */ virtual void seekdir(off_t location) { }
--- a/Ethernet.h Wed Aug 29 12:44:47 2012 +0100 +++ b/Ethernet.h Wed Oct 24 10:44:49 2012 +0000 @@ -13,45 +13,43 @@ namespace mbed { -/* Class: Ethernet - * An ethernet interface, to use with the ethernet pins. +/** An ethernet interface, to use with the ethernet pins. * * Example: - * > // Read destination and source from every ethernet packet - * > - * > #include "mbed.h" - * > - * > Ethernet eth; - * > - * > int main() { - * > char buf[0x600]; - * > - * > while(1) { - * > int size = eth.receive(); - * > if(size > 0) { - * > eth.read(buf, size); - * > printf("Destination: %02X:%02X:%02X:%02X:%02X:%02X\n", - * > buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); - * > printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n", - * > buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]); - * > } - * > - * > wait(1); - * > } - * > } - * + * @code + * // Read destination and source from every ethernet packet + * + * #include "mbed.h" + * + * Ethernet eth; + * + * int main() { + * char buf[0x600]; + * + * while(1) { + * int size = eth.receive(); + * if(size > 0) { + * eth.read(buf, size); + * printf("Destination: %02X:%02X:%02X:%02X:%02X:%02X\n", + * buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); + * printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n", + * buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]); + * } + * + * wait(1); + * } + * } + * @endcode */ class Ethernet : public Base { public: - /* Constructor: Ethernet - * Initialise the ethernet interface. + /** Initialise the ethernet interface. */ Ethernet(); - /* Destructor: Ethernet - * Powers the hardware down. + /** Powers the hardware down. */ virtual ~Ethernet(); @@ -63,47 +61,42 @@ , FullDuplex100 }; - /* Function: write - * Writes into an outgoing ethernet packet. + /** Writes into an outgoing ethernet packet. * * It will append size bytes of data to the previously written bytes. * - * Variables: - * data - An array to write. - * size - The size of data. + * @param data An array to write. + * @param size The size of data. * - * Returns: - * The number of written bytes. + * @returns + * The number of written bytes. */ int write(const char *data, int size); - /* Function: send - * Send an outgoing ethernet packet. + /** Send an outgoing ethernet packet. * * After filling in the data in an ethernet packet it must be send. * Send will provide a new packet to write to. * - * Returns: - * 0 - If the sending was failed. - * 1 - If the package is successfully sent. + * @returns + * 0 if the sending was failed, + * 1 if the package is successfully sent. */ int send(); - /* Function: receive - * Recevies an arrived ethernet packet. + /** Recevies an arrived ethernet packet. * * Receiving an ethernet packet will drop the last received ethernet packet * and make a new ethernet packet ready to read. * If no ethernet packet is arrived it will return 0. * - * Returns: - * 0 - If no ethernet packet is arrived. - * The size of the arrived packet. + * @returns + * 0 if no ethernet packet is arrived, + * or the size of the arrived packet. */ int receive(); - /* Function: read - * Read from an recevied ethernet packet. + /** Read from an recevied ethernet packet. * * After receive returnd a number bigger than 0it is * possible to read bytes from this packet. @@ -112,55 +105,51 @@ * It is possible to use read multible times. * Each time read will start reading after the last read byte before. * - * Returns: - * The number of byte read. + * @returns + * The number of byte read. */ int read(char *data, int size); - /* Function: address - * Gives the ethernet address of the mbed. + /** Gives the ethernet address of the mbed. * - * Variables: - * mac - Must be a pointer to a 6 byte char array to copy the ethernet address in. + * @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in. */ void address(char *mac); - /* Function: link - * Returns if an ethernet link is pressent or not. It takes a wile after Ethernet initializion to show up. + /** Returns if an ethernet link is pressent or not. It takes a wile after Ethernet initializion to show up. * - * Returns: - * 0 - If no ethernet link is pressent. - * 1 - If an ethernet link is pressent. + * @returns + * 0 if no ethernet link is pressent, + * 1 if an ethernet link is pressent. * * Example: - * > // Using the Ethernet link function - * > #include "mbed.h" - * > - * > Ethernet eth; - * > - * > int main() { - * > wait(1); // Needed after startup. - * > if(eth.link()) { - * > printf("online\n"); - * > } else { - * > printf("offline\n"); - * > } - * > } - * + * @code + * // Using the Ethernet link function + * #include "mbed.h" + * + * Ethernet eth; + * + * int main() { + * wait(1); // Needed after startup. + * if (eth.link()) { + * printf("online\n"); + * } else { + * printf("offline\n"); + * } + * } + * @endcode */ int link(); - /* Function: set_link - * Sets the speed and duplex parameters of an ethernet link - * - * Variables: - * mode - the speed and duplex mode to set the link to: + /** Sets the speed and duplex parameters of an ethernet link * - * > AutoNegotiate Auto negotiate speed and duplex - * > HalfDuplex10 10 Mbit, half duplex - * > FullDuplex10 10 Mbit, full duplex - * > HalfDuplex100 100 Mbit, half duplex - * > FullDuplex100 100 Mbit, full duplex + * - AutoNegotiate Auto negotiate speed and duplex + * - HalfDuplex10 10 Mbit, half duplex + * - FullDuplex10 10 Mbit, full duplex + * - HalfDuplex100 100 Mbit, half duplex + * - FullDuplex100 100 Mbit, full duplex + * + * @param mode the speed and duplex mode to set the link to: */ void set_link(Mode mode);
--- a/FileHandle.h Wed Aug 29 12:44:47 2012 +0100 +++ b/FileHandle.h Wed Oct 24 10:44:49 2012 +0000 @@ -17,81 +17,74 @@ namespace mbed { -/* Class FileHandle - * An OO equivalent of the internal FILEHANDLE variable - * and associated _sys_* functions +/** An OO equivalent of the internal FILEHANDLE variable + * and associated _sys_* functions. * - * FileHandle is an abstract class, needing at least sys_write and - * sys_read to be implmented for a simple interactive device + * FileHandle is an abstract class, needing at least sys_write and + * sys_read to be implmented for a simple interactive device. * - * No one ever directly tals to/instanciates a FileHandle - it gets - * created by FileSystem, and wrapped up by stdio + * No one ever directly tals to/instanciates a FileHandle - it gets + * created by FileSystem, and wrapped up by stdio. */ class FileHandle { public: - /* Function write - * Write the contents of a buffer to the file + /** Write the contents of a buffer to the file * - * Parameters - * buffer - the buffer to write from - * length - the number of characters to write + * @param buffer the buffer to write from + * @param length the number of characters to write * - * Returns - * The number of characters written (possibly 0) on success, -1 on error. + * @returns + * The number of characters written (possibly 0) on success, -1 on error. */ virtual ssize_t write(const void* buffer, size_t length) = 0; - /* Function close - * Close the file + /** Close the file * - * Returns - * Zero on success, -1 on error. + * @returns + * Zero on success, -1 on error. */ virtual int close() = 0; - /* Function read + /** Function read * Reads the contents of the file into a buffer * - * Parameters - * buffer - the buffer to read in to - * length - the number of characters to read + * @param buffer the buffer to read in to + * @param length the number of characters to read * - * Returns - * The number of characters read (zero at end of file) on success, -1 on error. + * @returns + * The number of characters read (zero at end of file) on success, -1 on error. */ virtual ssize_t read(void* buffer, size_t length) = 0; - /* Function isatty - * Check if the handle is for a interactive terminal device + /** Check if the handle is for a interactive terminal device. + * If so, line buffered behaviour is used by default * - * If so, line buffered behaviour is used by default - * - * Returns - * 1 if it is a terminal, 0 otherwise + * @returns + * 1 if it is a terminal, + * 0 otherwise */ virtual int isatty() = 0 ; - /* Function lseek - * Move the file position to a given offset from a given location. + /** Move the file position to a given offset from a given location. * - * Parameters - * offset - The offset from whence to move to - * whence - SEEK_SET for the start of the file, SEEK_CUR for the + * @param offset The offset from whence to move to + * @param whence SEEK_SET for the start of the file, SEEK_CUR for the * current file position, or SEEK_END for the end of the file. * - * Returns - * New file position on success, -1 on failure or unsupported + * @returns + * new file position on success, + * -1 on failure or unsupported */ virtual off_t lseek(off_t offset, int whence) = 0; - /* Function fsync - * Flush any buffers associated with the FileHandle, ensuring it + /** Flush any buffers associated with the FileHandle, ensuring it * is up to date on disk * - * Returns - * 0 on success or un-needed, -1 on error + * @returns + * 0 on success or un-needed, + * -1 on error */ virtual int fsync() = 0;
--- a/FileLike.h Wed Aug 29 12:44:47 2012 +0100 +++ b/FileLike.h Wed Oct 24 10:44:49 2012 +0000 @@ -10,18 +10,16 @@ namespace mbed { -/* Class FileLike - * A file-like object is one that can be opened with fopen by +/** A file-like object is one that can be opened with fopen by * fopen("/name", mode). It is intersection of the classes Base and * FileHandle. */ class FileLike : public Base, public FileHandle { public: - /* Constructor FileLike + /** FileLike constructor * - * Variables - * name - The name to use to open the file. + * @param name The name to use to open the file. */ FileLike(const char *name) : Base(name) { } virtual ~FileLike();
--- a/FileSystemLike.h Wed Aug 29 12:44:47 2012 +0100 +++ b/FileSystemLike.h Wed Oct 24 10:44:49 2012 +0000 @@ -22,8 +22,7 @@ namespace mbed { -/* Class FileSystemLike - * A filesystem-like object is one that can be used to open files +/** A filesystem-like object is one that can be used to open files * though it by fopen("/name/filename", mode) * * Implementations must define at least open (the default definitions @@ -33,61 +32,61 @@ public: - /* Constructor FileSystemLike + /** FileSystemLike constructor * - * Variables - * name - The name to use for the filesystem. + * @param name The name to use for the filesystem. */ FileSystemLike(const char *name) : Base(name) {} - /* Function open + /** Opens a file from the filesystem * - * Variables - * filename - The name of the file to open. - * flags - One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with + * @param filename The name of the file to open. + * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with * zero or more of O_CREAT, O_TRUNC, or O_APPEND. - * returns - A pointer to a FileHandle object representing the - * file on success, or NULL on failure. + * + * @returns + * A pointer to a FileHandle object representing the + * file on success, or NULL on failure. */ virtual FileHandle *open(const char *filename, int flags) = 0; - /* Function remove - * Remove a file from the filesystem. + /** Remove a file from the filesystem. * - * Variables - * filename - the name of the file to remove. - * returns - 0 on success, -1 on failure. + * @param filename the name of the file to remove. + * @param returns 0 on success, -1 on failure. */ virtual int remove(const char *filename) { return -1; }; - /* Function rename - * Rename a file in the filesystem. + /** Rename a file in the filesystem. * - * Variables - * oldname - the name of the file to rename. - * newname - the name to rename it to. - * returns - 0 on success, -1 on failure. + * @param oldname the name of the file to rename. + * @param newname the name to rename it to. + * + * @returns + * 0 on success, + * -1 on failure. */ virtual int rename(const char *oldname, const char *newname) { return -1; }; - /* Function opendir - * Opens a directory in the filesystem and returns a DirHandle - * representing the directory stream. + /** Opens a directory in the filesystem and returns a DirHandle + * representing the directory stream. * - * Variables - * name - The name of the directory to open. - * returns - A DirHandle representing the directory stream, or - * NULL on failure. + * @param name The name of the directory to open. + * + * @returns + * A DirHandle representing the directory stream, or + * NULL on failure. */ virtual DirHandle *opendir(const char *name) { return NULL; }; - /* Function mkdir - * Creates a directory in the filesystem. + /** Creates a directory in the filesystem. * - * Variables - * name - The name of the directory to create. - * mode - The permissions to create the directory with. - * returns - 0 on success, -1 on failure. + * @param name The name of the directory to create. + * @param mode The permissions to create the directory with. + * + * @returns + * 0 on success, + * -1 on failure. */ virtual int mkdir(const char *name, mode_t mode) { return -1; }
--- a/FunctionPointer.h Wed Aug 29 12:44:47 2012 +0100 +++ b/FunctionPointer.h Wed Oct 24 10:44:49 2012 +0000 @@ -9,76 +9,77 @@ namespace mbed { -/* Class FunctionPointer - * A class for storing and calling a pointer to a static or member void function +/** A class for storing and calling a pointer to a static or member void function */ class FunctionPointer { public: - /* Constructor FunctionPointer - * Create a FunctionPointer, attaching a static function - * - * Variables - * function - The void static function to attach (default is none) - */ - FunctionPointer(void (*function)(void) = 0); + /** Create a FunctionPointer, attaching a static function + * + * @param function The void static function to attach (default is none) + */ + FunctionPointer(void (*function)(void) = 0); - /* Constructor FunctionPointer - * Create a FunctionPointer, attaching a member function - * - * Variables - * object - The object pointer to invoke the member function on (i.e. the this pointer) - * function - The address of the void member function to attach - */ - template<typename T> - FunctionPointer(T *object, void (T::*member)(void)) { - attach(object, member); - } + /** Create a FunctionPointer, attaching a member function + * + * @param object The object pointer to invoke the member function on (i.e. the this pointer) + * @param function The address of the void member function to attach + */ + template<typename T> + FunctionPointer(T *object, void (T::*member)(void)) { + attach(object, member); + } - /* Function attach - * Attach a static function - * - * Variables - * function - The void static function to attach (default is none) - */ - void attach(void (*function)(void) = 0); - - /* Function attach - * Attach a member function - * - * Variables - * object - The object pointer to invoke the member function on (i.e. the this pointer) - * function - The address of the void member function to attach - */ - template<typename T> - void attach(T *object, void (T::*member)(void)) { - _object = static_cast<void*>(object); + /** Attach a static function + * + * @param function The void static function to attach (default is none) + */ + void attach(void (*function)(void) = 0); + + /** Attach a member function + * + * @param object The object pointer to invoke the member function on (i.e. the this pointer) + * @param function The address of the void member function to attach + */ + template<typename T> + void attach(T *object, void (T::*member)(void)) { + _object = static_cast<void*>(object); memcpy(_member, (char*)&member, sizeof(member)); - _membercaller = &FunctionPointer::membercaller<T>; - _function = 0; - } + _membercaller = &FunctionPointer::membercaller<T>; + _function = 0; + } - /* Function call - * Call the attached static or member function - */ - void call(); - + /** Call the attached static or member function + */ + void call(); + private: - template<typename T> - static void membercaller(void *object, char *member) { - T* o = static_cast<T*>(object); - void (T::*m)(void); + template<typename T> + static void membercaller(void *object, char *member) { + T* o = static_cast<T*>(object); + void (T::*m)(void); memcpy((char*)&m, member, sizeof(m)); - (o->*m)(); - } - - void (*_function)(void); // static function pointer - 0 if none attached - void *_object; // object this pointer - 0 if none attached - char _member[16]; // raw member function pointer storage - converted back by registered _membercaller - void (*_membercaller)(void*, char*); // registered membercaller function to convert back and call _member on _object - + (o->*m)(); + } + + /** Static function pointer - 0 if none attached + */ + void (*_function)(void); + + /** Object this pointer - 0 if none attached + */ + void *_object; + + /** Raw member function pointer storage - converted back by registered _membercaller + */ + char _member[16]; + + /** Registered membercaller function to convert back and call _member on _object + */ + void (*_membercaller)(void*, char*); + }; } // namespace mbed
--- a/I2C.h Wed Aug 29 12:44:47 2012 +0100 +++ b/I2C.h Wed Oct 24 10:44:49 2012 +0000 @@ -16,21 +16,22 @@ namespace mbed { -/* Class: I2C - * An I2C Master, used for communicating with I2C slave devices +/** An I2C Master, used for communicating with I2C slave devices * * Example: - * > // Read from I2C slave at address 0x62 - * > - * > #include "mbed.h" - * > - * > I2C i2c(p28, p27); - * > - * > int main() { - * > int address = 0x62; - * > char data[2]; - * > i2c.read(address, data, 2); - * > } + * @code + * // Read from I2C slave at address 0x62 + * + * #include "mbed.h" + * + * I2C i2c(p28, p27); + * + * int main() { + * int address = 0x62; + * char data[2]; + * i2c.read(address, data, 2); + * } + * @endcode */ class I2C : public Base { @@ -48,79 +49,75 @@ , ACK = 1 }; - /* Constructor: I2C - * Create an I2C Master interface, connected to the specified pins + /** Create an I2C Master interface, connected to the specified pins * - * Variables: - * sda - I2C data line pin - * scl - I2C clock line pin + * @param sda I2C data line pin + * @param scl I2C clock line pin */ I2C(PinName sda, PinName scl, const char *name = NULL); - /* Function: frequency - * Set the frequency of the I2C interface + /** Set the frequency of the I2C interface * - * Variables: - * hz - The bus frequency in hertz + * @param hz The bus frequency in hertz */ void frequency(int hz); - /* Function: read - * Read from an I2C slave + /** Read from an I2C slave * - * Performs a complete read transaction. The bottom bit of - * the address is forced to 1 to indicate a read. + * Performs a complete read transaction. The bottom bit of + * the address is forced to 1 to indicate a read. * - * Variables: - * address - 8-bit I2C slave address [ addr | 1 ] - * data - Pointer to the byte-array to read data in to - * length - Number of bytes to read - * repeated - Repeated start, true - don't send stop at end - * returns - 0 on success (ack), or non-0 on failure (nack) + * @param address 8-bit I2C slave address [ addr | 1 ] + * @param data Pointer to the byte-array to read data in to + * @param length Number of bytes to read + * @param repeated Repeated start, true - don't send stop at end + * + * @returns + * 0 on success (ack), + * non-0 on failure (nack) */ int read(int address, char *data, int length, bool repeated = false); - /* Function: read - * Read a single byte from the I2C bus + /** Read a single byte from the I2C bus * - * Variables: - * ack - indicates if the byte is to be acknowledged (1 = acknowledge) - * returns - the byte read + * @param ack indicates if the byte is to be acknowledged (1 = acknowledge) + * + * @returns + * the byte read */ int read(int ack); - /* Function: write - * Write to an I2C slave + /** Write to an I2C slave * - * Performs a complete write transaction. The bottom bit of - * the address is forced to 0 to indicate a write. + * Performs a complete write transaction. The bottom bit of + * the address is forced to 0 to indicate a write. * - * Variables: - * address - 8-bit I2C slave address [ addr | 0 ] - * data - Pointer to the byte-array data to send - * length - Number of bytes to send - * repeated - Repeated start, true - do not send stop at end - * returns - 0 on success (ack), or non-0 on failure (nack) + * @param address 8-bit I2C slave address [ addr | 0 ] + * @param data Pointer to the byte-array data to send + * @param length Number of bytes to send + * @param repeated Repeated start, true - do not send stop at end + * + * @returns + * 0 on success (ack), + * non-0 on failure (nack) */ int write(int address, const char *data, int length, bool repeated = false); - /* Function: write - * Write single byte out on the I2C bus + /** Write single byte out on the I2C bus + * + * @param data data to write out on bus * - * Variables: - * data - data to write out on bus - * returns - a '1' if an ACK was received, a '0' otherwise + * @returns + * '1' if an ACK was received, + * '0' otherwise */ int write(int data); - /* Function: start - * Creates a start condition on the I2C bus + /** Creates a start condition on the I2C bus */ - void start(void); - /* Function: stop - * Creates a stop condition on the I2C bus + /** Creates a stop condition on the I2C bus */ void stop(void);
--- a/I2CSlave.h Wed Aug 29 12:44:47 2012 +0100 +++ b/I2CSlave.h Wed Oct 24 10:44:49 2012 +0000 @@ -16,39 +16,39 @@ namespace mbed { -/* Class: I2CSlave - * An I2C Slave, used for communicating with an I2C Master device +/** An I2C Slave, used for communicating with an I2C Master device * * Example: - * > // Simple I2C responder - * > #include <mbed.h> - * > - * > I2CSlave slave(p9, p10); - * > - * > int main() { - * > char buf[10]; - * > char msg[] = "Slave!"; - * > - * > slave.address(0xA0); - * > while (1) { - * > int i = slave.receive(); - * > switch (i) { - * > case I2CSlave::ReadAddressed: - * > slave.write(msg, strlen(msg) + 1); // Includes null char - * > break; - * > case I2CSlave::WriteGeneral: - * > slave.read(buf, 10); - * > printf("Read G: %s\n", buf); - * > break; - * > case I2CSlave::WriteAddressed: - * > slave.read(buf, 10); - * > printf("Read A: %s\n", buf); - * > break; - * > } - * > for(int i = 0; i < 10; i++) buf[i] = 0; // Clear buffer - * > } - * > } - * > + * @code + * // Simple I2C responder + * #include <mbed.h> + * + * I2CSlave slave(p9, p10); + * + * int main() { + * char buf[10]; + * char msg[] = "Slave!"; + * + * slave.address(0xA0); + * while (1) { + * int i = slave.receive(); + * switch (i) { + * case I2CSlave::ReadAddressed: + * slave.write(msg, strlen(msg) + 1); // Includes null char + * break; + * case I2CSlave::WriteGeneral: + * slave.read(buf, 10); + * printf("Read G: %s\n", buf); + * break; + * case I2CSlave::WriteAddressed: + * slave.read(buf, 10); + * printf("Read A: %s\n", buf); + * break; + * } + * for(int i = 0; i < 10; i++) buf[i] = 0; // Clear buffer + * } + * } + * @endcode */ class I2CSlave : public Base { @@ -61,84 +61,78 @@ , WriteAddressed = 3 }; - /* Constructor: I2CSlave - * Create an I2C Slave interface, connected to the specified pins. + /** Create an I2C Slave interface, connected to the specified pins. * - * Variables: - * sda - I2C data line pin - * scl - I2C clock line pin + * @param sda I2C data line pin + * @param scl I2C clock line pin */ I2CSlave(PinName sda, PinName scl, const char *name = NULL); - /* Function: frequency - * Set the frequency of the I2C interface + /** Set the frequency of the I2C interface * - * Variables: - * hz - The bus frequency in hertz + * @param hz The bus frequency in hertz */ void frequency(int hz); - /* Function: receive - * Checks to see if this I2C Slave has been addressed. + /** Checks to see if this I2C Slave has been addressed. * - * Variables: - * returns - a status indicating if the device has been addressed, and how - * > NoData - the slave has not been addressed - * > ReadAddressed - the master has requested a read from this slave - * > WriteAddressed - the master is writing to this slave - * > WriteGeneral - the master is writing to all slave + * @returns + * A status indicating if the device has been addressed, and how + * - NoData - the slave has not been addressed + * - ReadAddressed - the master has requested a read from this slave + * - WriteAddressed - the master is writing to this slave + * - WriteGeneral - the master is writing to all slave */ int receive(void); - /* Function: read - * Read from an I2C master. + /** Read from an I2C master. * - * Variables: - * data - pointer to the byte array to read data in to - * length - maximum number of bytes to read - * returns - 0 on success, non-0 otherwise + * @param data pointer to the byte array to read data in to + * @param length maximum number of bytes to read + * + * @returns + * 0 on success, + * non-0 otherwise */ int read(char *data, int length); - /* Function: read - * Read a single byte from an I2C master. + /** Read a single byte from an I2C master. * - * Variables: - * returns - the byte read + * @returns + * the byte read */ int read(void); - /* Function: write - * Write to an I2C master. + /** Write to an I2C master. * - * Variables: - * data - pointer to the byte array to be transmitted - * length - the number of bytes to transmite - * returns - a 0 on success, non-0 otherwise + * @param data pointer to the byte array to be transmitted + * @param length the number of bytes to transmite + * + * @returns + * 0 on success, + * non-0 otherwise */ int write(const char *data, int length); - /* Function: write - * Write a single byte to an I2C master. + /** Write a single byte to an I2C master. + * + * @data the byte to write * - * Variables - * data - the byte to write - * returns - a '1' if an ACK was received, a '0' otherwise + * @returns + * '1' if an ACK was received, + * '0' otherwise */ int write(int data); - /* Function: address - * Sets the I2C slave address. + /** Sets the I2C slave address. * - * Variables - * address - the address to set for the slave (ignoring the least - * signifcant bit). If set to 0, the slave will only respond to the - * general call address. + * @param address The address to set for the slave (ignoring the least + * signifcant bit). If set to 0, the slave will only respond to the + * general call address. */ void address(int address); - /* Function: stop - * Reset the I2C slave back into the known ready receiving state. + /** Reset the I2C slave back into the known ready receiving state. */ void stop(void);
--- a/InterruptIn.h Wed Aug 29 12:44:47 2012 +0100 +++ b/InterruptIn.h Wed Oct 24 10:44:49 2012 +0000 @@ -23,39 +23,38 @@ namespace mbed { -/* Class: InterruptIn - * A digital interrupt input, used to call a function on a rising or falling edge +/** A digital interrupt input, used to call a function on a rising or falling edge * * Example: - * > // Flash an LED while waiting for events - * > - * > #include "mbed.h" - * > - * > InterruptIn event(p16); - * > DigitalOut led(LED1); - * > - * > void trigger() { - * > printf("triggered!\n"); - * > } - * > - * > int main() { - * > event.rise(&trigger); - * > while(1) { - * > led = !led; - * > wait(0.25); - * > } - * > } + * @code + * // Flash an LED while waiting for events + * + * #include "mbed.h" + * + * InterruptIn event(p16); + * DigitalOut led(LED1); + * + * void trigger() { + * printf("triggered!\n"); + * } + * + * int main() { + * event.rise(&trigger); + * while(1) { + * led = !led; + * wait(0.25); + * } + * } + * @endcode */ class InterruptIn : public Base { public: - /* Constructor: InterruptIn - * Create an InterruptIn connected to the specified pin + /** Create an InterruptIn connected to the specified pin * - * Variables: - * pin - InterruptIn pin to connect to - * name - (optional) A string to identify the object + * @param pin InterruptIn pin to connect to + * @param name (optional) A string to identify the object */ InterruptIn(PinName pin, const char *name = NULL); #if defined(TARGET_LPC11U24) @@ -68,20 +67,16 @@ #endif - /* Function: rise - * Attach a function to call when a rising edge occurs on the input + /** Attach a function to call when a rising edge occurs on the input * - * Variables: - * fptr - A pointer to a void function, or 0 to set as none + * @param fptr A pointer to a void function, or 0 to set as none */ void rise(void (*fptr)(void)); - /* Function: rise - * Attach a member function to call when a rising edge occurs on the input + /** Attach a member function to call when a rising edge occurs on the input * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called */ template<typename T> void rise(T* tptr, void (T::*mptr)(void)) { @@ -89,20 +84,16 @@ setup_interrupt(1, 1); } - /* Function: fall - * Attach a function to call when a falling edge occurs on the input + /** Attach a function to call when a falling edge occurs on the input * - * Variables: - * fptr - A pointer to a void function, or 0 to set as none + * @param fptr A pointer to a void function, or 0 to set as none */ void fall(void (*fptr)(void)); - /* Function: fall - * Attach a member function to call when a falling edge occurs on the input + /** Attach a member function to call when a falling edge occurs on the input * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called */ template<typename T> void fall(T* tptr, void (T::*mptr)(void)) { @@ -110,11 +101,9 @@ setup_interrupt(0, 1); } - /* Function: mode - * Set the input pin mode + /** Set the input pin mode * - * Variables: - * mode - PullUp, PullDown, PullNone + * @param mode PullUp, PullDown, PullNone */ void mode(PinMode pull);
--- a/LocalFileSystem.h Wed Aug 29 12:44:47 2012 +0100 +++ b/LocalFileSystem.h Wed Oct 24 10:44:49 2012 +0000 @@ -35,33 +35,34 @@ int pos; }; -/* Class: LocalFileSystem - * A filesystem for accessing the local mbed Microcontroller USB disk drive +/** A filesystem for accessing the local mbed Microcontroller USB disk drive * * This allows programs to read and write files on the same disk drive that is used to program the * mbed Microcontroller. Once created, the standard C file access functions are used to open, * read and write files. * * Example: - * > #include "mbed.h" - * > - * > LocalFileSystem local("local"); // Create the local filesystem under the name "local" - * > - * > int main() { - * > FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing - * > fprintf(fp, "Hello World!"); - * > fclose(fp); - * > remove("/local/out.txt"); // Removes the file "out.txt" from the local file system - * > - * > DIR *d = opendir("/local"); // Opens the root directory of the local file system - * > struct dirent *p; - * > while((p = readdir(d)) != NULL) { // Print the names of the files in the local file system - * > printf("%s\n", p->d_name); // to stdout. - * > } - * > closedir(d); - * > } + * @code + * #include "mbed.h" + * + * LocalFileSystem local("local"); // Create the local filesystem under the name "local" + * + * int main() { + * FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing + * fprintf(fp, "Hello World!"); + * fclose(fp); + * remove("/local/out.txt"); // Removes the file "out.txt" from the local file system * - * Implementation Notes: + * DIR *d = opendir("/local"); // Opens the root directory of the local file system + * struct dirent *p; + * while((p = readdir(d)) != NULL) { // Print the names of the files in the local file system + * printf("%s\n", p->d_name); // to stdout. + * } + * closedir(d); + * } + * @endcode + * + * @note * If the microcontroller program makes an access to the local drive, it will be marked as "removed" * on the Host computer. This means it is no longer accessible from the Host Computer. * @@ -75,7 +76,7 @@ LocalFileSystem(const char* n) : FileSystemLike(n) { } - + virtual FileHandle *open(const char* name, int flags); virtual int remove(const char *filename); virtual DirHandle *opendir(const char *name);
--- a/PortIn.h Wed Aug 29 12:44:47 2012 +0100 +++ b/PortIn.h Wed Oct 24 10:44:49 2012 +0000 @@ -14,61 +14,56 @@ namespace mbed { -/* Class: PortIn - * A multiple pin digital input +/** A multiple pin digital input + * + * Example: + * @code + * // Switch on an LED if any of mbed pins 21-26 is high + * + * #include "mbed.h" + * + * PortIn p(Port2, 0x0000003F); // p21-p26 + * DigitalOut ind(LED4); * - * Example: - * > // Switch on an LED if any of mbed pins 21-26 is high - * > - * > #include "mbed.h" - * > - * > PortIn p(Port2, 0x0000003F); // p21-p26 - * > DigitalOut ind(LED4); - * > - * > int main() { - * > while(1) { - * > int pins = p.read(); - * > if(pins) { - * > ind = 1; - * > } else { - * > ind = 0; - * > } - * > } - * > } + * int main() { + * while(1) { + * int pins = p.read(); + * if(pins) { + * ind = 1; + * } else { + * ind = 0; + * } + * } + * } + * @endcode */ class PortIn { public: - /* Constructor: PortIn - * Create an PortIn, connected to the specified port + /** Create an PortIn, connected to the specified port * - * Variables: - * port - Port to connect to (Port0-Port5) - * mask - A bitmask to identify which bits in the port should be included (0 - ignore) - */ + * @param port Port to connect to (Port0-Port5) + * @param mask A bitmask to identify which bits in the port should be included (0 - ignore) + */ PortIn(PortName port, int mask = 0xFFFFFFFF); - /* Function: read - * Read the value currently output on the port + /** Read the value currently output on the port * - * Variables: - * returns - An integer with each bit corresponding to associated port pin setting + * @returns + * An integer with each bit corresponding to associated port pin setting */ int read(); - /* Function: mode - * Set the input pin mode + /** Set the input pin mode * - * Variables: - * mode - PullUp, PullDown, PullNone, OpenDrain + * @param mode PullUp, PullDown, PullNone, OpenDrain */ void mode(PinMode mode); - /* Function: operator int() - * A shorthand for <read> + /** A shorthand for read() */ operator int() { - return read(); + return read(); } private:
--- a/PortInOut.h Wed Aug 29 12:44:47 2012 +0100 +++ b/PortInOut.h Wed Oct 24 10:44:49 2012 +0000 @@ -14,73 +14,61 @@ namespace mbed { -/* Class: PortInOut - * A multiple pin digital in/out used to set/read multiple bi-directional pins +/** A multiple pin digital in/out used to set/read multiple bi-directional pins */ class PortInOut { public: - /* Constructor: PortInOut - * Create an PortInOut, connected to the specified port + /** Create an PortInOut, connected to the specified port * - * Variables: - * port - Port to connect to (Port0-Port5) - * mask - A bitmask to identify which bits in the port should be included (0 - ignore) - */ + * @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); - /* Function: write - * Write the value to the output port + /** Write the value to the output port * - * Variables: - * value - An integer specifying a bit to write for every corresponding port pin + * @param 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 + /** Read the value currently output on the port * - * Variables: - * returns - An integer with each bit corresponding to associated port pin setting + * @returns + * An integer with each bit corresponding to associated port pin setting */ int read(); - /* Function: output - * Set as an output + /** Set as an output */ void output(); - /* Function: input - * Set as an input + /** Set as an input */ void input(); - /* Function: mode - * Set the input pin mode + /** Set the input pin mode * - * Variables: - * mode - PullUp, PullDown, PullNone, OpenDrain + * @param mode PullUp, PullDown, PullNone, OpenDrain */ void mode(PinMode mode); - /* Function: operator= - * A shorthand for <write> + /** A shorthand for write() */ PortInOut& operator= (int value) { - write(value); - return *this; + write(value); + return *this; } PortInOut& operator= (PortInOut& rhs) { - write(rhs.read()); - return *this; + write(rhs.read()); + return *this; } - /* Function: operator int() - * A shorthand for <read> + /** A shorthand for read() */ operator int() { - return read(); + return read(); } private:
--- a/PortOut.h Wed Aug 29 12:44:47 2012 +0100 +++ b/PortOut.h Wed Oct 24 10:44:49 2012 +0000 @@ -16,74 +16,68 @@ #include "PortNames.h" namespace mbed { -/* Class: PortOut - * A multiple pin digital out +/** A multiple pin digital out * * Example: - * > // Toggle all four LEDs - * > - * > #include "mbed.h" - * > - * > // LED1 = P1.18 LED2 = P1.20 LED3 = P1.21 LED4 = P1.23 - * > #define LED_MASK 0x00B40000 - * > - * > PortOut ledport(Port1, LED_MASK); - * > - * > int main() { - * > while(1) { - * > ledport = LED_MASK; - * > wait(1); - * > ledport = 0; - * > wait(1); - * > } - * > } + * @code + * // Toggle all four LEDs + * + * #include "mbed.h" + * + * // LED1 = P1.18 LED2 = P1.20 LED3 = P1.21 LED4 = P1.23 + * #define LED_MASK 0x00B40000 + * + * PortOut ledport(Port1, LED_MASK); + * + * int main() { + * while(1) { + * ledport = LED_MASK; + * wait(1); + * ledport = 0; + * wait(1); + * } + * } + * @endcode */ class PortOut { public: - /* Constructor: PortOut - * Create an PortOut, connected to the specified port + /** Create an PortOut, connected to the specified port * - * Variables: - * port - Port to connect to (Port0-Port5) - * mask - A bitmask to identify which bits in the port should be included (0 - ignore) - */ + * @param port Port to connect to (Port0-Port5) + * @param mask A bitmask to identify which bits in the port should be included (0 - ignore) + */ PortOut(PortName port, int mask = 0xFFFFFFFF); - /* Function: write - * Write the value to the output port + /** Write the value to the output port * - * Variables: - * value - An integer specifying a bit to write for every corresponding PortOut pin + * @param value An integer specifying a bit to write for every corresponding PortOut pin */ void write(int value); - /* Function: read - * Read the value currently output on the port + /** Read the value currently output on the port * - * Variables: - * returns - An integer with each bit corresponding to associated PortOut pin setting + * @returns + * An integer with each bit corresponding to associated PortOut pin setting */ int read(); - /* Function: operator= - * A shorthand for <write> + /** A shorthand for write() */ PortOut& operator= (int value) { - write(value); - return *this; + write(value); + return *this; } PortOut& operator= (PortOut& rhs) { - write(rhs.read()); - return *this; + write(rhs.read()); + return *this; } - /* Function: operator int() - * A shorthand for <read> + /** A shorthand for read() */ operator int() { - return read(); + return read(); } private:
--- a/PwmOut.h Wed Aug 29 12:44:47 2012 +0100 +++ b/PwmOut.h Wed Oct 24 10:44:49 2012 +0000 @@ -16,26 +16,28 @@ namespace mbed { -/* Class: PwmOut - * A pulse-width modulation digital output +/** A pulse-width modulation digital output * * Example - * > // Fade a led on. - * > #include "mbed.h" - * > - * > PwmOut led(LED1); - * > - * > int main() { - * > while(1) { - * > led = led + 0.01; - * > wait(0.2); - * > if(led == 1.0) { - * > led = 0; - * > } - * > } - * > } + * @code + * // Fade a led on. + * #include "mbed.h" * - * Note that on the LPC1768 and LPC2368, the PWMs all share the same + * PwmOut led(LED1); + * + * int main() { + * while(1) { + * led = led + 0.01; + * wait(0.2); + * if(led == 1.0) { + * led = 0; + * } + * } + * } + * @endcode + * + * @note + * On the LPC1768 and LPC2368, the PWMs all share the same * period - if you change the period for one, you change it for all. * Although routines that change the period maintain the duty cycle * for its PWM, all other PWMs will require their duty cycle to be @@ -45,87 +47,68 @@ public: - /* Constructor: PwmOut - * Create a PwmOut connected to the specified pin + /** Create a PwmOut connected to the specified pin * - * Variables: - * pin - PwmOut pin to connect to + * @param pin PwmOut pin to connect to */ PwmOut(PinName pin, const char *name = NULL); - /* Function: write - * Set the ouput duty-cycle, specified as a percentage (float) + /** Set the ouput duty-cycle, specified as a percentage (float) * - * Variables: - * value - A floating-point value representing the output duty-cycle, + * @param value A floating-point value representing the output duty-cycle, * specified as a percentage. The value should lie between * 0.0f (representing on 0%) and 1.0f (representing on 100%). - * Values outside this range will be saturated to 0.0f or 1.0f. + * Values outside this range will be saturated to 0.0f or 1.0f. */ void write(float value); - /* Function: read - * Return the current output duty-cycle setting, measured as a percentage (float) + /** Return the current output duty-cycle setting, measured as a percentage (float) * - * Variables: - * returns - A floating-point value representing the current duty-cycle being output on the pin, + * @returns + * A floating-point value representing the current duty-cycle being output on the pin, * measured as a percentage. The returned value will lie between * 0.0f (representing on 0%) and 1.0f (representing on 100%). * - * Note: - * This value may not match exactly the value set by a previous <write>. + * @note + * This value may not match exactly the value set by a previous <write>. */ float read(); - /* Function: period - * Set the PWM period, specified in seconds (float), keeping the - * duty cycle the same. + /** Set the PWM period, specified in seconds (float), keeping the duty cycle the same. * - * Note: - * The resolution is currently in microseconds; periods smaller than this - * will be set to zero. + * @note + * The resolution is currently in microseconds; periods smaller than this + * will be set to zero. */ void period(float seconds); - /* Function: period_ms - * Set the PWM period, specified in milli-seconds (int), keeping the - * duty cycle the same. + /** Set the PWM period, specified in milli-seconds (int), keeping the duty cycle the same. */ void period_ms(int ms); - /* Function: period_us - * Set the PWM period, specified in micro-seconds (int), keeping the - * duty cycle the same. + /** Set the PWM period, specified in micro-seconds (int), keeping the duty cycle the same. */ void period_us(int us); - /* Function: pulsewidth - * Set the PWM pulsewidth, specified in seconds (float), keeping the - * period the same. + /** Set the PWM pulsewidth, specified in seconds (float), keeping the period the same. */ void pulsewidth(float seconds); - /* Function: pulsewidth_ms - * Set the PWM pulsewidth, specified in milli-seconds (int), keeping - * the period the same. + /** Set the PWM pulsewidth, specified in milli-seconds (int), keeping the period the same. */ void pulsewidth_ms(int ms); - /* Function: pulsewidth_us - * Set the PWM pulsewidth, specified in micro-seconds (int), keeping - * the period the same. + /** Set the PWM pulsewidth, specified in micro-seconds (int), keeping the period the same. */ void pulsewidth_us(int us); #ifdef MBED_OPERATORS - /* Function: operator= - * A operator shorthand for <write()> + /** A operator shorthand for write() */ PwmOut& operator= (float value); PwmOut& operator= (PwmOut& rhs); - /* Function: operator float() - * An operator shorthand for <read()> + /** An operator shorthand for read() */ operator float(); #endif
--- a/SPI.h Wed Aug 29 12:44:47 2012 +0100 +++ b/SPI.h Wed Oct 24 10:44:49 2012 +0000 @@ -16,75 +16,72 @@ namespace mbed { -/* Class: SPI - * A SPI Master, used for communicating with SPI slave devices +/** A SPI Master, used for communicating with SPI slave devices * - * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz + * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz * - * Most SPI devices will also require Chip Select and Reset signals. These - * can be controlled using <DigitalOut> pins + * Most SPI devices will also require Chip Select and Reset signals. These + * can be controlled using <DigitalOut> pins * * Example: - * > // Send a byte to a SPI slave, and record the response - * > - * > #include "mbed.h" - * > - * > SPI device(p5, p6, p7); // mosi, miso, sclk - * > - * > int main() { - * > int response = device.write(0xFF); - * > } + * @code + * // Send a byte to a SPI slave, and record the response + * + * #include "mbed.h" + * + * SPI device(p5, p6, p7); // mosi, miso, sclk + * + * int main() { + * int response = device.write(0xFF); + * } + * @endcode */ class SPI : public Base { public: - /* Constructor: SPI - * Create a SPI master connected to the specified pins + /** Create a SPI master connected to the specified pins * - * Variables: - * mosi - SPI Master Out, Slave In pin - * miso - SPI Master In, Slave Out pin - * sclk - SPI Clock pin - * name - (optional) A string to identify the object - * - * Pin Options: - * (5, 6, 7) or (11, 12, 13) + * Pin Options: + * (5, 6, 7) or (11, 12, 13) * * mosi or miso can be specfied as NC if not used + * + * @param mosi SPI Master Out, Slave In pin + * @param miso SPI Master In, Slave Out pin + * @param sclk SPI Clock pin + * @param name (optional) A string to identify the object */ SPI(PinName mosi, PinName miso, PinName sclk, const char *name = NULL); - /* Function: format - * Configure the data transmission format + /** Configure the data transmission format * - * Variables: - * bits - Number of bits per SPI frame (4 - 16) - * mode - Clock polarity and phase mode (0 - 3) + * @param bits Number of bits per SPI frame (4 - 16) + * @param mode Clock polarity and phase mode (0 - 3) * - * > mode | POL PHA - * > -----+-------- - * > 0 | 0 0 - * > 1 | 0 1 - * > 2 | 1 0 - * > 3 | 1 1 + * @code + * mode | POL PHA + * -----+-------- + * 0 | 0 0 + * 1 | 0 1 + * 2 | 1 0 + * 3 | 1 1 + * @endcode */ void format(int bits, int mode = 0); - /* Function: frequency - * Set the spi bus clock frequency + /** Set the spi bus clock frequency * - * Variables: - * hz - SCLK frequency in hz (default = 1MHz) + * @param hz SCLK frequency in hz (default = 1MHz) */ void frequency(int hz = 1000000); - /* Function: write - * Write to the SPI Slave and return the response + /** Write to the SPI Slave and return the response * - * Variables: - * value - Data to be sent to the SPI slave - * returns - Response from the SPI slave + * @param value Data to be sent to the SPI slave + * + * @returns + * Response from the SPI slave */ virtual int write(int value); @@ -96,9 +93,9 @@ protected: - SPIName _spi; - - void aquire(void); + SPIName _spi; + + void aquire(void); static SPI *_owner; int _bits; int _mode;
--- a/SPIHalfDuplex.h Wed Aug 29 12:44:47 2012 +0100 +++ b/SPIHalfDuplex.h Wed Oct 24 10:44:49 2012 +0000 @@ -13,93 +13,88 @@ namespace mbed { -/* Class: SPIHalfDuplex - * A SPI half-duplex master, used for communicating with SPI slave devices - * over a shared data line. +/** A SPI half-duplex master, used for communicating with SPI slave devices + * over a shared data line. * - * The default format is set to 8-bits for both master and slave, and a - * clock frequency of 1MHz + * The default format is set to 8-bits for both master and slave, and a + * clock frequency of 1MHz * - * Most SPI devies will also require Chip Select and Reset signals. These - * can be controlled using <DigitalOut> pins. + * Most SPI devies will also require Chip Select and Reset signals. These + * can be controlled using <DigitalOut> pins. * - * Although this is for a shared data line, both MISO and MOSI are defined, - * and should be tied together externally to the mbed. This class handles - * the tri-stating of the MOSI pin. + * Although this is for a shared data line, both MISO and MOSI are defined, + * and should be tied together externally to the mbed. This class handles + * the tri-stating of the MOSI pin. * * Example: - * > // Send a byte to a SPI half-duplex slave, and record the response - * > - * > #include "mbed.h" - * > - * > SPIHalfDuplex device(p5, p6, p7) // mosi, miso, sclk - * > - * > int main() { - * > int respone = device.write(0xAA); - * > } + * @code + * // Send a byte to a SPI half-duplex slave, and record the response + * + * #include "mbed.h" + * + * SPIHalfDuplex device(p5, p6, p7) // mosi, miso, sclk + * + * int main() { + * int respone = device.write(0xAA); + * } + * @endcode */ class SPIHalfDuplex : public SPI { public: - /* Constructor: SPIHalfDuplex - * Create a SPI half-duplex master connected to the specified pins + /** Create a SPI half-duplex master connected to the specified pins * - * Variables: - * mosi - SPI Master Out, Slave In pin - * miso - SPI Master In, Slave Out pin - * sclk - SPI Clock pin - * name - (optional) A string to identify the object - * - * Pin Options: - * (5, 6, 7) or (11, 12, 13) + * Pin Options: + * (5, 6, 7) or (11, 12, 13) * * mosi or miso can be specfied as NC if not used + * + * @param mosi SPI Master Out, Slave In pin + * @param miso SPI Master In, Slave Out pin + * @param sclk SPI Clock pin + * @param name (optional) A string to identify the object */ SPIHalfDuplex(PinName mosi, PinName miso, PinName sclk, const char *name = NULL); #if 0 // Inherited from SPI - documentation only - /* Function: format - * Configure the data transmission format + /** Configure the data transmission format * - * Variables: - * bits - Number of bits per SPI frame (4 - 16) - * mode - Clock polarity and phase mode (0 - 3) + * @param bits Number of bits per SPI frame (4 - 16) + * @param mode Clock polarity and phase mode (0 - 3) * - * > mode | POL PHA - * > -----+-------- - * > 0 | 0 0 - * > 1 | 0 1 - * > 2 | 1 0 - * > 3 | 1 1 + * @code + * mode | POL PHA + * -----+-------- + * 0 | 0 0 + * 1 | 0 1 + * 2 | 1 0 + * 3 | 1 1 + * @endcode */ void format(int bits, int mode = 0); - /* Function: frequency - * Set the spi bus clock frequency + /** Set the spi bus clock frequency * - * Variables: - * hz - SCLK frequency in hz (default = 1MHz) + * @param hz SCLK frequency in hz (default = 1MHz) */ void frequency(int hz = 1000000); #endif - /* Function: write - * Write to the SPI Slave and return the response + /** Write to the SPI Slave and return the response * - * Variables: - * value - Data to be sent to the SPI slave - * returns - Response from the SPI slave + * @param value Data to be sent to the SPI slave + * + * @returns + * Response from the SPI slave */ virtual int write(int value); - /* Function: slave_format - * Set the number of databits expected from the slave, from 4-16 + /** Set the number of databits expected from the slave, from 4-16 * - * Variables: - * sbits - Number of expected bits in the slave response + * @param sbits Number of expected bits in the slave response */ void slave_format(int sbits);
--- a/SPISlave.h Wed Aug 29 12:44:47 2012 +0100 +++ b/SPISlave.h Wed Oct 24 10:44:49 2012 +0000 @@ -16,104 +16,98 @@ namespace mbed { -/* Class: SPISlave - * A SPI slave, used for communicating with a SPI Master device +/** A SPI slave, used for communicating with a SPI Master device * - * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz + * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz * * Example: - * > // Reply to a SPI master as slave - * > - * > #include "mbed.h" - * > - * > SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel - * > - * > int main() { - * > device.reply(0x00); // Prime SPI with first reply - * > while(1) { - * > if(device.receive()) { - * > int v = device.read(); // Read byte from master - * > v = (v + 1) % 0x100; // Add one to it, modulo 256 - * > device.reply(v); // Make this the next reply - * > } - * > } - * > } + * @code + * // Reply to a SPI master as slave + * + * #include "mbed.h" + * + * SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel + * + * int main() { + * device.reply(0x00); // Prime SPI with first reply + * while(1) { + * if(device.receive()) { + * int v = device.read(); // Read byte from master + * v = (v + 1) % 0x100; // Add one to it, modulo 256 + * device.reply(v); // Make this the next reply + * } + * } + * } + * @endcode */ class SPISlave : public Base { public: - /* Constructor: SPI - * Create a SPI slave connected to the specified pins + /** Create a SPI slave connected to the specified pins * - * Variables: - * mosi - SPI Master Out, Slave In pin - * miso - SPI Master In, Slave Out pin - * sclk - SPI Clock pin - * ssel - SPI chip select pin - * name - (optional) A string to identify the object - * - * Pin Options: + * Pin Options: * (5, 6, 7i, 8) or (11, 12, 13, 14) * * mosi or miso can be specfied as NC if not used + * + * @param mosi SPI Master Out, Slave In pin + * @param miso SPI Master In, Slave Out pin + * @param sclk SPI Clock pin + * @param ssel SPI chip select pin + * @param name (optional) A string to identify the object */ SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel, const char *name = NULL); - /* Function: format - * Configure the data transmission format + /** Configure the data transmission format * - * Variables: - * bits - Number of bits per SPI frame (4 - 16) - * mode - Clock polarity and phase mode (0 - 3) + * @param bits Number of bits per SPI frame (4 - 16) + * @param mode Clock polarity and phase mode (0 - 3) * - * > mode | POL PHA - * > -----+-------- - * > 0 | 0 0 - * > 1 | 0 1 - * > 2 | 1 0 - * > 3 | 1 1 + * @code + * mode | POL PHA + * -----+-------- + * 0 | 0 0 + * 1 | 0 1 + * 2 | 1 0 + * 3 | 1 1 + * @endcode */ void format(int bits, int mode = 0); - /* Function: frequency - * Set the spi bus clock frequency + /** Set the spi bus clock frequency * - * Variables: - * hz - SCLK frequency in hz (default = 1MHz) + * @param hz SCLK frequency in hz (default = 1MHz) */ void frequency(int hz = 1000000); - /* Function: receive - * Polls the SPI to see if data has been received + /** Polls the SPI to see if data has been received * - * Variables: - * returns - zero if no data, 1 otherwise + * @returns + * 0 if no data, + * 1 otherwise */ int receive(void); - /* Function: read - * Retrieve data from receive buffer as slave + /** Retrieve data from receive buffer as slave * - * Variables: - * returns - the data in the receive buffer + * @returns + * the data in the receive buffer */ int read(void); - /* Function: reply - * Fill the transmission buffer with the value to be written out + /** Fill the transmission buffer with the value to be written out * as slave on the next received message from the master. * - * Variables: - * value - the data to be transmitted next + * @param value the data to be transmitted next */ void reply(int value); protected: - SPIName _spi; - + SPIName _spi; + int _bits; int _mode; int _hz;
--- a/Serial.h Wed Aug 29 12:44:47 2012 +0100 +++ b/Serial.h Wed Oct 24 10:44:49 2012 +0000 @@ -17,43 +17,41 @@ namespace mbed { -/* Class: Serial - * A serial port (UART) for communication with other serial devices +/** A serial port (UART) for communication with other serial devices * - * Can be used for Full Duplex communication, or Simplex by specifying - * one pin as NC (Not Connected) + * Can be used for Full Duplex communication, or Simplex by specifying + * one pin as NC (Not Connected) * * Example: - * > // Print "Hello World" to the PC - * > - * > #include "mbed.h" - * > - * > Serial pc(USBTX, USBRX); - * > - * > int main() { - * > pc.printf("Hello World\n"); - * > } + * @code + * // Print "Hello World" to the PC + * + * #include "mbed.h" + * + * Serial pc(USBTX, USBRX); + * + * int main() { + * pc.printf("Hello World\n"); + * } + * @endcode */ class Serial : public Stream { public: - /* Constructor: Serial - * Create a Serial port, connected to the specified transmit and receive pins + /** Create a Serial port, connected to the specified transmit and receive pins * - * Variables: - * tx - Transmit pin - * rx - Receive pin + * @param tx Transmit pin + * @param rx Receive pin * - * Note: Either tx or rx may be specified as NC if unused + * @note + * Either tx or rx may be specified as NC if unused */ Serial(PinName tx, PinName rx, const char *name = NULL); - /* Function: baud - * Set the baud rate of the serial port + /** Set the baud rate of the serial port * - * Variables: - * baudrate - The baudrate of the serial port (default = 9600). + * @param baudrate The baudrate of the serial port (default = 9600). */ void baud(int baudrate); @@ -70,90 +68,75 @@ , TxIrq }; - /* Function: format - * Set the transmission format used by the Serial port + /** Set the transmission format used by the Serial port * - * Variables: - * bits - The number of bits in a word (5-8; default = 8) - * parity - The parity used (Serial::None, Serial::Odd, Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None) - * stop - The number of stop bits (1 or 2; default = 1) + * @param bits The number of bits in a word (5-8; default = 8) + * @param parity The parity used (Serial::None, Serial::Odd, Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None) + * @param stop The number of stop bits (1 or 2; default = 1) */ void format(int bits = 8, Parity parity = Serial::None, int stop_bits = 1); #if 0 // Inhereted from Stream, for documentation only - /* Function: putc - * Write a character + /** Write a character * - * Variables: - * c - The character to write to the serial port + * @param c The character to write to the serial port */ int putc(int c); - /* Function: getc - * Read a character + /** Reads a character from the serial port. This will block until + * a character is available. To see if a character is available, + * see readable() * - * Reads a character from the serial port. This will block until - * a character is available. To see if a character is available, - * see <readable> - * - * Variables: - * returns - The character read from the serial port + * @returns + * The character read from the serial port */ int getc(); - /* Function: printf - * Write a formated string + /** Write a formated string * - * Variables: - * format - A printf-style format string, followed by the - * variables to use in formating the string. + * @param format A printf-style format string, followed by the + * variables to use in formating the string. */ int printf(const char* format, ...); - /* Function: scanf - * Read a formated string + /** Read a formated string * - * Variables: - * format - A scanf-style format string, - * followed by the pointers to variables to store the results. + * @param format A scanf-style format string, + * followed by the pointers to variables to store the results. */ int scanf(const char* format, ...); #endif - /* Function: readable - * Determine if there is a character available to read + /** Determine if there is a character available to read * - * Variables: - * returns - 1 if there is a character available to read, else 0 + * @returns + * 1 if there is a character available to read, + * 0 otherwise */ int readable(); - /* Function: writeable - * Determine if there is space available to write a character + /** Determine if there is space available to write a character * - * Variables: - * returns - 1 if there is space to write a character, else 0 + * @returns + * 1 if there is space to write a character, + * 0 otherwise */ int writeable(); - /* Function: attach - * Attach a function to call whenever a serial interrupt is generated + /** Attach a function to call whenever a serial interrupt is generated * - * Variables: - * fptr - A pointer to a void function, or 0 to set as none - * type - Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty) + * @param fptr A pointer to a void function, or 0 to set as none + * @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty) */ void attach(void (*fptr)(void), IrqType type = RxIrq); - /* Function: attach - * Attach a member function to call whenever a serial interrupt is generated + /** Attach a member function to call whenever a serial interrupt is generated * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called - * type - Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty) + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called + * @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty) */ template<typename T> void attach(T* tptr, void (T::*mptr)(void), IrqType type = RxIrq) {
--- a/SerialHalfDuplex.h Wed Aug 29 12:44:47 2012 +0100 +++ b/SerialHalfDuplex.h Wed Oct 24 10:44:49 2012 +0000 @@ -15,67 +15,64 @@ namespace mbed { -/* Class: SerialHalfDuplex - * A serial port (UART) for communication with other devices using - * Half-Duplex, allowing transmit and receive on a single - * shared transmit and receive line. Only one end should be transmitting - * at a time. +/** A serial port (UART) for communication with other devices using + * Half-Duplex, allowing transmit and receive on a single + * shared transmit and receive line. Only one end should be transmitting + * at a time. * - * Both the tx and rx pin should be defined, and wired together. - * This is in addition to them being wired to the other serial - * device to allow both read and write functions to operate. + * Both the tx and rx pin should be defined, and wired together. + * This is in addition to them being wired to the other serial + * device to allow both read and write functions to operate. + * + * For Simplex and Full-Duplex Serial communication, see Serial() + * + * Example: + * @code + * // Send a byte to a second HalfDuplex device, and read the response + * + * #include "mbed.h" * - * Example: - * > // Send a byte to a second HalfDuplex device, and read the response - * > - * > #include "mbed.h" - * > - * > // p9 and p10 should be wired together to form "a" - * > // p28 and p27 should be wired together to form "b" - * > // p9/p10 should be wired to p28/p27 as the Half Duplex connection - * > - * > SerialHalfDuplex a(p9, p10); - * > SerialHalfDuplex b(p28, p27); - * > - * > void b_rx() { // second device response - * > b.putc(b.getc() + 4); - * > } - * > - * > int main() { - * > b.attach(&b_rx); - * > for(int c = 'A'; c < 'Z'; c++) { - * > a.putc(c); - * > printf("sent [%c]\n", c); - * > wait(0.5); // b should respond - * > if(a.readable()) { - * > printf("received [%c]\n", a.getc()); - * > } - * > } - * > } - * - * For Simplex and Full-Duplex Serial communication, see <Serial> + * // p9 and p10 should be wired together to form "a" + * // p28 and p27 should be wired together to form "b" + * // p9/p10 should be wired to p28/p27 as the Half Duplex connection + * + * SerialHalfDuplex a(p9, p10); + * SerialHalfDuplex b(p28, p27); + * + * void b_rx() { // second device response + * b.putc(b.getc() + 4); + * } + * + * int main() { + * b.attach(&b_rx); + * for (int c = 'A'; c < 'Z'; c++) { + * a.putc(c); + * printf("sent [%c]\n", c); + * wait(0.5); // b should respond + * if (a.readable()) { + * printf("received [%c]\n", a.getc()); + * } + * } + * } + * @endcode */ class SerialHalfDuplex : public Serial { public: - /* Constructor: SerialHalfDuplex - * Create a half-duplex serial port, connected to the specified transmit - * and receive pins. + /** Create a half-duplex serial port, connected to the specified transmit + * and receive pins. * - * These pins should be wired together, as well as to the target device + * These pins should be wired together, as well as to the target device * - * Variables: - * tx - Transmit pin - * rx - Receive pin + * @param tx Transmit pin + * @param rx Receive pin */ SerialHalfDuplex(PinName tx, PinName rx, const char *name = NULL); #if 0 // Inherited from Serial class, for documentation - /* Function: baud - * Set the baud rate of the serial port + /** Set the baud rate of the serial port * - * Variables: - * baudrate - The baudrate of the serial port (default = 9600). + * @param baudrate The baudrate of the serial port (default = 9600). */ void baud(int baudrate); @@ -87,86 +84,73 @@ , Forced0 }; - /* Function: format - * Set the transmission format used by the Serial port + /** Set the transmission format used by the Serial port * - * Variables: - * bits - The number of bits in a word (5-8; default = 8) - * parity - The parity used (Serial::None, Serial::Odd, -Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None) - * stop - The number of stop bits (1 or 2; default = 1) + * @param bits The number of bits in a word (5-8; default = 8) + * @param parity The parity used (Serial::None, Serial::Odd, + * Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None) + * @param stop The number of stop bits (1 or 2; default = 1) */ void format(int bits = 8, Parity parity = Serial::None, int stop_bits = 1); - /* Function: putc - * Write a character + /** Write a character * - * Variables: - * c - The character to write to the serial port + * @param c The character to write to the serial port */ int putc(int c); - /* Function: getc - * Read a character + /** Read a character * - * Read a character from the serial port. This call will block - * until a character is available. For testing if a character is - * available for reading, see <readable>. + * Read a character from the serial port. This call will block + * until a character is available. For testing if a character is + * available for reading, see <readable>. * - * Variables: - * returns - The character read from the serial port + * @returns + * The character read from the serial port */ int getc(); - /* Function: printf - * Write a formated string + /** Write a formated string * - * Variables: - * format - A printf-style format string, followed by the - * variables to use in formating the string. + * @param format A printf-style format string, followed by the + * variables to use in formating the string. */ int printf(const char* format, ...); - /* Function: scanf - * Read a formated string + /** Read a formated string * - * Variables: - * format - A scanf-style format string, - * followed by the pointers to variables to store the results. + * @param format A scanf-style format string, + * followed by the pointers to variables to store the results. */ int scanf(const char* format, ...); - /* Function: readable - * Determine if there is a character available to read + /** Determine if there is a character available to read * - * Variables: - * returns - 1 if there is a character available to read, else 0 + * @returns + * 1 if there is a character available to read, + * 0 otherwise */ int readable(); - /* Function: writeable - * Determine if there is space available to write a character + /** Determine if there is space available to write a character * - * Variables: - * returns - 1 if there is space to write a character, else 0 + * @returns + * 1 if there is space to write a character, + * 0 otherwise */ int writeable(); - /* Function: attach - * Attach a function to call whenever a serial interrupt is generated + /** Attach a function to call whenever a serial interrupt is generated * - * Variables: - * fptr - A pointer to a void function, or 0 to set as none + * @param fptr A pointer to a void function, or 0 to set as none */ void attach(void (*fptr)(void)); - /* Function: attach - * Attach a member function to call whenever a serial interrupt is generated + /** Attach a member function to call whenever a serial interrupt is generated * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called */ template<typename T> void attach(T* tptr, void (T::*mptr)(void));
--- a/Ticker.h Wed Aug 29 12:44:47 2012 +0100 +++ b/Ticker.h Wed Oct 24 10:44:49 2012 +0000 @@ -10,86 +10,78 @@ namespace mbed { -/* Class: Ticker - * A Ticker is used to call a function at a recurring interval +/** A Ticker is used to call a function at a recurring interval * - * You can use as many seperate Ticker objects as you require. + * You can use as many seperate Ticker objects as you require. * * Example: - * > // Toggle the blinking led after 5 seconds - * > - * > #include "mbed.h" - * > - * > Ticker timer; - * > DigitalOut led1(LED1); - * > DigitalOut led2(LED2); - * > - * > int flip = 0; - * > - * > void attime() { - * > flip = !flip; - * > } - * > - * > int main() { - * > timer.attach(&attime, 5); - * > while(1) { - * > if(flip == 0) { - * > led1 = !led1; - * > } else { - * > led2 = !led2; - * > } - * > wait(0.2); - * > } - * > } + * @code + * // Toggle the blinking led after 5 seconds * + * #include "mbed.h" + * + * Ticker timer; + * DigitalOut led1(LED1); + * DigitalOut led2(LED2); + * + * int flip = 0; + * + * void attime() { + * flip = !flip; + * } + * + * int main() { + * timer.attach(&attime, 5); + * while(1) { + * if(flip == 0) { + * led1 = !led1; + * } else { + * led2 = !led2; + * } + * wait(0.2); + * } + * } + * @endcode */ class Ticker : public TimerEvent { public: - /* Function: attach - * Attach a function to be called by the Ticker, specifiying the interval in seconds + /** Attach a function to be called by the Ticker, specifiying the interval in seconds * - * Variables: - * fptr - pointer to the function to be called - * t - the time between calls in seconds + * @param fptr pointer to the function to be called + * @param t the time between calls in seconds */ void attach(void (*fptr)(void), float t) { attach_us(fptr, t * 1000000.0f); } - /* Function: attach - * Attach a member function to be called by the Ticker, specifiying the interval in seconds + /** Attach a member function to be called by the Ticker, specifiying the interval in seconds * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called - * t - the time between calls in seconds + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called + * @param t the time between calls in seconds */ template<typename T> void attach(T* tptr, void (T::*mptr)(void), float t) { attach_us(tptr, mptr, t * 1000000.0f); } - /* Function: attach_us - * Attach a function to be called by the Ticker, specifiying the interval in micro-seconds + /** Attach a function to be called by the Ticker, specifiying the interval in micro-seconds * - * Variables: - * fptr - pointer to the function to be called - * t - the time between calls in micro-seconds + * @param fptr pointer to the function to be called + * @param t the time between calls in micro-seconds */ void attach_us(void (*fptr)(void), unsigned int t) { _function.attach(fptr); setup(t); } - /* Function: attach_us - * Attach a member function to be called by the Ticker, specifiying the interval in micro-seconds + /** Attach a member function to be called by the Ticker, specifiying the interval in micro-seconds * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called - * t - the time between calls in micro-seconds + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called + * @param t the time between calls in micro-seconds */ template<typename T> void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) { @@ -97,8 +89,7 @@ setup(t); } - /* Function: detach - * Detach the function + /** Detach the function */ void detach();
--- a/Timeout.h Wed Aug 29 12:44:47 2012 +0100 +++ b/Timeout.h Wed Oct 24 10:44:49 2012 +0000 @@ -9,80 +9,73 @@ namespace mbed { -/* Class: Timeout - * A Timeout is used to call a function at a point in the future +/** A Timeout is used to call a function at a point in the future * - * You can use as many seperate Timeout objects as you require. + * You can use as many seperate Timeout objects as you require. * * Example: - * > // Blink until timeout. - * > - * > #include "mbed.h" - * > - * > Timeout timeout; - * > DigitalOut led(LED1); - * > - * > int on = 1; - * > - * > void attimeout() { - * > on = 0; - * > } - * > - * > int main() { - * > timeout.attach(&attimeout, 5); - * > while(on) { - * > led = !led; - * > wait(0.2); - * > } - * > } + * @code + * // Blink until timeout. + * + * #include "mbed.h" + * + * Timeout timeout; + * DigitalOut led(LED1); + * + * int on = 1; + * + * void attimeout() { + * on = 0; + * } + * + * int main() { + * timeout.attach(&attimeout, 5); + * while(on) { + * led = !led; + * wait(0.2); + * } + * } + * @endcode */ class Timeout : public Ticker { #if 0 // For documentation - /* Function: attach - * Attach a function to be called by the Timeout, specifiying the delay in seconds + /** Attach a function to be called by the Timeout, specifiying the delay in seconds * - * Variables: - * fptr - pointer to the function to be called - * t - the time before the call in seconds + * @param fptr pointer to the function to be called + * @param t the time before the call in seconds */ void attach(void (*fptr)(void), float t) { attach_us(fptr, t * 1000000.0f); } - /* Function: attach - * Attach a member function to be called by the Timeout, specifiying the delay in seconds + /** Attach a member function to be called by the Timeout, specifiying the delay in seconds * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called - * t - the time before the calls in seconds + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called + * @param t the time before the calls in seconds */ template<typename T> void attach(T* tptr, void (T::*mptr)(void), float t) { attach_us(tptr, mptr, t * 1000000.0f); } - /* Function: attach_us - * Attach a function to be called by the Timeout, specifiying the delay in micro-seconds + /** Attach a function to be called by the Timeout, specifiying the delay in micro-seconds * - * Variables: - * fptr - pointer to the function to be called - * t - the time before the call in micro-seconds + * @param fptr pointer to the function to be called + * @param t the time before the call in micro-seconds */ void attach_us(void (*fptr)(void), unsigned int t) { _function.attach(fptr); setup(t); } - /* Function: attach_us - * Attach a member function to be called by the Timeout, specifiying the delay in micro-seconds + /** Attach a member function to be called by the Timeout, specifiying the delay in micro-seconds * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called - * t - the time before the call in micro-seconds + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called + * @param t the time before the call in micro-seconds */ template<typename T> void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) { @@ -90,8 +83,7 @@ setup(t); } - /* Function: detach - * Detach the function + /** Detach the function */ void detach();
--- a/Timer.h Wed Aug 29 12:44:47 2012 +0100 +++ b/Timer.h Wed Oct 24 10:44:49 2012 +0000 @@ -12,25 +12,26 @@ namespace mbed { -/* Class: Timer - * A general purpose timer +/** A general purpose timer * * Example: - * > // Count the time to toggle a LED - * > - * > #include "mbed.h" - * > - * > Timer timer; - * > DigitalOut led(LED1); - * > int begin, end; - * > - * > int main() { - * > timer.start(); - * > begin = timer.read_us(); - * > led = !led; - * > end = timer.read_us(); - * > printf("Toggle the led takes %d us", end - begin); - * > } + * @code + * // Count the time to toggle a LED + * + * #include "mbed.h" + * + * Timer timer; + * DigitalOut led(LED1); + * int begin, end; + * + * int main() { + * timer.start(); + * begin = timer.read_us(); + * led = !led; + * end = timer.read_us(); + * printf("Toggle the led takes %d us", end - begin); + * } + * @endcode */ class Timer : public Base { @@ -38,35 +39,29 @@ Timer(const char *name = NULL); - /* Function: start - * Start the timer + /** Start the timer */ void start(); - /* Function: stop - * Stop the timer + /** Stop the timer */ void stop(); - /* Function: reset - * Reset the timer to 0. + /** Reset the timer to 0. * * If it was already counting, it will continue */ void reset(); - /* Function: read - * Get the time passed in seconds + /** Get the time passed in seconds */ float read(); - /* Function: read_ms - * Get the time passed in mili-seconds + /** Get the time passed in mili-seconds */ int read_ms(); - /* Function: read_us - * Get the time passed in micro-seconds + /** Get the time passed in micro-seconds */ int read_us();
--- a/TimerEvent.h Wed Aug 29 12:44:47 2012 +0100 +++ b/TimerEvent.h Wed Oct 24 10:44:49 2012 +0000 @@ -7,36 +7,51 @@ namespace mbed { -// Base abstraction for timer interrupts +/** Base abstraction for timer interrupts +*/ class TimerEvent { public: TimerEvent(); - // The handler registered with the underlying timer interrupt + /** The handler registered with the underlying timer interrupt + */ static void irq(); - // Destruction removes it... + /** Destruction removes it... + */ virtual ~TimerEvent(); protected: - // The handler called to service the timer event of the derived class + /** The handler called to service the timer event of the derived class + */ virtual void handler() = 0; - // insert in to linked list + /** Insert in to linked list + */ void insert(unsigned int timestamp); - // remove from linked list, if in it + /** Remove from linked list, if in it + */ void remove(); - // Get the current usec timestamp + /** Get the current usec timestamp + */ static unsigned int timestamp(); - static TimerEvent *_head; // The head of the list of the events, NULL if none - TimerEvent *_next; // Pointer to the next in the list, NULL if last - unsigned int _timestamp; // The timestamp at which the even should be triggered + /** The head of the list of the events, NULL if none + */ + static TimerEvent *_head; + + /** Pointer to the next in the list, NULL if last + */ + TimerEvent *_next; + + /** The timestamp at which the even should be triggered + */ + unsigned int _timestamp; };
--- a/error.h Wed Aug 29 12:44:47 2012 +0100 +++ b/error.h Wed Oct 24 10:44:49 2012 +0000 @@ -5,24 +5,29 @@ #ifndef MBED_ERROR_H #define MBED_ERROR_H -/* Reporting Compile-Time Errors: - * To generate a fatal compile-time error, you can use the pre-processor #error directive. +/** To generate a fatal compile-time error, you can use the pre-processor #error directive. * - * > #error "That shouldn't have happened!" + * @code + * #error "That shouldn't have happened!" + * @endcode * * If the compiler evaluates this line, it will report the error and stop the compile. * * For example, you could use this to check some user-defined compile-time variables: - * - * > #define NUM_PORTS 7 - * > #if (NUM_PORTS > 4) - * > #error "NUM_PORTS must be less than 4" - * > #endif + * + * @code + * #define NUM_PORTS 7 + * #if (NUM_PORTS > 4) + * #error "NUM_PORTS must be less than 4" + * #endif + * @endcode * * Reporting Run-Time Errors: * To generate a fatal run-time error, you can use the mbed error() function. * - * > error("That shouldn't have happened!"); + * @code + * error("That shouldn't have happened!"); + * @endcode * * If the mbed running the program executes this function, it will print the * message via the USB serial port, and then die with the blue lights of death! @@ -30,20 +35,20 @@ * The message can use printf-style formatting, so you can report variables in the * message too. For example, you could use this to check a run-time condition: * - * > if(x >= 5) { - * > error("expected x to be less than 5, but got %d", x); - * > } + * @code + * if(x >= 5) { + * error("expected x to be less than 5, but got %d", x); + * } + * #endcode */ #if 0 // for documentation only -/* Function: error - * Report a fatal runtime error +/** Report a fatal runtime error * - * Outputs the specified error message to stderr so it will appear via the USB - * serial port, and then calls exit(1) to die with the blue lights of death. + * Outputs the specified error message to stderr so it will appear via the USB + * serial port, and then calls exit(1) to die with the blue lights of death. * - * Variables: - * format - printf-style format string, followed by associated variables + * @param format printf-style format string, followed by associated variables */ void error(const char* format, ...); #endif
--- a/mbed_interface.h Wed Aug 29 12:44:47 2012 +0100 +++ b/mbed_interface.h Wed Oct 24 10:44:49 2012 +0000 @@ -1,5 +1,4 @@ -/* Title: mbed_interface - * Functions to control the mbed interface +/** Functions to control the mbed interface * * mbed Microcontrollers have a built-in interface to provide functionality such as * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file @@ -18,67 +17,63 @@ extern "C" { #endif -/* Function: mbed_interface_connected - * Determine whether the mbed interface is connected, based on whether debug is enabled +/** Determine whether the mbed interface is connected, based on whether debug is enabled * - * Variables: - * returns - 1 if interface is connected, else 0 + * @returns + * 1 if interface is connected, + * 0 otherwise */ int mbed_interface_connected(void); -/* Function: mbed_interface_reset - * Instruct the mbed interface to reset, as if the reset button had been pressed +/** Instruct the mbed interface to reset, as if the reset button had been pressed * - * Variables: - * returns - 1 if successful, else 0 (e.g. interface not present) + * @returns + * 1 if successful, + * 0 otherwise (e.g. interface not present) */ int mbed_interface_reset(void); -/* Function: mbed_interface_disconnect - * This will disconnect the debug aspect of the interface, so semihosting will be disabled. - * The interface will still support the USB serial aspect +/** This will disconnect the debug aspect of the interface, so semihosting will be disabled. + * The interface will still support the USB serial aspect * - * Variables: - * returns - 0 if successful, else -1 (e.g. interface not present) + * @returns + * 0 if successful, + * -1 otherwise (e.g. interface not present) */ int mbed_interface_disconnect(void); -/* Function: mbed_interface_powerdown - * This will disconnect the debug aspect of the interface, and if the USB cable is not - * connected, also power down the interface. If the USB cable is connected, the interface - * will remain powered up and visible to the host +/** This will disconnect the debug aspect of the interface, and if the USB cable is not + * connected, also power down the interface. If the USB cable is connected, the interface + * will remain powered up and visible to the host * - * Variables: - * returns - 0 if successful, else -1 (e.g. interface not present) + * @returns + * 0 if successful, + * -1 otherwise (e.g. interface not present) */ int mbed_interface_powerdown(void); -/* Function: mbed_interface_uid - * This returns a string containing the 32-character UID of the mbed interface +/** This returns a string containing the 32-character UID of the mbed interface + * This is a weak function that can be overwritten if required * - * This is a weak function that can be overwritten if required + * @param uid A 33-byte array to write the null terminated 32-byte string * - * Variables: - * uid - A 33-byte array to write the null terminated 32-byte string - * returns - 0 if successful, else -1 (e.g. interface not present) + * @returns + * 0 if successful, + * -1 otherwise (e.g. interface not present) */ int mbed_interface_uid(char *uid); -/* Function: mbed_mac_address - * This returns a unique 6-byte MAC address, based on the interface UID - * - * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00) +/** This returns a unique 6-byte MAC address, based on the interface UID + * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00) * - * This is a weak function that can be overwritten if you want to provide your own mechanism to - * provide a MAC address. - - * Variables: - * mac - A 6-byte array to write the MAC address + * This is a weak function that can be overwritten if you want to provide your own mechanism to + * provide a MAC address. + * + * @param mac A 6-byte array to write the MAC address */ void mbed_mac_address(char *mac); -/* Function: mbed_die - * Cause the mbed to flash the BLOD LED sequence +/** Cause the mbed to flash the BLOD LED sequence */ void mbed_die(void);
--- a/rpc.h Wed Aug 29 12:44:47 2012 +0100 +++ b/rpc.h Wed Oct 24 10:44:49 2012 +0000 @@ -5,8 +5,7 @@ #ifndef MBED_RPC_H #define MBED_RPC_H -/* Section rpc - * Helpers for rpc handling. +/** Helpers for rpc handling. */ #include <stdlib.h> @@ -20,12 +19,10 @@ namespace mbed { -/* Function parse_arg - * Parses and returns a value from a string. +/** Parses and returns a value from a string. * - * Variable - * arg - The string to pase - * next - If not NULL a pointer to after the last + * @param arg The string to pase + * @param next If not NULL a pointer to after the last * character parsed is written here */ template<typename T> T parse_arg(const char *arg, const char **next); @@ -222,7 +219,7 @@ pin = pin * 10 + pin2; } if(pin < 5 || pin > 30) { - return NC; + return NC; } return pin_names[pin - 5]; } else if(str[0] == 'L') { // LEDn @@ -259,12 +256,10 @@ } -/* Function write_result - * Writes a value in to a result string in an appropriate manner +/** Writes a value in to a result string in an appropriate manner * - * Variable - * val - The value to write - * result - A pointer to the array to write the value into + * @param val The value to write + * @param result A pointer to the array to write the value into */ template<typename T> void write_result(T val, char *result); @@ -356,7 +351,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<class T, void (T::*member)(const char *,char *)> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -364,7 +359,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<class T, void (T::*member)()> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -375,7 +370,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<class T, typename A1, void (T::*member)(A1)> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -390,7 +385,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<class T, typename A1, typename A2, void (T::*member)(A1,A2)> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -406,7 +401,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<class T, typename A1, typename A2, typename A3, void (T::*member)(A1,A2,A3)> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -423,7 +418,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<typename R, class T, R (T::*member)()> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -434,7 +429,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<typename R, class T, typename A1, R (T::*member)(A1)> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -449,7 +444,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<typename R, class T, typename A1, typename A2, R (T::*member)(A1,A2)> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -465,7 +460,7 @@ } -/* Function rpc_method_caller +/** rpc_method_caller */ template<typename R, class T, typename A1, typename A2, typename A3, R (T::*member)(A1,A2,A3)> void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { @@ -482,7 +477,7 @@ } -/* Function rpc_function caller +/** rpc_function caller */ template<typename R, R (*func)()> void rpc_function_caller(const char *arguments, char *result) { @@ -493,7 +488,7 @@ } -/* Function rpc_function caller +/** rpc_function caller */ template<typename R, typename A1, R (*func)(A1)> void rpc_function_caller(const char *arguments, char *result) { @@ -505,7 +500,7 @@ } -/* Function rpc_function caller +/** rpc_function caller */ template<typename R, typename A1, typename A2, R (*func)(A1,A2)> void rpc_function_caller(const char *arguments, char *result) { @@ -521,7 +516,7 @@ } -/* Function rpc_function caller +/** rpc_function caller */ template<typename R, typename A1, typename A2, typename A3, R (*func)(A1,A2,A3)> void rpc_function_caller(const char *arguments, char *result) { @@ -538,7 +533,7 @@ } -/* Function rpc_function caller +/** rpc_function caller */ template<typename R, typename A1, typename A2, typename A3, typename A4, R (*func)(A1,A2,A3,A4)> void rpc_function_caller(const char *arguments, char *result) { @@ -574,15 +569,13 @@ #define RPC_METHOD_END { NULL, NULL } #define RPC_METHOD_SUPER(C) { NULL, (rpc_method::caller_t)(rpc_method::super_t)rpc_super<C> } -/* Function rpc - * Parse a string describing a call and then do it +/** Parse a string describing a call and then do it * - * Variables - * call - A pointer to a string describing the call, which has - * the form /object/method arg ... argn. Arguments are - * delimited by space characters, and the string is terminated - * by a null character. - * result - A pointer to an array to write the result into. + * @param call A pointer to a string describing the call, which has + * the form /object/method arg ... argn. Arguments are + * delimited by space characters, and the string is terminated + * by a null character. + * @param result A pointer to an array to write the result into. */ bool rpc(const char *buf, char *result = 0);
--- a/rtc_time.h Wed Aug 29 12:44:47 2012 +0100 +++ b/rtc_time.h Wed Oct 24 10:44:49 2012 +0000 @@ -1,30 +1,31 @@ -/* Title: time - * Implementation of the C time.h functions +/** Implementation of the C time.h functions * * Provides mechanisms to set and read the current time, based * on the microcontroller Real-Time Clock (RTC), plus some * standard C manipulation and formating functions. * * Example: - * > #include "mbed.h" - * > - * > int main() { - * > set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37 - * > - * > while(1) { - * > time_t seconds = time(NULL); - * > - * > printf("Time as seconds since January 1, 1970 = %d\n", seconds); - * > - * > printf("Time as a basic string = %s", ctime(&seconds)); - * > - * > char buffer[32]; - * > strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); - * > printf("Time as a custom formatted string = %s", buffer); - * > - * > wait(1); - * > } - * > } + * @code + * #include "mbed.h" + * + * int main() { + * set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37 + * + * while(1) { + * time_t seconds = time(NULL); + * + * printf("Time as seconds since January 1, 1970 = %d\n", seconds); + * + * printf("Time as a basic string = %s", ctime(&seconds)); + * + * char buffer[32]; + * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); + * printf("Time as a custom formatted string = %s", buffer); + * + * wait(1); + * } + * } + * @endcode */ /* mbed Microcontroller Library - rtc_time @@ -38,165 +39,169 @@ #endif #if 0 // for documentation only -/* Function: time - * Get the current time +/** Get the current time * - * Returns the current timestamp as the number of seconds since January 1, 1970 - * (the UNIX timestamp). The value is based on the current value of the - * microcontroller Real-Time Clock (RTC), which can be set using <set_time>. + * Returns the current timestamp as the number of seconds since January 1, 1970 + * (the UNIX timestamp). The value is based on the current value of the + * microcontroller Real-Time Clock (RTC), which can be set using <set_time>. + * + * @param t Pointer to a time_t to be set, or NULL if not used + * + * @returns + * Number of seconds since January 1, 1970 (the UNIX timestamp) * * Example: - * > #include "mbed.h" - * > - * > int main() { - * > time_t seconds = time(NULL); - * > printf("It is %d seconds since January 1, 1970\n", seconds); - * > } - * - * Variables: - * t - Pointer to a time_t to be set, or NULL if not used - * returns - Number of seconds since January 1, 1970 (the UNIX timestamp) + * @code + * #include "mbed.h" + * + * int main() { + * time_t seconds = time(NULL); + * printf("It is %d seconds since January 1, 1970\n", seconds); + * } + * @endcode */ time_t time(time_t *t); #endif -/* Function: set_time - * Set the current time +/** Set the current time * * Initialises and sets the time of the microcontroller Real-Time Clock (RTC) * to the time represented by the number of seconds since January 1, 1970 * (the UNIX timestamp). * + * @param t Number of seconds since January 1, 1970 (the UNIX timestamp) + * * Example: - * > #include "mbed.h" - * > - * > int main() { - * > set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37 - * > } + * @code + * #include "mbed.h" * - * Variables: - * t - Number of seconds since January 1, 1970 (the UNIX timestamp) + * int main() { + * set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37 + * } + * @endcode */ void set_time(time_t t); #if 0 // for documentation only -/* Function: mktime - * Converts a tm structure in to a timestamp - * - * Converts the tm structure in to a timestamp in seconds since January 1, 1970 - * (the UNIX timestamp). The values of tm_wday and tm_yday of the tm structure - * are also updated to their appropriate values. +/** Converts the tm structure in to a timestamp in seconds since January 1, 1970 + * (the UNIX timestamp). The values of tm_wday and tm_yday of the tm structure + * are also updated to their appropriate values. + * + * @param t The tm structure to convert + * + * @returns + * The converted timestamp * * Example: - * > #include "mbed.h" - * > - * > int main() { - * > // setup time structure for Wed, 28 Oct 2009 11:35:37 - * > struct tm t; - * > t.tm_sec = 37; // 0-59 - * > t.tm_min = 35; // 0-59 - * > t.tm_hour = 11; // 0-23 - * > t.tm_mday = 28; // 1-31 - * > t.tm_mon = 9; // 0-11 - * > t.tm_year = 109; // year since 1900 - * > - * > // convert to timestamp and display (1256729737) - * > time_t seconds = mktime(&t); - * > printf("Time as seconds since January 1, 1970 = %d\n", seconds); - * > } + * @code + * #include "mbed.h" + * + * int main() { + * // setup time structure for Wed, 28 Oct 2009 11:35:37 + * struct tm t; + * t.tm_sec = 37; // 0-59 + * t.tm_min = 35; // 0-59 + * t.tm_hour = 11; // 0-23 + * t.tm_mday = 28; // 1-31 + * t.tm_mon = 9; // 0-11 + * t.tm_year = 109; // year since 1900 * - * Variables: - * t - The tm structure to convert - * returns - The converted timestamp + * // convert to timestamp and display (1256729737) + * time_t seconds = mktime(&t); + * printf("Time as seconds since January 1, 1970 = %d\n", seconds); + * } + * @endcode */ time_t mktime(struct tm *t); #endif #if 0 // for documentation only -/* Function: localtime - * Converts a timestamp in to a tm structure - * - * Converts the timestamp pointed to by t to a (statically allocated) - * tm structure. +/** Converts the timestamp pointed to by t to a (statically allocated) + * tm structure. + * + * @param t Pointer to the timestamp + * + * @returns + * Pointer to the (statically allocated) tm structure * * Example: - * > #include "mbed.h" - * > - * > int main() { - * > time_t seconds = 1256729737; - * > struct tm *t = localtime(&seconds); - * > } - * - * Variables: - * t - Pointer to the timestamp - * returns - Pointer to the (statically allocated) tm structure + * @code + * #include "mbed.h" + * + * int main() { + * time_t seconds = 1256729737; + * struct tm *t = localtime(&seconds); + * } + * @endcode */ struct tm *localtime(const time_t *t); #endif #if 0 // for documentation only -/* Function: ctime - * Converts a timestamp to a human-readable string +/** Converts a timestamp to a human-readable string * * Converts a time_t timestamp in seconds since January 1, 1970 (the UNIX * timestamp) to a human readable string format. The result is of the * format: "Wed Oct 28 11:35:37 2009\n" * * Example: - * > #include "mbed.h" - * > - * > int main() { - * > time_t seconds = time(NULL); - * > printf("Time as a string = %s", ctime(&seconds)); - * > } + * @code + * #include "mbed.h" + * + * int main() { + * time_t seconds = time(NULL); + * printf("Time as a string = %s", ctime(&seconds)); + * } + * @endcode * - * Variables: - * t - The timestamp to convert - * returns - Pointer to a (statically allocated) string containing the + * @param t The timestamp to convert + * + * @returns Pointer to a (statically allocated) string containing the * human readable representation, including a '\n' character */ char *ctime(const time_t *t); #endif #if 0 // for documentation only -/* Function: strftime - * Converts a tm structure to a custom format human-readable string +/** Converts a tm structure to a custom format human-readable string * * Creates a formated string from a tm structure, based on a string format * specifier provided. * * Format Specifiers: - * %S - Second (00-59) - * %M - Minute (00-59) - * %H - Hour (00-23) - * %d - Day (01-31) - * %m - Month (01-12) - * %Y/%y - Year (2009/09) + * - %S - Second (00-59) + * - %M - Minute (00-59) + * - %H - Hour (00-23) + * - %d - Day (01-31) + * - %m - Month (01-12) + * - %Y/%y - Year (2009/09) + * - %A/%a - Weekday Name (Monday/Mon) + * - %B/%b - Month Name (January/Jan) + * - %I - 12 Hour Format (01-12) + * - %p - "AM" or "PM" + * - %X - Time (14:55:02) + * - %x - Date (08/23/01) * - * %A/%a - Weekday Name (Monday/Mon) - * %B/%b - Month Name (January/Jan) - * %I - 12 Hour Format (01-12) - * %p - "AM" or "PM" - * %X - Time (14:55:02) - * %x - Date (08/23/01) + * @param buffer String buffer to store the result + * @param max Maximum number of characters to store in the buffer + * @param format Format specifier string + * @param t Pointer to the tm structure to convert + * + * @returns + * Number of characters copied * * Example: - * > #include "mbed.h" - * > - * > int main() { - * > time_t seconds = time(NULL); - * > - * > char buffer[32]; - * > strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); - * > printf("Time as a formatted string = %s", buffer); - * > } + * @code + * #include "mbed.h" * - * Variables: - * buffer - String buffer to store the result - * max - Maximum number of characters to store in the buffer - * format - Format specifier string - * t - Pointer to the tm structure to convert - * returns - Number of characters copied + * int main() { + * time_t seconds = time(NULL); + * + * char buffer[32]; + * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); + * printf("Time as a formatted string = %s", buffer); + * } + * @endcode */ size_t strftime(char *buffer, size_t max, const char *format, const struct tm *t); #endif
--- a/wait_api.h Wed Aug 29 12:44:47 2012 +0100 +++ b/wait_api.h Wed Oct 24 10:44:49 2012 +0000 @@ -1,21 +1,21 @@ -/* Title: wait - * Generic wait functions. +/** Generic wait functions. * * These provide simple NOP type wait capabilities. * * Example: - * > #include "mbed.h" - * > - * > DigitalOut heartbeat(LED1); - * > - * > int main() { - * > while (1) { - * > heartbeat = 1; - * > wait(0.5); - * > heartbeat = 0; - * > wait(0.5); - * > } - * > } + * @code + * #include "mbed.h" + * + * DigitalOut heartbeat(LED1); + * + * int main() { + * while (1) { + * heartbeat = 1; + * wait(0.5); + * heartbeat = 0; + * wait(0.5); + * } + * } */ /* mbed Microcontroller Library - wait_api @@ -29,60 +29,54 @@ extern "C" { #endif -/* Function: wait - * Waits for a number of seconds, with microsecond resolution (within +/** Waits for a number of seconds, with microsecond resolution (within * the accuracy of single precision floating point). * - * Variables: - * s - number of seconds to wait + * @param s number of seconds to wait */ void wait(float s); -/* Function: wait_ms - * Waits a number of milliseconds. +/** Waits a number of milliseconds. * - * Variables: - * ms - the whole number of milliseconds to wait + * @param ms the whole number of milliseconds to wait */ void wait_ms(int ms); -/* Function: wait_us - * Waits a number of microseconds. +/** Waits a number of microseconds. * - * Variables: - * us - the whole number of microseconds to wait + * @param us the whole number of microseconds to wait */ void wait_us(int us); #ifdef TARGET_LPC11U24 -/* Function: sleep - * Send the microcontroller to sleep +/** Send the microcontroller to sleep + * + * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the + * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates + * dynamic power used by the processor, memory systems and buses. The processor, peripheral and + * memory state are maintained, and the peripherals continue to work and can generate interrupts. * - * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the - * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates - * dynamic power used by the processor, memory systems and buses. The processor, peripheral and - * memory state are maintained, and the peripherals continue to work and can generate interrupts. + * The processor can be woken up by any internal peripheral interrupt or external pin interrupt. * - * The processor can be woken up by any internal peripheral interrupt or external pin interrupt. - * - * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. - * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be - * able to access the LocalFileSystem + * @note + * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. + * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be + * able to access the LocalFileSystem */ void sleep(void); -/* Function: deepsleep - * Send the microcontroller to deep sleep +/** Send the microcontroller to deep sleep + * + * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode + * has the same sleep features as sleep plus it powers down peripherals and clocks. All state + * is still maintained. * - * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode - * has the same sleep features as sleep plus it powers down peripherals and clocks. All state - * is still maintained. + * The processor can only be woken up by an external interrupt on a pin or a watchdog timer. * - * The processor can only be woken up by an external interrupt on a pin or a watchdog timer. - * - * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. - * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be - * able to access the LocalFileSystem + * @note + * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. + * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be + * able to access the LocalFileSystem */ void deepsleep(void); #endif