![]() |
EVShield
v1.3
EVShield Library Reference by mindsensors.com
|
This class implements software i2c interface used by EVShield/NXShield on Arduino. More...
#include <SoftI2cMaster.h>
Public Member Functions | |
| uint8_t | start (uint8_t addressRW) |
| void | stop (void) |
| uint8_t | restart (uint8_t addressRW) |
| uint8_t | write (uint8_t b) |
| uint8_t | read (uint8_t last) |
| SoftI2cMaster (uint8_t devAddr) | |
| void | initProtocol (uint8_t sclPin=(uint8_t) NULL, uint8_t sdaPin=(uint8_t) NULL) |
| uint8_t * | readRegisters (uint8_t startRegister, uint8_t bytes, uint8_t *buf=NULL) |
| bool | writeRegistersWithLocation (int bytes, uint8_t *buf) |
| bool | writeRegisters (uint8_t location, uint8_t bytes_to_write, uint8_t *buffer=0) |
| bool | writeByte (uint8_t location, uint8_t data) |
| bool | writeInteger (uint8_t location, uint16_t data) |
| bool | writeLong (uint8_t location, uint32_t data) |
| char * | readString (uint8_t startRegister, uint8_t bytes, uint8_t *buf=NULL, uint8_t len=0) |
| uint8_t | readByte (uint8_t location) |
| int16_t | readInteger (uint8_t location) |
| uint32_t | readLong (uint8_t location) |
| char * | getFirmwareVersion () |
| char * | getVendorID () |
| char * | getDeviceID () |
| uint8_t | getWriteErrorCode () |
| bool | checkAddress () |
| bool | setAddress (uint8_t address) |
Public Attributes | |
| uint8_t * | _so_buffer |
This class implements software i2c interface used by EVShield/NXShield on Arduino.
| SoftI2cMaster::SoftI2cMaster | ( | uint8_t | devAddr | ) |
class constructor supplies the device address
| bool SoftI2cMaster::checkAddress | ( | ) |
this function checks to see if there is any device at its specified address
| char * SoftI2cMaster::getDeviceID | ( | ) |
get the name of the device
| char * SoftI2cMaster::getFirmwareVersion | ( | ) |
get the version of the firmware
| char * SoftI2cMaster::getVendorID | ( | ) |
get the name of the vendor
| uint8_t SoftI2cMaster::getWriteErrorCode | ( | ) |
Get error of last i2c operation
| void SoftI2cMaster::initProtocol | ( | uint8_t | sclPin = (uint8_t)NULL, |
| uint8_t | sdaPin = (uint8_t)NULL |
||
| ) |
init bus custom scl and sda pins are optional
| uint8_t SoftI2cMaster::read | ( | uint8_t | last | ) |
read a byte and send Ack if last is false else Nak to terminate read
| uint8_t SoftI2cMaster::readByte | ( | uint8_t | location | ) |
read one byte starting at the location
| int16_t SoftI2cMaster::readInteger | ( | uint8_t | location | ) |
read two bytes and parse as an integer starting at the location
| uint32_t SoftI2cMaster::readLong | ( | uint8_t | location | ) |
read and parse as integer type long at the location
| uint8_t * SoftI2cMaster::readRegisters | ( | uint8_t | startRegister, |
| uint8_t | bytes, | ||
| uint8_t * | buf = NULL |
||
| ) |
read number of bytes from start register and return values; optional buffer
| char * SoftI2cMaster::readString | ( | uint8_t | startRegister, |
| uint8_t | bytes, | ||
| uint8_t * | buf = NULL, |
||
| uint8_t | len = 0 |
||
| ) |
read specified number of bytes starting at the startRegister
| uint8_t SoftI2cMaster::restart | ( | uint8_t | addressRW | ) |
issue stop condition, pull down scl, and start again
| bool SoftI2cMaster::setAddress | ( | uint8_t | address | ) |
set the i2c address for this device
| address | new device address. |
| uint8_t SoftI2cMaster::start | ( | uint8_t | addressRW | ) |
issue a start condition for i2c address with read/write bit
| void SoftI2cMaster::stop | ( | void | ) |
issue a stop condition
| uint8_t SoftI2cMaster::write | ( | uint8_t | b | ) |
write byte and return true for Ack or false for Nak
| bool SoftI2cMaster::writeByte | ( | uint8_t | location, |
| uint8_t | data | ||
| ) |
write one byte starting at the specified register location
| bool SoftI2cMaster::writeInteger | ( | uint8_t | location, |
| uint16_t | data | ||
| ) |
write integer starting at the specified register location
| bool SoftI2cMaster::writeLong | ( | uint8_t | location, |
| uint32_t | data | ||
| ) |
write integer type long starting at the specified register location
| bool SoftI2cMaster::writeRegisters | ( | uint8_t | location, |
| uint8_t | bytes_to_write, | ||
| uint8_t * | buffer = 0 |
||
| ) |
write bytes starting at the specified register location
| bool SoftI2cMaster::writeRegistersWithLocation | ( | int | bytes, |
| uint8_t * | buf | ||
| ) |
write number of bytes from buffer
| uint8_t* SoftI2cMaster::_so_buffer |
internal buffer