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, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID
Modifier | Constructor and Description |
---|---|
protected |
YPwmOutput(String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(org.json.JSONObject json_val) |
int |
dutyCycleMove(double target,
int ms_duration)
Performs a smooth change of the pulse duration toward a given value.
|
static YPwmOutput |
FindPwmOutput(String func)
Retrieves a PWM for a given identifier.
|
static YPwmOutput |
FirstPwmOutput()
Starts the enumeration of PWMs currently accessible.
|
double |
get_dutyCycle()
Returns the PWM duty cycle, in per cents.
|
double |
get_dutyCycleAtPowerOn()
Returns the PWMs duty cycle at device power on as a floating point number between 0 and 100
|
int |
get_enabled()
Returns the state of the PWMs.
|
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 PWMs duty cycle at device power on as a floating point number between 0 and 100
|
int |
getEnabled()
Returns the state of the PWMs.
|
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.
|
String |
getPwmTransition() |
YPwmOutput |
nextPwmOutput()
Continues the enumeration of PWMs started using yFirstPwmOutput().
|
int |
pulseDurationMove(double ms_target,
int ms_duration)
Performs a smooth transistion 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 |
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 |
setPwmTransition(String newval) |
_AddToCache, _devRequest, _download, _escapeAttr, _FindFromCache, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, describe, errMessage, errorMessage, errorType, errType, FindFunction, FirstFunction, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, load, module, nextFunction, registerValueCallback, set_logicalName, set_userData, setLogicalName, setUserData, toString, 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(String func)
func
- : functionidprotected void _parseAttr(org.json.JSONObject json_val) throws org.json.JSONException
_parseAttr
in class YFunction
org.json.JSONException
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 Y_ENABLED_FALSE or Y_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
- on errorpublic String getPwmTransition() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_pwmTransition(String newval) throws YAPI_Exception
YAPI_Exception
public int setPwmTransition(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 Y_ENABLEDATPOWERON_FALSE or Y_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 PWMpublic 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
(floating-point number, between 0 and 1)ms_duration
- : total duration of the transition, in millisecondsYAPI_Exception
- on errorpublic YPwmOutput nextPwmOutput()
public static YPwmOutput FirstPwmOutput()
Copyright © 2015. All rights reserved.