Impact Acquire SDK .NET
I2CControl Class Reference

Properties for accessing features belonging to the I2C control(Device specific interface layout only). More...

Inheritance diagram for I2CControl:
[legend]

Public Member Functions

IEnumerable< TgetEnumerable< T > ()
 Returns an enumerator of a certain type that iterates through the collection.
 
IEnumerator< intGetEnumerator ()
 Returns an enumerator that iterates through the collection.
 
 I2CControl (Device device)
 Constructs a new mv.impact.acquire.I2CControl object.
 
byte[] I2CRead (int deviceAddress, int deviceSubAddress, int deviceSubAddressWidth, int byteCnt)
 Read data from an I2C device.
 
void I2CWrite (int deviceAddress, int deviceSubAddress, int deviceSubAddressWidth, byte[] data)
 Write data to a I2C device.
 
void restoreDefault ()
 Restores the default for every component of this collection.
 

Public Attributes

readonly PropertyS I2CBuffer = new PropertyS()
 Defines the intermediate access buffer that allows the exchange of data between the I2C device and the application.
 
readonly PropertyI I2CBufferLength = new PropertyI()
 An integer property controlling the length of the mapping between the I2C device and the mv.impact.acquire.I2CControl.I2CBuffer property.
 
readonly PropertyI I2CDeviceAddress = new PropertyI()
 An integer property storing the address of the I2C device to communicate with.
 
readonly PropertyI I2CDeviceSubAddress = new PropertyI()
 An integer property storing the sub-address of the I2C device to communicate with.
 
readonly PropertyI I2CDeviceSubAddressWidth = new PropertyI()
 An enumerated integer property storing the sub-address width(in bits) of the I2C device to communicate with.
 
readonly Method I2COperationExecute = new Method()
 Calling this function will execute the operation selected by mv.impact.acquire.I2CControl.I2COperationMode.
 
readonly EnumPropertyI< TI2COperationModeI2COperationMode = new EnumPropertyI<TI2COperationMode>()
 An enumerated integer property to select the I2C operation.
 
readonly EnumPropertyI< TI2COperationStatusI2COperationStatus = new EnumPropertyI<TI2COperationStatus>()
 Represents the I2C operation execution status.
 

Properties

IEnumerable< ComponentcomponentEnumerable [get]
 Returns an enumerator that iterates through the collection.
 
IEnumerable< ComponentListcomponentListEnumerable [get]
 Returns an enumerator that iterates through all the mv.impact.acquire.ComponentList elements in the collection.
 
int hObj [get]
 Returns a unique identifier for the component collection referenced by this object.
 

Detailed Description

Properties for accessing features belonging to the I2C control(Device specific interface layout only).

Properties in this class will only be available if a device has a local I2C bus and this is configured for access from an application. Right now this is only the case for mvBlueFOX-MLC devices.

mvBlueFOX specific:

For mvBlueFOX devices

  • clock stretching is supported
  • bus master is supported

The following I2C addresses will be blocked for access from an application:

i2c addressremark
0x20-0x3F-
0x66-0x67-
0x90-0x91mvBlueFOX-200w only
0xA0-0xA3-
0xA6-0xA7-
0xBA-0xBBmvBlueFOX-202a and mvBlueFOX-205 only

Example

if( i2cc.I2COperationMode.isValid )
{
Assert.DoesNotThrow(delegate { i2cc.I2COperationMode.write(TI2COperationMode.I2ComRead); });
Assert.DoesNotThrow(delegate { i2cc.I2CBufferLength.write(0); });
Assert.AreEqual(TDMR_ERROR.DMR_INVALID_PARAMETER, (TDMR_ERROR)i2cc.I2COperationExecute.call());
Assert.AreEqual(TI2COperationStatus.I2CosNotEnoughData, i2cc.I2COperationStatus.read());
Assert.DoesNotThrow(delegate { i2cc.I2CBufferLength.write(1); });
Assert.AreEqual(TDMR_ERROR.DMR_EXECUTION_FAILED, (TDMR_ERROR)i2cc.I2COperationExecute.call());
Assert.AreEqual(TI2COperationStatus.I2CosFailure, i2cc.I2COperationStatus.read());
Assert.DoesNotThrow(delegate { i2cc.I2COperationMode.write(TI2COperationMode.I2ComWrite); });
Assert.AreEqual(TDMR_ERROR.DMR_INVALID_PARAMETER, (TDMR_ERROR)i2cc.I2COperationExecute.call());
Assert.AreEqual(TI2COperationStatus.I2CosNotEnoughData, i2cc.I2COperationStatus.read());
byte[] pBuf0 = new byte[] { 0x00 };
byte[] pBuf1 = new byte[] { 0xFF };
Assert.DoesNotThrow(delegate { i2cc.I2CBuffer.writeBinary(pBuf0); });
Assert.AreEqual(TDMR_ERROR.DMR_EXECUTION_FAILED, (TDMR_ERROR)i2cc.I2COperationExecute.call());
Assert.AreEqual(TI2COperationStatus.I2CosFailure, i2cc.I2COperationStatus.read());
}
else
{
Console.WriteLine(( "I2CControl not available." );
}
bool isValid
Checks if the internal component referenced by this object is still valid.
Definition Component.cs:727
A template class to represent 32 bit integer properties and 32 bit enumerated integer properties.
Definition EnumPropertyI.cs:61
EnumPropertyI< T > write(T value)
Writes one value to the property.
Definition EnumPropertyI.cs:449
T read()
Reads a value from a property.
Definition EnumPropertyI.cs:342
Properties for accessing features belonging to the I2C control(Device specific interface layout only)...
Definition I2CControl.cs:59
readonly PropertyI I2CBufferLength
An integer property controlling the length of the mapping between the I2C device and the mv....
Definition I2CControl.cs:186
readonly PropertyS I2CBuffer
Defines the intermediate access buffer that allows the exchange of data between the I2C device and th...
Definition I2CControl.cs:184
readonly EnumPropertyI< TI2COperationStatus > I2COperationStatus
Represents the I2C operation execution status.
Definition I2CControl.cs:160
readonly EnumPropertyI< TI2COperationMode > I2COperationMode
An enumerated integer property to select the I2C operation.
Definition I2CControl.cs:153
readonly Method I2COperationExecute
Calling this function will execute the operation selected by mv.impact.acquire.I2CControl....
Definition I2CControl.cs:155
TDMR_ERROR
Errors reported by the device manager.
Definition mvDriverBaseEnums.cs:2374
TI2COperationStatus
Valid I2C operation status values.
Definition mvDriverBaseEnums.cs:2849
TI2COperationMode
Valid I2C operation modes.
Definition mvDriverBaseEnums.cs:2839
Note
This class will only be available if mv.impact.acquire.Device.interfaceLayout is set to mv.impact.acquire.TDeviceInterfaceLayout.dilDeviceSpecific before the device is opened.

Constructor & Destructor Documentation

◆ I2CControl()

I2CControl ( Device device)
inline

Constructs a new mv.impact.acquire.I2CControl object.

Parameters
[in]deviceA pointer to a mv.impact.acquire.Device object obtained from a mv.impact.acquire.DeviceManager object.

Member Function Documentation

◆ getEnumerable< T >()

IEnumerable< T > getEnumerable< T > ( )
inlineinherited

Returns an enumerator of a certain type that iterates through the collection.

This interface will allow to e.g. write code like this:

Info info = new Info(pDev);
foreach (Property c in info.getEnumerable<Property>())
{
}
A class to query various general information about the device, its driver and other information.
Definition Info.cs:10
A base class for properties.
Definition Property.cs:109

See the frameworks documentation about the System.Collections.IEnumerable interface for more information.

Returns
An enumerator that iterates through the collection

◆ GetEnumerator()

IEnumerator< int > GetEnumerator ( )
inlineinherited

Returns an enumerator that iterates through the collection.

See the frameworks documentation about the System.Collections.IEnumerable interface for more information.

Returns
An enumerator that iterates through the collection

◆ I2CRead()

byte[] I2CRead ( int deviceAddress,
int deviceSubAddress,
int deviceSubAddressWidth,
int byteCnt )
inline

Read data from an I2C device.

This is a convenience function that wraps the property access a little. In order to find out if the command has been executed successfully mv.impact.acquire.I2CControl.I2COperationStatus should be checked afterwards.

Parameters
[in]deviceAddressThe address of the I2C device to communicate with.
[in]deviceSubAddressThe sub-address of the I2C device to communicate with.
[in]deviceSubAddressWidthThe sub-address width(in bits) of the I2C device to communicate with.
[in]byteCntThe amount of bytes to read.

◆ I2CWrite()

void I2CWrite ( int deviceAddress,
int deviceSubAddress,
int deviceSubAddressWidth,
byte[] data )
inline

Write data to a I2C device.

This is a convenience function that wraps the property access a little. In order to find out if the command has been executed successfully mv.impact.acquire.I2CControl.I2COperationStatus should be checked afterwards.

Parameters
[in]deviceAddressThe address of the I2C device to communicate with.
[in]deviceSubAddressThe sub-address of the I2C device to communicate with.
[in]deviceSubAddressWidthThe sub-address width(in bits) of the I2C device to communicate with.
[in]dataThe data to write to the I2C device.

◆ restoreDefault()

void restoreDefault ( )
inlineinherited

Restores the default for every component of this collection.

Calling this function will restore the default value for every component belonging to this collection.

Note
The caller must have the right to modify the component. Otherwise an exception will be thrown.

Member Data Documentation

◆ I2CBuffer

Defines the intermediate access buffer that allows the exchange of data between the I2C device and the application.

This property can store binary data.

◆ I2CBufferLength

readonly PropertyI I2CBufferLength = new PropertyI()

An integer property controlling the length of the mapping between the I2C device and the mv.impact.acquire.I2CControl.I2CBuffer property.

◆ I2CDeviceAddress

readonly PropertyI I2CDeviceAddress = new PropertyI()

An integer property storing the address of the I2C device to communicate with.

◆ I2CDeviceSubAddress

readonly PropertyI I2CDeviceSubAddress = new PropertyI()

An integer property storing the sub-address of the I2C device to communicate with.

When mv.impact.acquire.I2CControl.I2CDeviceSubAddressWidth is set to 0, this property will be ignored.

◆ I2CDeviceSubAddressWidth

readonly PropertyI I2CDeviceSubAddressWidth = new PropertyI()

An enumerated integer property storing the sub-address width(in bits) of the I2C device to communicate with.

Valid values for this property are:

  • 0
  • 8
  • 16
Note
This property must be set to 0 for devices not supporting a sub-address.

◆ I2COperationExecute

readonly Method I2COperationExecute = new Method()

Calling this function will execute the operation selected by mv.impact.acquire.I2CControl.I2COperationMode.

◆ I2COperationMode

An enumerated integer property to select the I2C operation.

The selected operation is executed when mv.impact.acquire.I2CControl.I2COperationExecute is called.

Valid values for this property are defined by the enumeration mv.impact.acquire.TI2COperationMode.

◆ I2COperationStatus

Represents the I2C operation execution status.

Valid values for this property are defined by the enumeration mv.impact.acquire.TI2COperationStatus.

Property Documentation

◆ componentEnumerable

IEnumerable<Component> componentEnumerable
getinherited

Returns an enumerator that iterates through the collection.

This interface will allow to e.g. write code like this:

Info info = new Info(pDev);
foreach (Component c in info.componentEnumerable)
{
Console.WriteLine("{0}", c.name);
}
String name
Returns the name of the component referenced by this object.
Definition ComponentAccess.cs:167
A base class to implement access to internal driver components.
Definition Component.cs:133

See the frameworks documentation about the System.Collections.IEnumerable interface for more information.

Returns
An enumerator that iterates through the collection

◆ componentListEnumerable

IEnumerable<ComponentList> componentListEnumerable
getinherited

Returns an enumerator that iterates through all the mv.impact.acquire.ComponentList elements in the collection.

This interface will allow to e.g. write code like this:

Info info = new Info(pDev);
foreach (ComponentList cl in info.componentListEnumerable)
{
Console.WriteLine("{0}", cl.name);
}
A class to provide access to component lists.
Definition ComponentList.cs:14

See the frameworks documentation about the System.Collections.IEnumerable interface for more information.

Returns
An enumerator that iterates through the collection

◆ hObj

int hObj
getinherited

Returns a unique identifier for the component collection referenced by this object.

This handle will always reference an object of type mv.impact.acquire.ComponentList.

Returns
A unique identifier for the component referenced by this object.