LOGGER  Logger
Data Logging using ESP8266
Functions
i2cservices.h File Reference
#include "basetype.h"

Go to the source code of this file.

Functions

void i2cservicesInit ()
 < version of this include file More...
 
void i2cservicesLoop ()
 
void sendToSlave (uint8_t slaveAddress, uint16_t numBytes, const char *pBytes)
 
void i2cPoll (uint8_t i2cAddress)
 
void i2cWriteAddress (uint8_t i2cAddress, uint8_t romAddress)
 
uint8_t i2cReadData (uint8_t i2cAddress, size_t count, uint8_t *pData, uint8_t romAddress=0)
 
uint8_t i2cReadDataByBytes (uint8_t i2cAddress, size_t count, uint8_t *pData, uint8_t romAddress=0)
 
void i2cWriteData (uint8_t i2cAddress, size_t count, uint8_t *pData, uint8_t romAddress, const char *pError=NULL)
 
void i2cWriteBlock (uint8_t i2cAddress, size_t count, uint8_t *pData, uint8_t romAddress, const char *pError=NULL)
 
void i2cDumpWireError (const char *pMsg=NULL)
 

Detailed Description

Interrupt based spying on an I2C pin pair

Function Documentation

void i2cDumpWireError ( const char *  pMsg)

Dump any error condition from I2C driver

Parameters
pMsgpointer to initial message string
void i2cPoll ( uint8_t  i2cAddress)

Poll an i2c device by issuing a simple read operation. A single byte is read after the read.

Parameters
i2cAddressI2C address of part
uint8_t i2cReadData ( uint8_t  i2cAddress,
size_t  count,
uint8_t *  pData,
uint8_t  romAddress = 0 
)

Read data from an I2C device

Parameters
i2cAddressI2C address of part
countnumber of bytes to read
pDatapointer to buffer to put data in
romAddressaddress in ROM of first byte
Returns
number of bytes read
uint8_t i2cReadDataByBytes ( uint8_t  i2cAddress,
size_t  count,
uint8_t *  pData,
uint8_t  romAddress = 0 
)

Read data from an I2C device. This is the same as i2cReadData, but, reads the data one byte at a time. This is useful for devices that do not allow for incrementing the address over a full range of addresses.

Parameters
i2cAddressI2C address of part
countnumber of bytes to read
pDatapointer to buffer to put data in
romAddressaddress in ROM of first byte
Returns
number of bytes read
void i2cservicesInit ( )

< version of this include file

Initialize I2C communication services.

void i2cservicesLoop ( )

call this from the main loop to service I2C communication events in a non interrupt context

void i2cWriteAddress ( uint8_t  i2cAddress,
uint8_t  romAddress 
)

Write an address to an I2C device

Parameters
i2cAddressI2C address of part
romAddressmemory address to send to the part

Write an address to an I2C device

Parameters
romAddressmemory address to send to the part
i2cAddressI2C address of part
void i2cWriteBlock ( uint8_t  i2cAddress,
size_t  count,
uint8_t *  pData,
uint8_t  romAddress,
const char *  pError = NULL 
)

Write a block of data to an I2C device

Parameters
i2cAddressI2C address of part reading from
countnumber of bytes
pDatapointer to data to write
romAddressaddress in ROM of first byte
pErrorpointer to text to use in error message (may be NULL)
void i2cWriteData ( uint8_t  i2cAddress,
size_t  count,
uint8_t *  pData,
uint8_t  romAddress,
const char *  pError = NULL 
)

Write data to an I2C device, this writes a byte at a time.

Parameters
i2cAddressI2C address of part reading from
countnumber of bytes
pDatapointer to data to write
romAddressaddress in ROM of first byte
pErrorpointer to text to use in error message (may be NULL)
void sendToSlave ( uint8_t  slaveAddress,
uint16_t  numBytes,
const char *  pBytes 
)

Send a block of bytes to an I2C slave

Parameters
slaveAddress7 bit I2C address of the slave
numBytesnumber of bytes to send
pBytespointer to block of bytes