Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
YDigitalIO Class Reference

#include <yocto_digitalio.h>

Inheritance diagram for YDigitalIO:
Inheritance graph
[legend]

Public Member Functions

virtual int _invokeValueCallback (string value)
 
string command (void)
 
virtual int delayedPulse (int bitno, int ms_delay, int ms_duration)
 
virtual int get_bitDirection (int bitno)
 
virtual int get_bitOpenDrain (int bitno)
 
virtual int get_bitPolarity (int bitno)
 
virtual int get_bitState (int bitno)
 
string get_command (void)
 
Y_OUTPUTVOLTAGE_enum get_outputVoltage (void)
 
int get_portDiags (void)
 
int get_portDirection (void)
 
int get_portOpenDrain (void)
 
int get_portPolarity (void)
 
int get_portSize (void)
 
int get_portState (void)
 
YDigitalIOnext (void)
 
YDigitalIOnextDigitalIO (void)
 
Y_OUTPUTVOLTAGE_enum outputVoltage (void)
 
int portDiags (void)
 
int portDirection (void)
 
int portOpenDrain (void)
 
int portPolarity (void)
 
int portSize (void)
 
int portState (void)
 
virtual int pulse (int bitno, int ms_duration)
 
virtual int registerValueCallback (YDigitalIOValueCallback callback)
 
virtual int set_bitDirection (int bitno, int bitdirection)
 
virtual int set_bitOpenDrain (int bitno, int opendrain)
 
virtual int set_bitPolarity (int bitno, int bitpolarity)
 
virtual int set_bitState (int bitno, int bitstate)
 
int set_command (const string &newval)
 
int set_outputVoltage (Y_OUTPUTVOLTAGE_enum newval)
 
int set_portDirection (int newval)
 
int set_portOpenDrain (int newval)
 
int set_portPolarity (int newval)
 
int set_portState (int newval)
 
int setCommand (const string &newval)
 
int setOutputVoltage (Y_OUTPUTVOLTAGE_enum newval)
 
int setPortDirection (int newval)
 
int setPortOpenDrain (int newval)
 
int setPortPolarity (int newval)
 
int setPortState (int newval)
 
virtual int toggle_bitState (int bitno)
 
 ~YDigitalIO ()
 
- 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)
 
YModuleget_module (void)
 
void * get_userData (void)
 
bool isOnline (void)
 
YRETCODE load (int msValidity)
 
virtual string loadAttribute (string attrName)
 
string logicalName (void)
 
YModulemodule (void)
 
virtual int muteValueCallbacks (void)
 
YFunctionnext (void)
 
YFunctionnextFunction (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 YDigitalIOFind (string func)
 
static YDigitalIOFindDigitalIO (string func)
 
static YDigitalIOFirst (void)
 
static YDigitalIOFirstDigitalIO (void)
 
- Static Public Member Functions inherited from YFunction
static void _ClearCache (void)
 
static YFunctionFind (string func)
 
static YFunctionFindFunction (string func)
 
static YFunctionFirst (void)
 
static YFunctionFirstFunction (void)
 

Static Public Attributes

static const string COMMAND_INVALID = YAPI_INVALID_STRING
 
static const Y_OUTPUTVOLTAGE_enum OUTPUTVOLTAGE_EXT_V = Y_OUTPUTVOLTAGE_EXT_V
 
static const Y_OUTPUTVOLTAGE_enum OUTPUTVOLTAGE_INVALID = Y_OUTPUTVOLTAGE_INVALID
 
static const Y_OUTPUTVOLTAGE_enum OUTPUTVOLTAGE_USB_3V = Y_OUTPUTVOLTAGE_USB_3V
 
static const Y_OUTPUTVOLTAGE_enum OUTPUTVOLTAGE_USB_5V = Y_OUTPUTVOLTAGE_USB_5V
 
static const int PORTDIAGS_INVALID = YAPI_INVALID_UINT
 
static const int PORTDIRECTION_INVALID = YAPI_INVALID_UINT
 
static const int PORTOPENDRAIN_INVALID = YAPI_INVALID_UINT
 
static const int PORTPOLARITY_INVALID = YAPI_INVALID_UINT
 
static const int PORTSIZE_INVALID = YAPI_INVALID_UINT
 
static const int PORTSTATE_INVALID = YAPI_INVALID_UINT
 
- Static Public Attributes inherited from YFunction
static const string ADVERTISEDVALUE_INVALID = YAPI_INVALID_STRING
 
static const string FRIENDLYNAME_INVALID = YAPI_INVALID_STRING
 
static const YFUN_DESCR FUNCTIONDESCRIPTOR_INVALID = Y_FUNCTIONDESCRIPTOR_INVALID
 
static const string FUNCTIONID_INVALID = YAPI_INVALID_STRING
 
static const string HARDWAREID_INVALID = YAPI_INVALID_STRING
 
static const string LOGICALNAME_INVALID = YAPI_INVALID_STRING
 

Protected Member Functions

virtual int _parseAttr (YJSONObject *json_val)
 
 YDigitalIO (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

string _command
 
Y_OUTPUTVOLTAGE_enum _outputVoltage
 
int _portDiags
 
int _portDirection
 
int _portOpenDrain
 
int _portPolarity
 
int _portSize
 
int _portState
 
YDigitalIOValueCallback _valueCallbackDigitalIO
 
- 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

YDigitalIOyFindDigitalIO (const string &func)
 
YDigitalIOyFirstDigitalIO (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
 

Detailed Description

YDigitalIO Class: Digital IO function interface

The Yoctopuce application programming interface allows you to switch the state of each bit of the I/O port. You can switch all bits at once, or one by one. The library can also automatically generate short pulses of a determined duration. Electrical behavior of each I/O can be modified (open drain and reverse polarity).

Definition at line 82 of file yocto_digitalio.h.

Constructor & Destructor Documentation

YDigitalIO::YDigitalIO ( const string &  func)
protected

Definition at line 51 of file yocto_digitalio.cpp.

YDigitalIO::~YDigitalIO ( )

Definition at line 67 of file yocto_digitalio.cpp.

Member Function Documentation

int YDigitalIO::_invokeValueCallback ( string  value)
virtual

Reimplemented from YFunction.

Definition at line 568 of file yocto_digitalio.cpp.

int YDigitalIO::_parseAttr ( YJSONObject json_val)
protectedvirtual

Reimplemented from YFunction.

Definition at line 76 of file yocto_digitalio.cpp.

string YDigitalIO::command ( void  )
inline

Definition at line 295 of file yocto_digitalio.h.

int YDigitalIO::delayedPulse ( int  bitno,
int  ms_delay,
int  ms_duration 
)
virtual

Schedules a pulse on a single bit for a specified duration. The specified bit will be turned to 1, and then back to 0 after the given duration.

Parameters
bitno: the bit number; lowest bit has index 0
ms_delay: waiting time before the pulse, in milliseconds
ms_duration: desired pulse duration in milliseconds. Be aware that the device time resolution is not guaranteed up to the millisecond.
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 786 of file yocto_digitalio.cpp.

static YDigitalIO* YDigitalIO::Find ( string  func)
inlinestatic

Definition at line 488 of file yocto_digitalio.h.

YDigitalIO * YDigitalIO::FindDigitalIO ( string  func)
static

Retrieves a digital IO port for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the digital IO port is online at the time it is invoked. The returned object is nevertheless valid. Use the method YDigitalIO.isOnline() to test if the digital IO port is indeed online at a given time. In case of ambiguity when looking for a digital IO port 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.

Parameters
func: a string that uniquely characterizes the digital IO port
Returns
a YDigitalIO object allowing you to drive the digital IO port.

Definition at line 517 of file yocto_digitalio.cpp.

static YDigitalIO* YDigitalIO::First ( void  )
inlinestatic

Definition at line 512 of file yocto_digitalio.h.

YDigitalIO * YDigitalIO::FirstDigitalIO ( void  )
static

Starts the enumeration of digital IO ports currently accessible. Use the method YDigitalIO.nextDigitalIO() to iterate on next digital IO ports.

Returns
a pointer to a YDigitalIO object, corresponding to the first digital IO port currently online, or a NULL pointer if there are none.

Definition at line 801 of file yocto_digitalio.cpp.

int YDigitalIO::get_bitDirection ( int  bitno)
virtual

Returns the direction of a single bit from the I/O port (0 means the bit is an input, 1 an output).

Parameters
bitno: the bit number; lowest bit has index 0
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 664 of file yocto_digitalio.cpp.

int YDigitalIO::get_bitOpenDrain ( int  bitno)
virtual

Returns the type of electrical interface of a single bit from the I/O port. (0 means the bit is an input, 1 an output).

Parameters
bitno: the bit number; lowest bit has index 0
Returns
0 means the a bit is a regular input/output, 1 means the bit is an open-drain (open-collector) input/output.

On failure, throws an exception or returns a negative error code.

Definition at line 749 of file yocto_digitalio.cpp.

int YDigitalIO::get_bitPolarity ( int  bitno)
virtual

Returns the polarity of a single bit from the I/O port (0 means the I/O works in regular mode, 1 means the I/O works in reverse mode).

Parameters
bitno: the bit number; lowest bit has index 0
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 706 of file yocto_digitalio.cpp.

int YDigitalIO::get_bitState ( int  bitno)
virtual

Returns the state of a single bit of the I/O port.

Parameters
bitno: the bit number; lowest bit has index 0
Returns
the bit state (0 or 1)

On failure, throws an exception or returns a negative error code.

Definition at line 610 of file yocto_digitalio.cpp.

string YDigitalIO::get_command ( void  )

Definition at line 452 of file yocto_digitalio.cpp.

Y_OUTPUTVOLTAGE_enum YDigitalIO::get_outputVoltage ( void  )

Returns the voltage source used to drive output bits.

Returns
a value among Y_OUTPUTVOLTAGE_USB_5V, Y_OUTPUTVOLTAGE_USB_3V and Y_OUTPUTVOLTAGE_EXT_V corresponding to the voltage source used to drive output bits

On failure, throws an exception or returns Y_OUTPUTVOLTAGE_INVALID.

Definition at line 403 of file yocto_digitalio.cpp.

int YDigitalIO::get_portDiags ( void  )

Returns the port state diagnostics (Yocto-IO and Yocto-MaxiIO-V2 only). Bit 0 indicates a shortcut on output 0, etc. Bit 8 indicates a power failure, and bit 9 signals overheating (overcurrent). During normal use, all diagnostic bits should stay clear.

Returns
an integer corresponding to the port state diagnostics (Yocto-IO and Yocto-MaxiIO-V2 only)

On failure, throws an exception or returns Y_PORTDIAGS_INVALID.

Definition at line 344 of file yocto_digitalio.cpp.

int YDigitalIO::get_portDirection ( void  )

Returns the IO direction of all bits of the port: 0 makes a bit an input, 1 makes it an output.

Returns
an integer corresponding to the IO direction of all bits of the port: 0 makes a bit an input, 1 makes it an output

On failure, throws an exception or returns Y_PORTDIRECTION_INVALID.

Definition at line 169 of file yocto_digitalio.cpp.

int YDigitalIO::get_portOpenDrain ( void  )

Returns the electrical interface for each bit of the port. For each bit set to 0 the matching I/O works in the regular, intuitive way, for each bit set to 1, the I/O works in reverse mode.

Returns
an integer corresponding to the electrical interface for each bit of the port

On failure, throws an exception or returns Y_PORTOPENDRAIN_INVALID.

Definition at line 227 of file yocto_digitalio.cpp.

int YDigitalIO::get_portPolarity ( void  )

Returns the polarity of all the bits of the port. For each bit set to 0, the matching I/O works the regular, intuitive way; for each bit set to 1, the I/O works in reverse mode.

Returns
an integer corresponding to the polarity of all the bits of the port

On failure, throws an exception or returns Y_PORTPOLARITY_INVALID.

Definition at line 284 of file yocto_digitalio.cpp.

int YDigitalIO::get_portSize ( void  )

Returns the number of bits implemented in the I/O port.

Returns
an integer corresponding to the number of bits implemented in the I/O port

On failure, throws an exception or returns Y_PORTSIZE_INVALID.

Definition at line 373 of file yocto_digitalio.cpp.

int YDigitalIO::get_portState ( void  )

Returns the digital IO port state: bit 0 represents input 0, and so on.

Returns
an integer corresponding to the digital IO port state: bit 0 represents input 0, and so on

On failure, throws an exception or returns Y_PORTSTATE_INVALID.

Definition at line 113 of file yocto_digitalio.cpp.

YDigitalIO* YDigitalIO::next ( void  )
inline

Definition at line 499 of file yocto_digitalio.h.

YDigitalIO * YDigitalIO::nextDigitalIO ( void  )

Continues the enumeration of digital IO ports started using yFirstDigitalIO().

Returns
a pointer to a YDigitalIO object, corresponding to a digital IO port currently online, or a NULL pointer if there are no more digital IO ports to enumerate.

Definition at line 791 of file yocto_digitalio.cpp.

Y_OUTPUTVOLTAGE_enum YDigitalIO::outputVoltage ( void  )
inline

Definition at line 275 of file yocto_digitalio.h.

int YDigitalIO::portDiags ( void  )
inline

Definition at line 250 of file yocto_digitalio.h.

int YDigitalIO::portDirection ( void  )
inline

Definition at line 162 of file yocto_digitalio.h.

int YDigitalIO::portOpenDrain ( void  )
inline

Definition at line 191 of file yocto_digitalio.h.

int YDigitalIO::portPolarity ( void  )
inline

Definition at line 219 of file yocto_digitalio.h.

int YDigitalIO::portSize ( void  )
inline

Definition at line 262 of file yocto_digitalio.h.

int YDigitalIO::portState ( void  )
inline

Definition at line 135 of file yocto_digitalio.h.

int YDigitalIO::pulse ( int  bitno,
int  ms_duration 
)
virtual

Triggers a pulse on a single bit for a specified duration. The specified bit will be turned to 1, and then back to 0 after the given duration.

Parameters
bitno: the bit number; lowest bit has index 0
ms_duration: desired pulse duration in milliseconds. Be aware that the device time resolution is not guaranteed up to the millisecond.
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 768 of file yocto_digitalio.cpp.

int YDigitalIO::registerValueCallback ( YDigitalIOValueCallback  callback)
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.

Parameters
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 549 of file yocto_digitalio.cpp.

int YDigitalIO::set_bitDirection ( int  bitno,
int  bitdirection 
)
virtual

Changes the direction of a single bit from the I/O port.

Parameters
bitno: the bit number; lowest bit has index 0
bitdirection: direction to set, 0 makes the bit an input, 1 makes it an output. Remember to call the saveToFlash() method to make sure the setting is kept after a reboot.
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 642 of file yocto_digitalio.cpp.

int YDigitalIO::set_bitOpenDrain ( int  bitno,
int  opendrain 
)
virtual

Changes the electrical interface of a single bit from the I/O port.

Parameters
bitno: the bit number; lowest bit has index 0
opendrain: 0 makes a bit a regular input/output, 1 makes it an open-drain (open-collector) input/output. Remember to call the saveToFlash() method to make sure the setting is kept after a reboot.
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 725 of file yocto_digitalio.cpp.

int YDigitalIO::set_bitPolarity ( int  bitno,
int  bitpolarity 
)
virtual

Changes the polarity of a single bit from the I/O port.

Parameters
bitno: the bit number; lowest bit has index 0.
bitpolarity: polarity to set, 0 makes the I/O work in regular mode, 1 makes the I/O works in reverse mode. Remember to call the saveToFlash() method to make sure the setting is kept after a reboot.
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 683 of file yocto_digitalio.cpp.

int YDigitalIO::set_bitState ( int  bitno,
int  bitstate 
)
virtual

Sets a single bit of the I/O port.

Parameters
bitno: the bit number; lowest bit has index 0
bitstate: the state of the bit (1 or 0)
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 588 of file yocto_digitalio.cpp.

int YDigitalIO::set_command ( const string &  newval)

Definition at line 474 of file yocto_digitalio.cpp.

int YDigitalIO::set_outputVoltage ( Y_OUTPUTVOLTAGE_enum  newval)

Changes the voltage source used to drive output bits. Remember to call the saveToFlash() method to make sure the setting is kept after a reboot.

Parameters
newval: a value among Y_OUTPUTVOLTAGE_USB_5V, Y_OUTPUTVOLTAGE_USB_3V and Y_OUTPUTVOLTAGE_EXT_V corresponding to the voltage source used to drive output bits
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 436 of file yocto_digitalio.cpp.

int YDigitalIO::set_portDirection ( int  newval)

Changes the IO direction of all bits of the port: 0 makes a bit an input, 1 makes it an output. Remember to call the saveToFlash() method to make sure the setting is kept after a reboot.

Parameters
newval: an integer corresponding to the IO direction of all bits of the port: 0 makes a bit an input, 1 makes it an output
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 202 of file yocto_digitalio.cpp.

int YDigitalIO::set_portOpenDrain ( int  newval)

Changes the electrical interface for each bit of the port. 0 makes a bit a regular input/output, 1 makes it an open-drain (open-collector) input/output. Remember to call the saveToFlash() method to make sure the setting is kept after a reboot.

Parameters
newval: an integer corresponding to the electrical interface for each bit of the port
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 260 of file yocto_digitalio.cpp.

int YDigitalIO::set_portPolarity ( int  newval)

Changes the polarity of all the bits of the port: For each bit set to 0, the matching I/O works the regular, intuitive way; for each bit set to 1, the I/O works in reverse mode. Remember to call the saveToFlash() method to make sure the setting will be kept after a reboot.

Parameters
newval: an integer corresponding to the polarity of all the bits of the port: For each bit set to 0, the matching I/O works the regular, intuitive way; for each bit set to 1, the I/O works in reverse mode
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 319 of file yocto_digitalio.cpp.

int YDigitalIO::set_portState ( int  newval)

Changes the digital IO port state: bit 0 represents input 0, and so on. This function has no effect on bits configured as input in portDirection.

Parameters
newval: an integer corresponding to the digital IO port state: bit 0 represents input 0, and so on
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 145 of file yocto_digitalio.cpp.

int YDigitalIO::setCommand ( const string &  newval)
inline

Definition at line 299 of file yocto_digitalio.h.

int YDigitalIO::setOutputVoltage ( Y_OUTPUTVOLTAGE_enum  newval)
inline

Definition at line 290 of file yocto_digitalio.h.

int YDigitalIO::setPortDirection ( int  newval)
inline

Definition at line 177 of file yocto_digitalio.h.

int YDigitalIO::setPortOpenDrain ( int  newval)
inline

Definition at line 206 of file yocto_digitalio.h.

int YDigitalIO::setPortPolarity ( int  newval)
inline

Definition at line 236 of file yocto_digitalio.h.

int YDigitalIO::setPortState ( int  newval)
inline

Definition at line 149 of file yocto_digitalio.h.

int YDigitalIO::toggle_bitState ( int  bitno)
virtual

Reverts a single bit of the I/O port.

Parameters
bitno: the bit number; lowest bit has index 0
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 626 of file yocto_digitalio.cpp.

Friends And Related Function Documentation

YDigitalIO* yFindDigitalIO ( const string &  func)
friend

Retrieves a digital IO port for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the digital IO port is online at the time it is invoked. The returned object is nevertheless valid. Use the method YDigitalIO.isOnline() to test if the digital IO port is indeed online at a given time. In case of ambiguity when looking for a digital IO port 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.

Parameters
func: a string that uniquely characterizes the digital IO port
Returns
a YDigitalIO object allowing you to drive the digital IO port.

Definition at line 549 of file yocto_digitalio.h.

YDigitalIO* yFirstDigitalIO ( void  )
friend

Starts the enumeration of digital IO ports currently accessible. Use the method YDigitalIO.nextDigitalIO() to iterate on next digital IO ports.

Returns
a pointer to a YDigitalIO object, corresponding to the first digital IO port currently online, or a NULL pointer if there are none.

Definition at line 560 of file yocto_digitalio.h.

Member Data Documentation

string YDigitalIO::_command
protected

Definition at line 97 of file yocto_digitalio.h.

Y_OUTPUTVOLTAGE_enum YDigitalIO::_outputVoltage
protected

Definition at line 96 of file yocto_digitalio.h.

int YDigitalIO::_portDiags
protected

Definition at line 94 of file yocto_digitalio.h.

int YDigitalIO::_portDirection
protected

Definition at line 91 of file yocto_digitalio.h.

int YDigitalIO::_portOpenDrain
protected

Definition at line 92 of file yocto_digitalio.h.

int YDigitalIO::_portPolarity
protected

Definition at line 93 of file yocto_digitalio.h.

int YDigitalIO::_portSize
protected

Definition at line 95 of file yocto_digitalio.h.

int YDigitalIO::_portState
protected

Definition at line 90 of file yocto_digitalio.h.

YDigitalIOValueCallback YDigitalIO::_valueCallbackDigitalIO
protected

Definition at line 98 of file yocto_digitalio.h.

const string YDigitalIO::COMMAND_INVALID = YAPI_INVALID_STRING
static

Definition at line 124 of file yocto_digitalio.h.

const Y_OUTPUTVOLTAGE_enum YDigitalIO::OUTPUTVOLTAGE_EXT_V = Y_OUTPUTVOLTAGE_EXT_V
static

Definition at line 122 of file yocto_digitalio.h.

const Y_OUTPUTVOLTAGE_enum YDigitalIO::OUTPUTVOLTAGE_INVALID = Y_OUTPUTVOLTAGE_INVALID
static

Definition at line 123 of file yocto_digitalio.h.

const Y_OUTPUTVOLTAGE_enum YDigitalIO::OUTPUTVOLTAGE_USB_3V = Y_OUTPUTVOLTAGE_USB_3V
static

Definition at line 121 of file yocto_digitalio.h.

const Y_OUTPUTVOLTAGE_enum YDigitalIO::OUTPUTVOLTAGE_USB_5V = Y_OUTPUTVOLTAGE_USB_5V
static

Definition at line 120 of file yocto_digitalio.h.

const int YDigitalIO::PORTDIAGS_INVALID = YAPI_INVALID_UINT
static

Definition at line 118 of file yocto_digitalio.h.

const int YDigitalIO::PORTDIRECTION_INVALID = YAPI_INVALID_UINT
static

Definition at line 115 of file yocto_digitalio.h.

const int YDigitalIO::PORTOPENDRAIN_INVALID = YAPI_INVALID_UINT
static

Definition at line 116 of file yocto_digitalio.h.

const int YDigitalIO::PORTPOLARITY_INVALID = YAPI_INVALID_UINT
static

Definition at line 117 of file yocto_digitalio.h.

const int YDigitalIO::PORTSIZE_INVALID = YAPI_INVALID_UINT
static

Definition at line 119 of file yocto_digitalio.h.

const int YDigitalIO::PORTSTATE_INVALID = YAPI_INVALID_UINT
static

Definition at line 114 of file yocto_digitalio.h.


The documentation for this class was generated from the following files:


yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:13