public class YPwmOutput extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YPwmOutput.TimedReportCallback
TimedReportCallback for PwmOutput
|
static interface |
YPwmOutput.UpdateCallback
Deprecated UpdateCallback for PwmOutput
|
Modifier and Type | Field and Description |
---|---|
protected double |
_dutyCycle |
protected double |
_dutyCycleAtPowerOn |
protected int |
_enabled |
protected int |
_enabledAtPowerOn |
protected double |
_frequency |
protected double |
_period |
protected double |
_pulseDuration |
protected String |
_pwmTransition |
protected YPwmOutput.UpdateCallback |
_valueCallbackPwmOutput |
static double |
DUTYCYCLE_INVALID
invalid dutyCycle value
|
static double |
DUTYCYCLEATPOWERON_INVALID
invalid dutyCycleAtPowerOn value
|
static int |
ENABLED_FALSE
invalid enabled value
|
static int |
ENABLED_INVALID |
static int |
ENABLED_TRUE |
static int |
ENABLEDATPOWERON_FALSE
invalid enabledAtPowerOn value
|
static int |
ENABLEDATPOWERON_INVALID |
static int |
ENABLEDATPOWERON_TRUE |
static double |
FREQUENCY_INVALID
invalid frequency value
|
static double |
PERIOD_INVALID
invalid period value
|
static double |
PULSEDURATION_INVALID
invalid pulseDuration value
|
static String |
PWMTRANSITION_INVALID
invalid pwmTransition value
|
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID
Modifier | Constructor and Description |
---|---|
protected |
YPwmOutput(String func) |
protected |
YPwmOutput(YAPIContext ctx,
String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) |
int |
dutyCycleMove(double target,
int ms_duration)
Performs a smooth change of the duty cycle toward a given value.
|
static YPwmOutput |
FindPwmOutput(String func)
Retrieves a PWM generator for a given identifier.
|
static YPwmOutput |
FindPwmOutputInContext(YAPIContext yctx,
String func)
Retrieves a PWM generator for a given identifier in a YAPI context.
|
static YPwmOutput |
FirstPwmOutput()
Starts the enumeration of PWM generators currently accessible.
|
static YPwmOutput |
FirstPwmOutputInContext(YAPIContext yctx)
Starts the enumeration of PWM generators currently accessible.
|
int |
frequencyMove(double target,
int ms_duration)
Performs a smooth frequency change toward a given value.
|
double |
get_dutyCycle()
Returns the PWM duty cycle, in per cents.
|
double |
get_dutyCycleAtPowerOn()
Returns the PWM generators duty cycle at device power on as a floating point number between 0 and 100.
|
int |
get_enabled()
Returns the state of the PWM generators.
|
int |
get_enabledAtPowerOn()
Returns the state of the PWM at device power on.
|
double |
get_frequency()
Returns the PWM frequency in Hz.
|
double |
get_period()
Returns the PWM period in milliseconds.
|
double |
get_pulseDuration()
Returns the PWM pulse length in milliseconds, as a floating point number.
|
String |
get_pwmTransition() |
double |
getDutyCycle()
Returns the PWM duty cycle, in per cents.
|
double |
getDutyCycleAtPowerOn()
Returns the PWM generators duty cycle at device power on as a floating point number between 0 and 100.
|
int |
getEnabled()
Returns the state of the PWM generators.
|
int |
getEnabledAtPowerOn()
Returns the state of the PWM at device power on.
|
double |
getFrequency()
Returns the PWM frequency in Hz.
|
double |
getPeriod()
Returns the PWM period in milliseconds.
|
double |
getPulseDuration()
Returns the PWM pulse length in milliseconds, as a floating point number.
|
int |
markForRepeat() |
YPwmOutput |
nextPwmOutput()
Continues the enumeration of PWM generators started using yFirstPwmOutput().
|
int |
phaseMove(double target,
int ms_duration)
Performs a smooth transition toward a specified value of the phase shift between this channel
and the other channel.
|
int |
pulseDurationMove(double ms_target,
int ms_duration)
Performs a smooth transition of the pulse duration toward a given value.
|
int |
registerValueCallback(YPwmOutput.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
repeatFromMark() |
int |
set_dutyCycle(double newval)
Changes the PWM duty cycle, in per cents.
|
int |
set_dutyCycleAtPowerOn(double newval)
Changes the PWM duty cycle at device power on.
|
int |
set_enabled(int newval)
Stops or starts the PWM.
|
int |
set_enabledAtPowerOn(int newval)
Changes the state of the PWM at device power on.
|
int |
set_frequency(double newval)
Changes the PWM frequency.
|
int |
set_period(double newval)
Changes the PWM period in milliseconds.
|
int |
set_pulseDuration(double newval)
Changes the PWM pulse length, in milliseconds.
|
int |
set_pwmTransition(String newval) |
int |
setDutyCycle(double newval)
Changes the PWM duty cycle, in per cents.
|
int |
setDutyCycleAtPowerOn(double newval)
Changes the PWM duty cycle at device power on.
|
int |
setEnabled(int newval)
Stops or starts the PWM.
|
int |
setEnabledAtPowerOn(int newval)
Changes the state of the PWM at device power on.
|
int |
setFrequency(double newval)
Changes the PWM frequency.
|
int |
setPeriod(double newval)
Changes the PWM period in milliseconds.
|
int |
setPulseDuration(double newval)
Changes the PWM pulse length, in milliseconds.
|
int |
triggerPulsesByDuration(double ms_target,
int n_pulses)
Trigger a given number of pulses of specified duration, at current frequency.
|
int |
triggerPulsesByDutyCycle(double target,
int n_pulses)
Trigger a given number of pulses of specified duration, at current frequency.
|
int |
triggerPulsesByFrequency(double target,
int n_pulses)
Trigger a given number of pulses at the specified frequency, using current duty cycle.
|
_AddToCache, _clearDataStreamCache, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, _uploadEx, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_serialNumber, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, isReadOnly, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final int ENABLED_FALSE
public static final int ENABLED_TRUE
public static final int ENABLED_INVALID
public static final double FREQUENCY_INVALID
public static final double PERIOD_INVALID
public static final double DUTYCYCLE_INVALID
public static final double PULSEDURATION_INVALID
public static final String PWMTRANSITION_INVALID
public static final int ENABLEDATPOWERON_FALSE
public static final int ENABLEDATPOWERON_TRUE
public static final int ENABLEDATPOWERON_INVALID
public static final double DUTYCYCLEATPOWERON_INVALID
protected int _enabled
protected double _frequency
protected double _period
protected double _dutyCycle
protected double _pulseDuration
protected String _pwmTransition
protected int _enabledAtPowerOn
protected double _dutyCycleAtPowerOn
protected YPwmOutput.UpdateCallback _valueCallbackPwmOutput
protected YPwmOutput(YAPIContext ctx, String func)
func
- : functionidprotected YPwmOutput(String func)
func
- : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) throws Exception
_parseAttr
in class YFunction
Exception
public int get_enabled() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getEnabled() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_enabled(int newval) throws YAPI_Exception
newval
- : either YPwmOutput.ENABLED_FALSE or YPwmOutput.ENABLED_TRUEYAPI_Exception
- on errorpublic int setEnabled(int newval) throws YAPI_Exception
newval
- : either YPwmOutput.ENABLED_FALSE or YPwmOutput.ENABLED_TRUEYAPI_Exception
- on errorpublic int set_frequency(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM frequencyYAPI_Exception
- on errorpublic int setFrequency(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM frequencyYAPI_Exception
- on errorpublic double get_frequency() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getFrequency() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_period(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM period in millisecondsYAPI_Exception
- on errorpublic int setPeriod(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM period in millisecondsYAPI_Exception
- on errorpublic double get_period() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getPeriod() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_dutyCycle(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM duty cycle, in per centsYAPI_Exception
- on errorpublic int setDutyCycle(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM duty cycle, in per centsYAPI_Exception
- on errorpublic double get_dutyCycle() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getDutyCycle() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_pulseDuration(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM pulse length, in millisecondsYAPI_Exception
- on errorpublic int setPulseDuration(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM pulse length, in millisecondsYAPI_Exception
- on errorpublic double get_pulseDuration() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getPulseDuration() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_pwmTransition() throws YAPI_Exception
YAPI_Exception
public int set_pwmTransition(String newval) throws YAPI_Exception
YAPI_Exception
public int get_enabledAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getEnabledAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_enabledAtPowerOn(int newval) throws YAPI_Exception
newval
- : either YPwmOutput.ENABLEDATPOWERON_FALSE or YPwmOutput.ENABLEDATPOWERON_TRUE,
according to the state of the PWM at device power onYAPI_Exception
- on errorpublic int setEnabledAtPowerOn(int newval) throws YAPI_Exception
newval
- : either YPwmOutput.ENABLEDATPOWERON_FALSE or YPwmOutput.ENABLEDATPOWERON_TRUE,
according to the state of the PWM at device power onYAPI_Exception
- on errorpublic int set_dutyCycleAtPowerOn(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM duty cycle at device power onYAPI_Exception
- on errorpublic int setDutyCycleAtPowerOn(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM duty cycle at device power onYAPI_Exception
- on errorpublic double get_dutyCycleAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getDutyCycleAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic static YPwmOutput FindPwmOutput(String func)
func
- : a string that uniquely characterizes the PWM generator, for instance
YPWMTX01.pwmOutput1.public static YPwmOutput FindPwmOutputInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the PWM generator, for instance
YPWMTX01.pwmOutput1.public int registerValueCallback(YPwmOutput.UpdateCallback callback)
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.public int _invokeValueCallback(String value)
_invokeValueCallback
in class YFunction
public int pulseDurationMove(double ms_target, int ms_duration) throws YAPI_Exception
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 millisecondsYAPI_Exception
- on errorpublic int dutyCycleMove(double target, int ms_duration) throws YAPI_Exception
target
- : new duty cycle at the end of the transition
(percentage, floating-point number between 0 and 100)ms_duration
- : total duration of the transition, in millisecondsYAPI_Exception
- on errorpublic int frequencyMove(double target, int ms_duration) throws YAPI_Exception
target
- : new frequency at the end of the transition (floating-point number)ms_duration
- : total duration of the transition, in millisecondsYAPI_Exception
- on errorpublic int phaseMove(double target, int ms_duration) throws YAPI_Exception
target
- : phase shift at the end of the transition, in milliseconds (floating-point number)ms_duration
- : total duration of the transition, in millisecondsYAPI_Exception
- on errorpublic int triggerPulsesByDuration(double ms_target, int n_pulses) throws YAPI_Exception
ms_target
- : desired pulse duration
(floating-point number, representing the pulse duration in milliseconds)n_pulses
- : desired pulse countYAPI_Exception
- on errorpublic int triggerPulsesByDutyCycle(double target, int n_pulses) throws YAPI_Exception
target
- : desired duty cycle for the generated pulses
(percentage, floating-point number between 0 and 100)n_pulses
- : desired pulse countYAPI_Exception
- on errorpublic int triggerPulsesByFrequency(double target, int n_pulses) throws YAPI_Exception
target
- : desired frequency for the generated pulses (floating-point number)n_pulses
- : desired pulse countYAPI_Exception
- on errorpublic int markForRepeat() throws YAPI_Exception
YAPI_Exception
public int repeatFromMark() throws YAPI_Exception
YAPI_Exception
public YPwmOutput nextPwmOutput()
public static YPwmOutput FirstPwmOutput()
public static YPwmOutput FirstPwmOutputInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2022. All rights reserved.