Public Member Functions

CQEGpioInt Class Reference

CQEGpioInt is used to interact with the external digital ports, such as reading, writing and triggering on interruptible input events. More...

#include <qegpioint.h>

Inheritance diagram for CQEGpioInt:
IProperty

List of all members.

Public Member Functions

 SINGLETON (CQEGpioInt)
 This internal macro handles instantiation of this class.
virtual int GetProperty (int property, long *value)
 See the definition of IProperty::GetProperty for more information on this method.
virtual int SetProperty (int property, long value)
 See the definition of IProperty::SetProperty for more information on this method.
void SetData (unsigned int data)
 Changes the state of the external digital I/O signals.
void SetDataBit (unsigned int bit)
 Sets the specified bit to 1 (logic high) and leaves all other bits unaltered.
void ResetDataBit (unsigned int bit)
 Sets the specified bit to 0 (logic low) and leaves all other bits unaltered.
void SetDataDirection (unsigned int direction)
 Sets the data direction of the I/O signals.
unsigned int GetData ()
 Returns the state of the external digital I/O signals as a bitmap with bit 0 (LSB) corresponding to digital signal 1 and bit 15 corresponding to digital signal 16 -- typically used to read signals configured as inputs, although the state of output signals are also returned.
unsigned int GetDataDirection ()
 Returns the contents of the data direction register -- only the least significant 16 bits are used.
int SetInterruptMode (unsigned int io, unsigned int mode)
 Sets the interrupt mode of the specified I/O.
int SetInterrupt (unsigned int io, bool enable)
 Enable or disable the interrupt for the specified I/O.
int RegisterCallback (unsigned int io, void *userPointer, void(*callback)(unsigned int, struct timeval *, void *))
 Register an interrupt callback -- ie a function that gets called when an interrupt event occurs on the specified I/O signal.
int UnregisterCallback (unsigned int io)
 Remove (unregister) an interrupt callback.

Detailed Description

CQEGpioInt is used to interact with the external digital ports, such as reading, writing and triggering on interruptible input events.

To instantiate this class:

 // by pointer
 CQEGpioInt *pio = CQEGpioInt::GetPtr(); 
 // or by reference
 CQEGpioInt &io = CQEGpioInt::GetRef();

And when done with this class, call Release(), for each call to GetPtr() or GetRef():


Member Function Documentation

unsigned int CQEGpioInt::GetData (  ) 

Returns the state of the external digital I/O signals as a bitmap with bit 0 (LSB) corresponding to digital signal 1 and bit 15 corresponding to digital signal 16 -- typically used to read signals configured as inputs, although the state of output signals are also returned.

unsigned int CQEGpioInt::GetDataDirection (  ) 

Returns the contents of the data direction register -- only the least significant 16 bits are used.

int CQEGpioInt::GetProperty ( int  property,
long *  value 
) [virtual]

See the definition of IProperty::GetProperty for more information on this method.

The following properties are supported:

  • QEG_PROP_WIDTH=number of digital I/O signals

Implements IProperty.

int CQEGpioInt::RegisterCallback ( unsigned int  io,
void *  userPointer,
void(*)(unsigned int, struct timeval *, void *)  callback 
)

Register an interrupt callback -- ie a function that gets called when an interrupt event occurs on the specified I/O signal.

Parameters:
io the I/O signal in question, 0 through 15 corresponding
userPointer a pointer or data object that will be passed to your callback function. digital connectors 1 through 16, respectively.
callback the callback function that gets called when the corresponding I/O signal received an interruptible condition.
Returns:
0 if success -1 if error.
void CQEGpioInt::ResetDataBit ( unsigned int  bit  ) 

Sets the specified bit to 0 (logic low) and leaves all other bits unaltered.

Parameters:
bit value between 0 and 15 that specifies the bit to be altered. A 0 value corresponds to I/O signal 1 and a 15 value corresponds to I/O signal 16.
void CQEGpioInt::SetData ( unsigned int  data  ) 

Changes the state of the external digital I/O signals.

Parameters:
data a bitmap with bit 0 (LSB) corresponding to digital signal 1 and bit 15 corresponding to digital signal 16 -- used to change the state of signals configured as outputs. A 0 (zero) bit value set the corresponding I/O signal to be logic low. A 1 (one) bit value set the corresponding I/O signal to be logic high.
void CQEGpioInt::SetDataBit ( unsigned int  bit  ) 

Sets the specified bit to 1 (logic high) and leaves all other bits unaltered.

Parameters:
bit value between 0 and 15 that specifies the bit to be altered. A 0 value corresponds to I/O signal 1 and a 15 value corresponds to I/O signal 16.
void CQEGpioInt::SetDataDirection ( unsigned int  direction  ) 

Sets the data direction of the I/O signals.

Parameters:
direction a bitmap with bit 0 (LSB) corresponding to digital signal 1 and bit 15 corresponding to digital signal 16. A 0 (zero) bit value configures the corresponding I/O signal to be input. A 1 (one) bit value configures the corresponding I/O signal to be an output.
int CQEGpioInt::SetInterrupt ( unsigned int  io,
bool  enable 
)

Enable or disable the interrupt for the specified I/O.

Parameters:
io the I/O signal in question, 0 through 15 corresponding digital connectors 1 through 16, respectively.
enable false=disable interrupt, true=enable interrupt
Returns:
0 if success -1 if error.
int CQEGpioInt::SetInterruptMode ( unsigned int  io,
unsigned int  mode 
)

Sets the interrupt mode of the specified I/O.

Parameters:
io the I/O signal in question, 0 through 15 corresponding digital connectors 1 through 16, respectively.
mode the following modes are supported

  • QEG_INTERRUPT_POSEDGE=interrupt on transition from logic low to logic high. QEB_INTERRUPT_NEGEDGE=interrupt on transition from logic high to logic low.
Returns:
0 if success -1 if error.
int CQEGpioInt::SetProperty ( int  property,
long  value 
) [virtual]

See the definition of IProperty::SetProperty for more information on this method.

The following properties re supported:

Implements IProperty.

CQEGpioInt::SINGLETON ( CQEGpioInt   ) 

This internal macro handles instantiation of this class.

int CQEGpioInt::UnregisterCallback ( unsigned int  io  ) 

Remove (unregister) an interrupt callback.

Parameters:
io the I/O signal in question, 0 through 15 corresponding digital connectors 1 through 16, respectively.
Returns:
0 if success -1 if error.

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