Digital IO
|
Classes | |
class | FastI2cMaster< sclPin, sdaPin > |
Fast software I2C master class. More... | |
class | I2cMasterBase |
Base class for FastI2cMaster, SoftI2cMaster. More... | |
class | SoftI2cMaster |
Software I2C master class. More... | |
Functions | |
SoftI2cMaster::SoftI2cMaster (uint8_t sclPin, uint8_t sdaPin) | |
void | SoftI2cMaster::begin (uint8_t sclPin, uint8_t sdaPin) |
uint8_t | SoftI2cMaster::read (uint8_t last) |
void | SoftI2cMaster::start () |
void | SoftI2cMaster::stop (void) |
bool | I2cMasterBase::transfer (uint8_t addressRW, void *buf, size_t nbyte, uint8_t option=I2C_STOP) |
bool | I2cMasterBase::transferContinue (void *buf, size_t nbyte, uint8_t option=I2C_STOP) |
bool | SoftI2cMaster::write (uint8_t b) |
Variables | |
const uint8_t | STATE_REP_START = 1 |
const uint8_t | STATE_RX_ADDR_NACK = 4 |
const uint8_t | STATE_RX_DATA = 2 |
const uint8_t | STATE_STOP = 0 |
const uint8_t | STATE_TX_ADDR_NACK = 5 |
const uint8_t | STATE_TX_DATA = 3 |
const uint8_t | STATE_TX_DATA_NACK = 6 |
Software Two Wire Interface library.
SoftI2cMaster::SoftI2cMaster | ( | uint8_t | sclPin, |
uint8_t | sdaPin | ||
) |
Constructor, initialize SCL/SDA pins and set the bus high.
[in] | sdaPin | The software SDA pin number. |
[in] | sclPin | The software SCL pin number. |
Definition at line 115 of file SoftI2cMaster.cpp.
void SoftI2cMaster::begin | ( | uint8_t | sclPin, |
uint8_t | sdaPin | ||
) |
Initialize SCL/SDA pins and set the bus high.
[in] | sdaPin | The software SDA pin number. |
[in] | sclPin | The software SCL pin number. |
Definition at line 126 of file SoftI2cMaster.cpp.
uint8_t SoftI2cMaster::read | ( | uint8_t | last | ) | [virtual] |
Read a byte
[in] | last | send a NACK to terminate read if last is true else send an ACK to continue the read. |
Implements I2cMasterBase.
Definition at line 160 of file SoftI2cMaster.cpp.
void SoftI2cMaster::start | ( | ) | [virtual] |
Issue a start condition
Implements I2cMasterBase.
Definition at line 186 of file SoftI2cMaster.cpp.
void SoftI2cMaster::stop | ( | void | ) | [virtual] |
Issue a stop condition.
Implements I2cMasterBase.
Definition at line 198 of file SoftI2cMaster.cpp.
bool I2cMasterBase::transfer | ( | uint8_t | addrRW, |
void * | buf, | ||
size_t | nbytes, | ||
uint8_t | option = I2C_STOP |
||
) |
Start an I2C transfer with possible continuation.
[in] | addrRW | I2C slave address plus R/W bit. The I2C slave address is in the high seven bits and is ORed with on of the following:
|
[in,out] | buf | Source or destination for transfer. |
[in] | nbytes | Number of bytes to transfer (may be zero). |
[in] | option | Option for ending the transfer, one of:
|
Definition at line 51 of file SoftI2cMaster.cpp.
bool I2cMasterBase::transferContinue | ( | void * | buf, |
size_t | nbytes, | ||
uint8_t | option = I2C_STOP |
||
) |
Continue an I2C transfer.
[in,out] | buf | Source or destination for transfer. |
[in] | nbytes | Number of bytes to transfer (may be zero). |
[in] | option | Option for ending the transfer, one of:
|
Definition at line 80 of file SoftI2cMaster.cpp.
bool SoftI2cMaster::write | ( | uint8_t | data | ) | [virtual] |
Write a byte
[in] | data | byte to write |
Implements I2cMasterBase.
Definition at line 214 of file SoftI2cMaster.cpp.
const uint8_t STATE_REP_START = 1 |
Repeated start condition transmitted.
Definition at line 45 of file SoftI2cMaster.h.
const uint8_t STATE_RX_ADDR_NACK = 4 |
Slave address plus read bit transmitted, NACK received.
Definition at line 54 of file SoftI2cMaster.h.
const uint8_t STATE_RX_DATA = 2 |
Read data transfer active.
Definition at line 48 of file SoftI2cMaster.h.
const uint8_t STATE_STOP = 0 |
Stop condition transmitted.
Definition at line 42 of file SoftI2cMaster.h.
const uint8_t STATE_TX_ADDR_NACK = 5 |
Slave address plus write bit transmitted, NACK received.
Definition at line 57 of file SoftI2cMaster.h.
const uint8_t STATE_TX_DATA = 3 |
Write data transfer active.
Definition at line 51 of file SoftI2cMaster.h.
const uint8_t STATE_TX_DATA_NACK = 6 |
Data byte transmitted, NACK received.
Definition at line 59 of file SoftI2cMaster.h.