Digi.Drivers.I2CiMX51 Class Reference

Inter-Integrated Circuit class This class manage the I2C driver of ConnectCore imX51 platform. More...

Inheritance diagram for Digi.Drivers.I2CiMX51:

Digi.Drivers.I2C

List of all members.

Classes

class  I2C_PACKET
 private class I2C_MESSAGE not accesible for the user This class has been created to convert the I2CMessage into a byte array
struct  I2CPacket
 Internal structure, not accesible to the user.

Public Types

enum  RWOperation { Write = 1, Read = 2 }
 Operation set in the I2C. More...
enum  I2CPort { I2C1 = 1, I2C2 = 2, I2C3 = 3 }
 I2C Ports. More...
enum  I2CResult {
  NoError = 0, ErrorMutexCreationFailed = -1, ErrorPhysicalVirtualMappingFailed = -2, ErrorEventCreationFailed = -3,
  ErrorIRQSystemInterruptIDMappingFailed = -4, ErrorInterruptInitializationFailed = -5, ErrorWorkerThreadFailed = -6, ErrorNoAcknowledgeIssued = -7,
  ErrorNullBuffer = -8, ErrorInvalidBufferSize = -9, ErrorNulllpiResultField = -10, ErrorCRMOperationFailure = -11,
  ErrorI2CTimeout = -12, ErrorI2CArbitrationLost = -13, ErrorI2CGotoAnUndefined = -14
}
 I2C Results. More...

Public Member Functions

 I2CiMX51 (I2CPort I2Cnumber)
 Constructor.
bool SetSlaveMode ()
 Set the I2C device in slave mode.
bool SetMasterMode ()
 set the I2C device in master mode
bool IsMaster (ref bool ismaster)
 determines whether the I2C is currently in Master mode
bool IsSlave (ref bool isslave)
 determines whether the I2C is currently in Slave mode
bool Reset ()
 Perform a hardware reset. Note that the I2C driver will still maintain all the current information of the device, which includes all the initialized addresses.
bool EnableSlave ()
 Enable a I2C slave access from the bus. Note that after the I2C slave interface enabled, I2C slave driver wait for master access all the time.
bool DisableSlave ()
 Disable I2C slave access from the bus. Note that after the I2C slaveinterface disabled, I2C slave module can be turn off.
bool SetSlaveText (byte[] text)
 Store I2C slave text to interface buffer. Note that I2C slave driver directly return data to master from interface buffer. The interface buffer can be accessed at any time, even when I2C slave module has been turned off.
int GetSlaveText (ref byte[] text)
 Return I2C slave interface buffer text. Note that I2C slave driver directly return data to master from interface buffer. The interface buffer can be accessed at any time, even when I2C slave module has been turned off.
override bool Read (ref byte[] Buffer, int count)
 Method that reads from I2C.
override bool Write (ref byte[] Buffer, int count)
 Method that writes into I2C.

Properties

byte Addr [get, set]
 Address property.
RWOperation RW [get, set]
 Read/Write operation property.
uint Length [get, set]
 Length property.
int Result [get]
 Result property.
UInt16 ClockRate [get, set]
 Get/Set the clock rate divisor. Note that the value is not the absolute peripheral clock frequency. The value get/set should be compared against the I2C specifications to obtain the true frequency.
uint Frequency [set]
 Estimate and set the nearest clock rate acceptable for I2C device and initialize the I2C device to use the estimated clock rate divisor. If the estimated clock rate divisor index is required, please refer ClockRate property to determine the estimated index.
byte SelfAddress [get, set]
 Get/Set the address of the I2C device. Note that this property will have no effect if the I2C device is in Master mode.
uint SlaveSize [get, set]
 Get/Set I2C slave interface buffer length. The max acceptable length is I2CSLAVEBUFSIZE (512), if input length is longer than I2CSLAVEBUFSIZE, the operation fail, and origin buffer length not changed. Note that I2C slave driver directly return data to master from interface buffer. The interface buffer can be set at any time, even when I2C slave module has been turned off.


Detailed Description

Inter-Integrated Circuit class This class manage the I2C driver of ConnectCore imX51 platform.


Member Enumeration Documentation

I2C Ports.

            // Use of the constants
            I2CPort.I2C1
            I2CPort.I2C2
            I2CPort.I2C3

I2C Results.

            // Use of the constants
            I2CResult.NoError
            I2CResult.ErrorMutexCreationFailed
            I2CResult.ErrorPhysicalVirtualMappingFailed
            I2CResult.ErrorEventCreationFailed
            I2CResult.ErrorIRQSystemInterruptIDMappingFailed
            I2CResult.ErrorInterruptInitializationFailed
            I2CResult.ErrorWorkerThreadFailed
            I2CResult.ErrorNoAcknowledgeIssued
            I2CResult.ErrorNullBuffer
            I2CResult.ErrorInvalidBufferSize
            I2CResult.ErrorNulllpiResultField
            I2CResult.ErrorCRMOperationFailure
            I2CResult.ErrorI2CTimeout
            I2CResult.ErrorI2CArbitrationLost
            I2CResult.ErrorI2CGotoAnUndefined

Operation set in the I2C.

            // Use of the constants
            RWOperation.Write
            RWOperation.Read


Constructor & Destructor Documentation

public Digi::Drivers.I2CiMX51::I2CiMX51 ( I2CPort  I2Cnumber  ) 

Constructor.


Member Function Documentation

public bool Digi::Drivers.I2CiMX51::DisableSlave (  ) 

Disable I2C slave access from the bus. Note that after the I2C slaveinterface disabled, I2C slave module can be turn off.

Returns:
Return TRUE or FALSE. If the result is TRUE, the operation is successful.

public bool Digi::Drivers.I2CiMX51::EnableSlave (  ) 

Enable a I2C slave access from the bus. Note that after the I2C slave interface enabled, I2C slave driver wait for master access all the time.

Returns:
Return TRUE or FALSE. If the result is TRUE, the operation is successful.

public int Digi::Drivers.I2CiMX51::GetSlaveText ( ref byte[]  text  ) 

Return I2C slave interface buffer text. Note that I2C slave driver directly return data to master from interface buffer. The interface buffer can be accessed at any time, even when I2C slave module has been turned off.

Parameters:
text User buffer to store text returned from interface buffer
Returns:
Actual data bytes returned

public bool Digi::Drivers.I2CiMX51::IsMaster ( ref bool  ismaster  ) 

determines whether the I2C is currently in Master mode

Returns:
Return TRUE or FALSE. If the result is TRUE, the operation is successful.

public bool Digi::Drivers.I2CiMX51::IsSlave ( ref bool  isslave  ) 

determines whether the I2C is currently in Slave mode

Returns:
Return TRUE or FALSE. If the result is TRUE, the operation is successful.

public bool Digi::Drivers.I2CiMX51::Read ( ref byte[]  Buffer,
int  count 
) [virtual]

Method that reads from I2C.

Parameters:
Buffer Buffer to store the data read
count Number of bytes to read
Returns:
True indicates success, false indicates failure

Implements Digi.Drivers.I2C.

public bool Digi::Drivers.I2CiMX51::Reset (  ) 

Perform a hardware reset. Note that the I2C driver will still maintain all the current information of the device, which includes all the initialized addresses.

Returns:
Return TRUE or FALSE. If the result is TRUE, the operation is successful.

public bool Digi::Drivers.I2CiMX51::SetMasterMode (  ) 

set the I2C device in master mode

Returns:
Return TRUE or FALSE. If the result is TRUE, the operation is successful.

public bool Digi::Drivers.I2CiMX51::SetSlaveMode (  ) 

Set the I2C device in slave mode.

Returns:
Return TRUE or FALSE. If the result is TRUE, the operation is successful.

public bool Digi::Drivers.I2CiMX51::SetSlaveText ( byte[]  text  ) 

Store I2C slave text to interface buffer. Note that I2C slave driver directly return data to master from interface buffer. The interface buffer can be accessed at any time, even when I2C slave module has been turned off.

Parameters:
text User buffer to set text in the interface buffer
Returns:
Return TRUE or FALSE. If the result is TRUE, the operation is successful.

public bool Digi::Drivers.I2CiMX51::Write ( ref byte[]  Buffer,
int  count 
) [virtual]

Method that writes into I2C.

Parameters:
Buffer Buffer to write
count Number of bytes to write
Returns:
True indicates success, false indicates failure

Implements Digi.Drivers.I2C.


Property Documentation

byte Digi::Drivers.I2CiMX51::Addr [get, set]

Address property.

Get/Set Address property (uint)

            //example of use
            myi2c.byAddr = 0x12; 
            byte Value = myi2c.byAddr;

UInt16 Digi::Drivers.I2CiMX51::ClockRate [get, set]

Get/Set the clock rate divisor. Note that the value is not the absolute peripheral clock frequency. The value get/set should be compared against the I2C specifications to obtain the true frequency.

Get/Set Clock Rate property (uint)

            //example of use
            myi2c.ClockRate = 0xFF; 
            UInt16 Value = myi2c.ClockRate;

uint Digi::Drivers.I2CiMX51::Frequency [set]

Estimate and set the nearest clock rate acceptable for I2C device and initialize the I2C device to use the estimated clock rate divisor. If the estimated clock rate divisor index is required, please refer ClockRate property to determine the estimated index.

Set Frequency property (uint)

            //example of use
            myi2c.Frequency = 9600; 
            uint Value = myi2c.Frequency;

uint Digi::Drivers.I2CiMX51::Length [get, set]

Length property.

Get/Set Length property (uint)

            //example of use
            myi2c.Length = 1; 
            uint Value = myi2c.Length;

int Digi::Drivers.I2CiMX51::Result [get]

Result property.

Get the result after an operation (int)

            //example of use
            int Value = myi2c.Result;

RWOperation Digi::Drivers.I2CiMX51::RW [get, set]

Read/Write operation property.

Get/Set Read/Write operation property (uint)

            //example of use
            myi2c.RW = 0x0; 
            RWOperation Value = myi2c.RW;

byte Digi::Drivers.I2CiMX51::SelfAddress [get, set]

Get/Set the address of the I2C device. Note that this property will have no effect if the I2C device is in Master mode.

Get/Set the Self Address property (uint)

            //example of use
            myi2c.SelfAddress = 0x10; 
            byte Value = myi2c.SelfAddress;

uint Digi::Drivers.I2CiMX51::SlaveSize [get, set]

Get/Set I2C slave interface buffer length. The max acceptable length is I2CSLAVEBUFSIZE (512), if input length is longer than I2CSLAVEBUFSIZE, the operation fail, and origin buffer length not changed. Note that I2C slave driver directly return data to master from interface buffer. The interface buffer can be set at any time, even when I2C slave module has been turned off.

Get/Set the slave size property (uint)

            //example of use
            myi2c.SlaveSize = 0x30; 
            uint Value = myi2c.SlaveSize;


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

Generated on Fri Oct 16 19:28:05 2009 by  doxygen 1.5.9