|
USB EPROM/Flash Programmer
|
DC To DC Converter Class. More...
#include <dc2dc.hpp>
Public Member Functions | |
| Dc2Dc () | |
| Constructor. More... | |
| Dc2Dc (const Dc2DcConfig &config) | |
| Constructor. More... | |
| ~Dc2Dc () | |
| Destructor. More... | |
| void | configure (const Dc2DcConfig &config) |
| Configures the DC to DC converter. More... | |
| Dc2DcConfig | getConfig () const |
| Gets the current configuration data. More... | |
| void | setCalibration (float value) |
| Sets the calibration value (offset) of the output of DC2DC converter. More... | |
| float | getCalibration () const |
| Returns the calibration value of the output of DC2DC converter. More... | |
| bool | start () |
| Starts the DC to DC converter. More... | |
| bool | stop () |
| Stops the DC to DC converter. More... | |
| bool | isRunning () const |
| Returns if the converter is running. More... | |
| void | adjust () |
| Adjusts the PWM duty cycle value to the output reaches the target voltage. More... | |
| void | setV (float v) |
| Sets the target output voltage of the converter. More... | |
| float | getV () const |
| Gets the current output voltage of the converter. More... | |
| float | getVTarget () const |
| Gets the target output voltage of the converter. More... | |
| float | getDuty () const |
| Gets the current duty cycle of the PWM. More... | |
DC To DC Converter Class.
The purpose of this class is to provide the methods to manipulate a DC To DC converter via software (using the CPU's PWM and ADC modules).
| Dc2Dc | ( | ) |
Constructor.
Assumes a default value for the configuration.
|
explicit |
Constructor.
| config | Configuration data. |
| ~Dc2Dc | ( | ) |
Destructor.
| void configure | ( | const Dc2DcConfig & | config | ) |
Configures the DC to DC converter.
If the converter is running, then it's stopped before.
| config | Configuration data. |
| Dc2DcConfig getConfig | ( | ) | const |
Gets the current configuration data.
| void setCalibration | ( | float | value | ) |
Sets the calibration value (offset) of the output of DC2DC converter.
| value | Calibration value. |
| float getCalibration | ( | ) | const |
Returns the calibration value of the output of DC2DC converter.
| bool start | ( | ) |
Starts the DC to DC converter.
If the configuration is invalid, then fails.
| bool stop | ( | ) |
Stops the DC to DC converter.
If the configuration is invalid, then fails.
| bool isRunning | ( | ) | const |
Returns if the converter is running.
| void adjust | ( | ) |
Adjusts the PWM duty cycle value to the output reaches the target voltage.
This method must be called periodically in a loop, so that the DC to DC converter works properly.
| void setV | ( | float | v | ) |
Sets the target output voltage of the converter.
| v | Target output voltage, in Volts. |
| float getV | ( | ) | const |
Gets the current output voltage of the converter.
| float getVTarget | ( | ) | const |
Gets the target output voltage of the converter.
| float getDuty | ( | ) | const |
Gets the current duty cycle of the PWM.