|
DUDS
|
Distributed Update of Data from Something
|
A basic I2C interface. More...
#include <I2c.hpp>
Public Member Functions | |
| virtual int | address () const =0 |
| Returns the address of the device that this object will attempt to communicate with. More... | |
| virtual void | converse (Conversation &conv)=0 |
| Conducts I2C communication with a device. More... | |
Public Member Functions inherited from duds::hardware::interface::Conversationalist | |
| virtual | ~Conversationalist ()=0 |
| Allow proper destruction using a Conversationalist pointer. More... | |
|
pure virtual |
Returns the address of the device that this object will attempt to communicate with.
Implemented in duds::hardware::interface::linux::DevI2c.
|
pure virtual |
Conducts I2C communication with a device.
The MpfVarlen flag of ConversationPart may be optionally honored. The part is expected to have an adequately long buffer allocated before this call. Implementations should throw I2cErrorPartLength if the buffer is inadequate. The I2C standard, as published by NXP, does not seem to address incoming messages of varying length with the length sent by the device (slave), so there doesn't seem to be a good general minimum. Linux requires more than 32 bytes.
The MpfBreak flag of ConversationPart objects should be honored by causing a stop condition, but it is implementation defined as to whether the bus may be used by other threads or processes before continuing with this conversation. A multi-master bus will always allow another master to start communicating after a stop condition. Conversation parts between set MpfBreak flags should be sent with a single stop condition.
| conv | The conversation to have with the device on the other end. |
The exceptions listed below may not include some that are specific to an implementation, but those exception classes should derive from I2cError.
| I2cErrorConversationLength | The conversation has too many parts for the implementation to handle. |
| I2cErrorPartLength | A variable length input part had a buffer that was too short. |
| I2cErrorBusy | The bus was in use for an inordinate length of time. This is not caused by scheduling on the same host computer. It can be caused by another I2C master on a mulit-master bus. |
| I2cErrorNoDevice | The device did not respond to its address. |
| I2cErrorUnsupported | An operation is unsupported by the master. |
| I2cErrorProtocol | Data from the device does not conform to the I2C protocol. |
| I2cErrorTimeout | The operation took too long resulting in a bus timeout. |
| I2cError | A general error that doesn't fit one of the other exceptions. |
Implements duds::hardware::interface::Conversationalist.
Implemented in duds::hardware::interface::linux::DevI2c.