SFBHWI2C.h File Reference

Beta support for access to I2C hardware, with the IXM acting as I2C master only. More...

#include "SFBTypes.h"

Include dependency graph for SFBHWI2C.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  SFBHWI2C
 Provide access to the I2C bus hardware on the IXM. More...

Typedefs

typedef u32(* I2CByteSource )(int offset)
 A function pointer type that can be called to obtain the next byte to send on an I2C bus when in 'streaming transmit' mode (see SFBHWI2C::setByteSource()).
typedef bool(* I2CByteSink )(u8 byte)
 A function pointer type that can be called to handle the next byte received from an I2C bus when in 'streaming receive' mode (see SFBHWI2C::setByteSink()).

Enumerations

enum  I2CStatusCodes {
  I2C_MODE_UNINITIALIZED = -4,
  I2C_MODE_ARBITRATION_ERROR = -3,
  I2C_MODE_NO_ACK = -2,
  I2C_MODE_ERROR = -1,
  I2C_MODE_DONE = 0,
  I2C_MODE_RECEIVE = 1,
  I2C_MODE_TRANSMIT = 2,
  I2C_MODE_TRANSCEIVE = 3
}
 States of an I2C engine. More...
enum  I2CInterfaceCodes {
  I2C_1 = 1,
  I2C_2 = 2
}
 I2C interface codes. More...
enum  I2CPinSelectCode {
  I2C1_PINS_WEST_TX_RX = 0,
  I2C1_PINS_SOUTH_D3_D2 = 1,
  I2C2_PINS_EAST_TX_RX = 0
}
 I2C pin selection codes, passed to SFBHWI2C::init() to select which pins will be used for I2C. More...


Detailed Description

Beta support for access to I2C hardware, with the IXM acting as I2C master only.

WARNING! This code has been tested on only a few I2C devices! Your Mileage May Vary!

Author:
Sam Bayless, integrated into SFB core by Dave Ackley
Date:
(C) 2010 Sam Bayless. All rights reserved.
Code License:
The GNU Lesser General Public License
License Note:
All code samples shown in documentation are placed into the public domain.

Typedef Documentation

typedef bool(* I2CByteSink)(u8 byte)

A function pointer type that can be called to handle the next byte received from an I2C bus when in 'streaming receive' mode (see SFBHWI2C::setByteSink()).

When called, a function of this type is passed the next byte received, and it returns true to continue receiving and false to end the command.

typedef u32(* I2CByteSource)(int offset)

A function pointer type that can be called to obtain the next byte to send on an I2C bus when in 'streaming transmit' mode (see SFBHWI2C::setByteSource()).

When called, a function of this type is passed the current 'data count' (see SFBHWI2C::count()), indicating what byte is about to be sent, and it is expected to return 0..255 to provide the next byte to send, or return 256 to end the transmission.


Enumeration Type Documentation

I2C interface codes.

These are the possible values to pass to SFBHWI2C::SFBHWI2C.

Enumerator:
I2C_1  I2C block 1.
I2C_2  I2C block 2.

I2C pin selection codes, passed to SFBHWI2C::init() to select which pins will be used for I2C.

Note the each of the following codes is limited to one specific I2CInterfaceCodes value -- the value passed to SFBHWI2C::init() must be properly coordinated with the value passed to SFBHWI2C!

Enumerator:
I2C1_PINS_WEST_TX_RX  Use WEST_TX_PIN for SDA1 and WEST_RX_PIN for SCL1.
I2C1_PINS_SOUTH_D3_D2  Use SOUTH_D3_PIN for SDA1 and SOUTH_D2_PIN for SCL1.
I2C2_PINS_EAST_TX_RX  Use EAST_TX_PIN for SDA2 and EAST_RX_PIN for SCL2.

States of an I2C engine.

These are the possible return values from SFBHWI2C::status.

Enumerator:
I2C_MODE_UNINITIALIZED  I2C uninitialized.
I2C_MODE_ARBITRATION_ERROR  I2C arbitration lost in SLA+W or DATA.
I2C_MODE_NO_ACK  I2C no ACK received after SLA+W or DATA.
I2C_MODE_ERROR  I2C unspecified error.
I2C_MODE_DONE  I2C idle or done.
I2C_MODE_RECEIVE  I2C currently receiving.
I2C_MODE_TRANSMIT  I2C currently transmitting.
I2C_MODE_TRANSCEIVE  I2C currently in transmit portion of xmt+rcv combo.


Generated on Fri Apr 22 06:55:17 2011 for SFB by doxygen 1.5.9