#include <yocto_pwmoutput.h>
Public Member Functions | |
virtual int | _invokeValueCallback (string value) |
double | dutyCycle (void) |
double | dutyCycleAtPowerOn (void) |
virtual int | dutyCycleMove (double target, int ms_duration) |
Y_ENABLED_enum | enabled (void) |
Y_ENABLEDATPOWERON_enum | enabledAtPowerOn (void) |
double | frequency (void) |
double | get_dutyCycle (void) |
double | get_dutyCycleAtPowerOn (void) |
Y_ENABLED_enum | get_enabled (void) |
Y_ENABLEDATPOWERON_enum | get_enabledAtPowerOn (void) |
double | get_frequency (void) |
double | get_period (void) |
double | get_pulseDuration (void) |
string | get_pwmTransition (void) |
YPwmOutput * | next (void) |
YPwmOutput * | nextPwmOutput (void) |
double | period (void) |
double | pulseDuration (void) |
virtual int | pulseDurationMove (double ms_target, int ms_duration) |
string | pwmTransition (void) |
virtual int | registerValueCallback (YPwmOutputValueCallback callback) |
int | set_dutyCycle (double newval) |
int | set_dutyCycleAtPowerOn (double newval) |
int | set_enabled (Y_ENABLED_enum newval) |
int | set_enabledAtPowerOn (Y_ENABLEDATPOWERON_enum newval) |
int | set_frequency (double newval) |
int | set_period (double newval) |
int | set_pulseDuration (double newval) |
int | set_pwmTransition (const string &newval) |
int | setDutyCycle (double newval) |
int | setDutyCycleAtPowerOn (double newval) |
int | setEnabled (Y_ENABLED_enum newval) |
int | setEnabledAtPowerOn (Y_ENABLEDATPOWERON_enum newval) |
int | setFrequency (double newval) |
int | setPeriod (double newval) |
int | setPulseDuration (double newval) |
int | setPwmTransition (const string &newval) |
~YPwmOutput () | |
Public Member Functions inherited from YFunction | |
void | _clearDataStreamCache () |
string | _decode_json_string (const string &json) |
string | _download (const string &url) |
YDataStream * | _findDataStream (YDataSet &dataset, const string &def) |
string | _get_json_path (const string &json, const string &path) |
vector< string > | _json_get_array (const string &json) |
string | _json_get_key (const string &json, const string &data) |
string | _json_get_string (const string &json) |
int | _parseEx (yJsonStateMachine &j) |
virtual int | _parserHelper (void) |
string | _parseString (yJsonStateMachine &j) |
string | _request (const string &request) |
string | _requestEx (int tcpchan, const string &request, yapiRequestProgressCallback callback, void *context) |
void | _throw (YRETCODE errType, string errMsg) |
YRETCODE | _upload (const string &path, const string &content) |
YRETCODE | _uploadWithProgress (const string &path, const string &content, yapiRequestProgressCallback callback, void *context) |
string | advertisedValue (void) |
void | clearCache () |
string | describe (void) |
string | errMessage (void) |
string | errorMessage (void) |
YRETCODE | errorType (void) |
YRETCODE | errType (void) |
YFUN_DESCR | functionDescriptor (void) |
string | get_advertisedValue (void) |
string | get_errorMessage (void) |
YRETCODE | get_errorType (void) |
virtual string | get_friendlyName (void) |
YFUN_DESCR | get_functionDescriptor (void) |
string | get_functionId (void) |
string | get_hardwareId (void) |
string | get_hubSerial () |
string | get_logicalName (void) |
YModule * | get_module (void) |
void * | get_userData (void) |
bool | isOnline (void) |
YRETCODE | load (int msValidity) |
virtual string | loadAttribute (string attrName) |
string | logicalName (void) |
YModule * | module (void) |
virtual int | muteValueCallbacks (void) |
YFunction * | next (void) |
YFunction * | nextFunction (void) |
virtual int | registerValueCallback (YFunctionValueCallback callback) |
int | set_advertisedValue (const string &newval) |
int | set_logicalName (const string &newval) |
void | set_userData (void *data) |
int | setAdvertisedValue (const string &newval) |
int | setLogicalName (const string &newval) |
void | setUserData (void *data) |
virtual int | unmuteValueCallbacks (void) |
void * | userData (void) |
virtual | ~YFunction () |
Static Public Member Functions | |
static YPwmOutput * | Find (string func) |
static YPwmOutput * | FindPwmOutput (string func) |
static YPwmOutput * | First (void) |
static YPwmOutput * | FirstPwmOutput (void) |
Static Public Member Functions inherited from YFunction | |
static void | _ClearCache (void) |
static YFunction * | Find (string func) |
static YFunction * | FindFunction (string func) |
static YFunction * | First (void) |
static YFunction * | FirstFunction (void) |
Protected Member Functions | |
virtual int | _parseAttr (YJSONObject *json_val) |
YPwmOutput (const string &func) | |
Protected Member Functions inherited from YFunction | |
YRETCODE | _buildSetRequest (const string &changeattr, const string *changeval, string &request, string &errmsg) |
string | _escapeAttr (const string &changeval) |
YRETCODE | _getDescriptor (YFUN_DESCR &fundescr, string &errMsg) |
YRETCODE | _getDevice (YDevice *&dev, string &errMsg) |
YRETCODE | _load_unsafe (int msValidity) |
YRETCODE | _nextFunction (string &hwId) |
int | _parse (YJSONObject *j) |
YRETCODE | _setAttr (string attrname, string newvalue) |
YFunction (const string &func) | |
Protected Attributes | |
double | _dutyCycle |
double | _dutyCycleAtPowerOn |
Y_ENABLED_enum | _enabled |
Y_ENABLEDATPOWERON_enum | _enabledAtPowerOn |
double | _frequency |
double | _period |
double | _pulseDuration |
string | _pwmTransition |
YPwmOutputValueCallback | _valueCallbackPwmOutput |
Protected Attributes inherited from YFunction | |
string | _advertisedValue |
u64 | _cacheExpiration |
string | _className |
std::map< string, YDataStream * > | _dataStreams |
string | _func |
YFUN_DESCR | _fundescr |
string | _funId |
string | _hwId |
string | _lastErrorMsg |
YRETCODE | _lastErrorType |
string | _logicalName |
string | _serial |
yCRITICAL_SECTION | _this_cs |
void * | _userData |
YFunctionValueCallback | _valueCallbackFunction |
Friends | |
YPwmOutput * | yFindPwmOutput (const string &func) |
YPwmOutput * | yFirstPwmOutput (void) |
Additional Inherited Members | |
Static Protected Member Functions inherited from YFunction | |
static void | _AddToCache (const string &classname, const string &func, YFunction *obj) |
static YFunction * | _FindFromCache (const string &classname, const string &func) |
static void | _UpdateTimedReportCallbackList (YFunction *func, bool add) |
static void | _UpdateValueCallbackList (YFunction *func, bool add) |
Static Protected Attributes inherited from YFunction | |
static std::map< string, YFunction * > | _cache |
YPwmOutput Class: PwmOutput function interface
The Yoctopuce application programming interface allows you to configure, start, and stop the PWM.
Definition at line 85 of file yocto_pwmoutput.h.
|
protected |
Definition at line 51 of file yocto_pwmoutput.cpp.
YPwmOutput::~YPwmOutput | ( | ) |
Definition at line 67 of file yocto_pwmoutput.cpp.
|
virtual |
Reimplemented from YFunction.
Definition at line 613 of file yocto_pwmoutput.cpp.
|
protectedvirtual |
Reimplemented from YFunction.
Definition at line 81 of file yocto_pwmoutput.cpp.
|
inline |
Definition at line 228 of file yocto_pwmoutput.h.
|
inline |
Definition at line 319 of file yocto_pwmoutput.h.
|
virtual |
Performs a smooth change of the pulse duration toward a given value.
target | : new duty cycle at the end of the transition (floating-point number, between 0 and 1) |
ms_duration | : total duration of the transition, in milliseconds |
On failure, throws an exception or returns a negative error code.
Definition at line 656 of file yocto_pwmoutput.cpp.
|
inline |
Definition at line 139 of file yocto_pwmoutput.h.
|
inline |
Definition at line 277 of file yocto_pwmoutput.h.
|
inlinestatic |
Definition at line 395 of file yocto_pwmoutput.h.
|
static |
Retrieves a PWM for a given identifier. The identifier can be specified using several formats:
This function does not require that the PWM is online at the time it is invoked. The returned object is nevertheless valid. Use the method YPwmOutput.isOnline() to test if the PWM is indeed online at a given time. In case of ambiguity when looking for a PWM by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.
If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.
func | : a string that uniquely characterizes the PWM |
Definition at line 562 of file yocto_pwmoutput.cpp.
|
inlinestatic |
Definition at line 419 of file yocto_pwmoutput.h.
|
static |
Starts the enumeration of PWMs currently accessible. Use the method YPwmOutput.nextPwmOutput() to iterate on next PWMs.
Definition at line 679 of file yocto_pwmoutput.cpp.
|
inline |
Definition at line 178 of file yocto_pwmoutput.h.
double YPwmOutput::get_dutyCycle | ( | void | ) |
Returns the PWM duty cycle, in per cents.
On failure, throws an exception or returns Y_DUTYCYCLE_INVALID.
Definition at line 306 of file yocto_pwmoutput.cpp.
double YPwmOutput::get_dutyCycleAtPowerOn | ( | void | ) |
Returns the PWMs duty cycle at device power on as a floating point number between 0 and 100.
On failure, throws an exception or returns Y_DUTYCYCLEATPOWERON_INVALID.
Definition at line 513 of file yocto_pwmoutput.cpp.
Y_ENABLED_enum YPwmOutput::get_enabled | ( | void | ) |
Returns the state of the PWMs.
On failure, throws an exception or returns Y_ENABLED_INVALID.
Definition at line 118 of file yocto_pwmoutput.cpp.
Y_ENABLEDATPOWERON_enum YPwmOutput::get_enabledAtPowerOn | ( | void | ) |
Returns the state of the PWM at device power on.
On failure, throws an exception or returns Y_ENABLEDATPOWERON_INVALID.
Definition at line 430 of file yocto_pwmoutput.cpp.
double YPwmOutput::get_frequency | ( | void | ) |
Returns the PWM frequency in Hz.
On failure, throws an exception or returns Y_FREQUENCY_INVALID.
Definition at line 198 of file yocto_pwmoutput.cpp.
double YPwmOutput::get_period | ( | void | ) |
Returns the PWM period in milliseconds.
On failure, throws an exception or returns Y_PERIOD_INVALID.
Definition at line 252 of file yocto_pwmoutput.cpp.
double YPwmOutput::get_pulseDuration | ( | void | ) |
Returns the PWM pulse length in milliseconds, as a floating point number.
On failure, throws an exception or returns Y_PULSEDURATION_INVALID.
Definition at line 362 of file yocto_pwmoutput.cpp.
string YPwmOutput::get_pwmTransition | ( | void | ) |
Definition at line 384 of file yocto_pwmoutput.cpp.
|
inline |
Definition at line 406 of file yocto_pwmoutput.h.
YPwmOutput * YPwmOutput::nextPwmOutput | ( | void | ) |
Continues the enumeration of PWMs started using yFirstPwmOutput().
Definition at line 669 of file yocto_pwmoutput.cpp.
|
inline |
Definition at line 203 of file yocto_pwmoutput.h.
|
inline |
Definition at line 255 of file yocto_pwmoutput.h.
|
virtual |
Performs a smooth transistion of the pulse duration toward a given value. Any period, frequency, duty cycle or pulse width change will cancel any ongoing transition process.
ms_target | : new pulse duration at the end of the transition (floating-point number, representing the pulse duration in milliseconds) |
ms_duration | : total duration of the transition, in milliseconds |
On failure, throws an exception or returns a negative error code.
Definition at line 635 of file yocto_pwmoutput.cpp.
|
inline |
Definition at line 260 of file yocto_pwmoutput.h.
|
virtual |
Registers the callback function that is invoked on every change of advertised value. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.
callback | : the callback function to call, or a NULL pointer. The callback function should take two arguments: the function object of which the value has changed, and the character string describing the new advertised value. |
Definition at line 594 of file yocto_pwmoutput.cpp.
int YPwmOutput::set_dutyCycle | ( | double | newval | ) |
Changes the PWM duty cycle, in per cents.
newval | : a floating point number corresponding to the PWM duty cycle, in per cents |
On failure, throws an exception or returns a negative error code.
Definition at line 283 of file yocto_pwmoutput.cpp.
int YPwmOutput::set_dutyCycleAtPowerOn | ( | double | newval | ) |
Changes the PWM duty cycle at device power on. Remember to call the matching module saveToFlash() method, otherwise this call will have no effect.
newval | : a floating point number corresponding to the PWM duty cycle at device power on |
On failure, throws an exception or returns a negative error code.
Definition at line 489 of file yocto_pwmoutput.cpp.
int YPwmOutput::set_enabled | ( | Y_ENABLED_enum | newval | ) |
Stops or starts the PWM.
newval | : either Y_ENABLED_FALSE or Y_ENABLED_TRUE |
On failure, throws an exception or returns a negative error code.
Definition at line 149 of file yocto_pwmoutput.cpp.
int YPwmOutput::set_enabledAtPowerOn | ( | Y_ENABLEDATPOWERON_enum | newval | ) |
Changes the state of the PWM at device power on. Remember to call the matching module saveToFlash() method, otherwise this call will have no effect.
newval | : either Y_ENABLEDATPOWERON_FALSE or Y_ENABLEDATPOWERON_TRUE, according to the state of the PWM at device power on |
On failure, throws an exception or returns a negative error code.
Definition at line 463 of file yocto_pwmoutput.cpp.
int YPwmOutput::set_frequency | ( | double | newval | ) |
Changes the PWM frequency. The duty cycle is kept unchanged thanks to an automatic pulse width change.
newval | : a floating point number corresponding to the PWM frequency |
On failure, throws an exception or returns a negative error code.
Definition at line 175 of file yocto_pwmoutput.cpp.
int YPwmOutput::set_period | ( | double | newval | ) |
Changes the PWM period in milliseconds.
newval | : a floating point number corresponding to the PWM period in milliseconds |
On failure, throws an exception or returns a negative error code.
Definition at line 229 of file yocto_pwmoutput.cpp.
int YPwmOutput::set_pulseDuration | ( | double | newval | ) |
Changes the PWM pulse length, in milliseconds. A pulse length cannot be longer than period, otherwise it is truncated.
newval | : a floating point number corresponding to the PWM pulse length, in milliseconds |
On failure, throws an exception or returns a negative error code.
Definition at line 338 of file yocto_pwmoutput.cpp.
int YPwmOutput::set_pwmTransition | ( | const string & | newval | ) |
Definition at line 406 of file yocto_pwmoutput.cpp.
|
inline |
Definition at line 216 of file yocto_pwmoutput.h.
|
inline |
Definition at line 306 of file yocto_pwmoutput.h.
|
inline |
Definition at line 152 of file yocto_pwmoutput.h.
|
inline |
Definition at line 292 of file yocto_pwmoutput.h.
|
inline |
Definition at line 166 of file yocto_pwmoutput.h.
|
inline |
Definition at line 191 of file yocto_pwmoutput.h.
|
inline |
Definition at line 242 of file yocto_pwmoutput.h.
|
inline |
Definition at line 264 of file yocto_pwmoutput.h.
|
friend |
Retrieves a PWM for a given identifier. The identifier can be specified using several formats:
This function does not require that the PWM is online at the time it is invoked. The returned object is nevertheless valid. Use the method YPwmOutput.isOnline() to test if the PWM is indeed online at a given time. In case of ambiguity when looking for a PWM by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.
If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.
func | : a string that uniquely characterizes the PWM |
Definition at line 456 of file yocto_pwmoutput.h.
|
friend |
Starts the enumeration of PWMs currently accessible. Use the method YPwmOutput.nextPwmOutput() to iterate on next PWMs.
Definition at line 467 of file yocto_pwmoutput.h.
|
protected |
Definition at line 96 of file yocto_pwmoutput.h.
|
protected |
Definition at line 100 of file yocto_pwmoutput.h.
|
protected |
Definition at line 93 of file yocto_pwmoutput.h.
|
protected |
Definition at line 99 of file yocto_pwmoutput.h.
|
protected |
Definition at line 94 of file yocto_pwmoutput.h.
|
protected |
Definition at line 95 of file yocto_pwmoutput.h.
|
protected |
Definition at line 97 of file yocto_pwmoutput.h.
|
protected |
Definition at line 98 of file yocto_pwmoutput.h.
|
protected |
Definition at line 101 of file yocto_pwmoutput.h.
|
static |
Definition at line 122 of file yocto_pwmoutput.h.
|
static |
Definition at line 128 of file yocto_pwmoutput.h.
|
static |
Definition at line 117 of file yocto_pwmoutput.h.
|
static |
Definition at line 119 of file yocto_pwmoutput.h.
|
static |
Definition at line 118 of file yocto_pwmoutput.h.
|
static |
Definition at line 125 of file yocto_pwmoutput.h.
|
static |
Definition at line 127 of file yocto_pwmoutput.h.
|
static |
Definition at line 126 of file yocto_pwmoutput.h.
|
static |
Definition at line 120 of file yocto_pwmoutput.h.
|
static |
Definition at line 121 of file yocto_pwmoutput.h.
|
static |
Definition at line 123 of file yocto_pwmoutput.h.
|
static |
Definition at line 124 of file yocto_pwmoutput.h.