An analog output, used for setting the voltage on a pin. More...
#include <AnalogOut.h>
Public Member Functions | |
AnalogOut (PinName pin) | |
Create an AnalogOut connected to the specified pin. More... | |
void | write (float value) |
Set the output voltage, specified as a percentage (float) More... | |
void | write_u16 (unsigned short value) |
Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]. More... | |
float | read () |
Return the current output voltage setting, measured as a percentage (float) More... | |
AnalogOut & | operator= (float percent) |
An operator shorthand for write() More... | |
AnalogOut & | operator= (AnalogOut &rhs) |
An operator shorthand for write() More... | |
operator float () | |
An operator shorthand for read() More... | |
virtual | ~AnalogOut () |
An analog output, used for setting the voltage on a pin.
Example:
Definition at line 56 of file AnalogOut.h.
AnalogOut | ( | PinName | pin | ) |
Create an AnalogOut connected to the specified pin.
pin | AnalogOut pin to connect to |
Definition at line 64 of file AnalogOut.h.
|
virtual |
Deinitialize pin configuration.
Definition at line 126 of file AnalogOut.h.
operator float | ( | ) |
An operator shorthand for read()
Definition at line 120 of file AnalogOut.h.
AnalogOut& operator= | ( | float | percent | ) |
An operator shorthand for write()
Definition at line 100 of file AnalogOut.h.
An operator shorthand for write()
Definition at line 110 of file AnalogOut.h.
float read | ( | ) |
Return the current output voltage setting, measured as a percentage (float)
void write | ( | float | value | ) |
Set the output voltage, specified as a percentage (float)
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. |
void write_u16 | ( | unsigned short | value | ) |
Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF].
value | 16-bit unsigned short representing the output voltage, normalized to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v) |