LOGGER
Logger
Data Logging using ESP8266
|
#include <arduino.h>
#include "i2cservices.h"
#include "services.h"
#include <Wire.h>
#include "huzzahpins.h"
Macros | |
#define | i2cservicesEdit 1 |
version of this module | |
#define | IS_HUZZAH 1 |
default value for HUZZAH | |
Functions | |
EXTERNDEF void | i2cservicesInit () |
< version of this include file More... | |
EXTERNDEF void | i2cservicesLoop () |
EXTERNDEF void | sendToSlave (uint8_t slaveAddress, uint16_t numBytes, const char *pBytes) |
EXTERNDEF void | i2cDumpWireError (const char *pMsg) |
EXTERNDEF void | i2cWriteAddress (uint8_t i2cAddress, uint8_t romAddress) |
EXTERNDEF void | i2cPoll (uint8_t i2cAddress) |
EXTERNDEF uint8_t | i2cReadData (uint8_t i2cAddress, size_t count, uint8_t *pData, uint8_t romAddress) |
EXTERNDEF uint8_t | i2cReadDataByBytes (uint8_t i2cAddress, size_t count, uint8_t *pData, uint8_t romAddress) |
EXTERNDEF void | i2cWriteData (uint8_t i2cAddress, size_t count, uint8_t *pData, uint8_t romAddress, const char *pError) |
EXTERNDEF void | i2cWriteBlock (uint8_t i2cAddress, size_t count, uint8_t *pData, uint8_t romAddress, const char *pError) |
I2C master communication Support
EXTERNDEF void i2cDumpWireError | ( | const char * | pMsg | ) |
Dump any error condition from I2C driver
pMsg | pointer to initial message string |
EXTERNDEF void i2cPoll | ( | uint8_t | i2cAddress | ) |
Poll an i2c device by issuing a simple read operation. A single byte is read after the read.
i2cAddress | I2C address of part |
EXTERNDEF uint8_t i2cReadData | ( | uint8_t | i2cAddress, |
size_t | count, | ||
uint8_t * | pData, | ||
uint8_t | romAddress = 0 |
||
) |
Read data from an I2C device
i2cAddress | I2C address of part |
count | number of bytes to read |
pData | pointer to buffer to put data in |
romAddress | address in ROM of first byte |
EXTERNDEF 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.
i2cAddress | I2C address of part |
count | number of bytes to read |
pData | pointer to buffer to put data in |
romAddress | address in ROM of first byte |
EXTERNDEF void i2cservicesInit | ( | ) |
< version of this include file
Initialize I2C communication services.
EXTERNDEF void i2cservicesLoop | ( | ) |
call this from the main loop to service I2C communication events in a non interrupt context
EXTERNDEF void i2cWriteAddress | ( | uint8_t | i2cAddress, |
uint8_t | romAddress | ||
) |
Write an address to an I2C device
romAddress | memory address to send to the part |
i2cAddress | I2C address of part |
EXTERNDEF 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
i2cAddress | I2C address of part reading from |
count | number of bytes |
pData | pointer to data to write |
romAddress | address in ROM of first byte |
pError | pointer to text to use in error message (may be NULL) |
EXTERNDEF 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.
i2cAddress | I2C address of part reading from |
count | number of bytes |
pData | pointer to data to write |
romAddress | address in ROM of first byte |
pError | pointer to text to use in error message (may be NULL) |
EXTERNDEF void sendToSlave | ( | uint8_t | slaveAddress, |
uint16_t | numBytes, | ||
const char * | pBytes | ||
) |
Send a block of bytes to an I2C slave
slaveAddress | 7 bit I2C address of the slave |
numBytes | number of bytes to send |
pBytes | pointer to block of bytes |