Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed by
Diff: AnalogIn.h
- Revision:
- 11:1c1ebd0324fa
- Parent:
- 5:62573be585e9
- Child:
- 27:7110ebee3484
--- a/AnalogIn.h Thu May 14 14:44:00 2009 +0000 +++ b/AnalogIn.h Fri Aug 28 12:10:11 2009 +0000 @@ -6,6 +6,9 @@ #ifndef MBED_ANALOGIN_H #define MBED_ANALOGIN_H +#include "platform.h" +#include "PinNames.h" +#include "PeripheralNames.h" #include "Base.h" namespace mbed { @@ -18,7 +21,7 @@ * > * > #include "mbed.h" * > - * > AnalogIn temperature(20); + * > AnalogIn temperature(p20); * > * > int main() { * > while(1) { @@ -36,17 +39,17 @@ * Create an AnalogIn, connected to the specified pin * * Variables: - * pin - AnalogIn pin to connect to (15 - 20) + * pin - AnalogIn pin to connect to * name - (optional) A string to identify the object */ - AnalogIn(int pin, const char *name = NULL); + AnalogIn(PinName pin, const char *name = NULL); /* Function: read * 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 (0.0 = 0v, 1.0 = 3.3v) + * measured as a percentage */ float read(); @@ -55,14 +58,11 @@ * * Variables: * returns - 16-bit unsigned short representing the current input voltage, - * normalised to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v) + * normalised to a 16-bit value */ unsigned short read_u16(); - // functions to be removed in time... - float read_v(); - int read_mv(); - +#ifdef MBED_OPERATORS /* Function: operator float * An operator shorthand for <read()> * @@ -75,18 +75,20 @@ * > if(volume.read() > 0.25) { ... } * > if(volume > 0.25) { ... } */ - operator float(); + operator float(); +#endif +#ifdef MBED_RPC virtual const struct rpc_method *get_rpc_methods(); static struct rpc_class *get_rpc_class(); +#endif protected: - - int _id; - + + ADCName _adc; + }; -} +} // namespace mbed #endif -