EVShield  v1.3
EVShield Library Reference by mindsensors.com
SoftI2cMaster Class Reference

This class implements software i2c interface used by EVShield/NXShield on Arduino. More...

#include <SoftI2cMaster.h>

Inheritance diagram for SoftI2cMaster:
EVShieldI2C EVs_AbsoluteIMU EVs_AngleSensor EVs_CurrentMeter EVs_DISTNx EVs_EV3SensorMux EVs_LightSensorArray EVs_LineLeader EVs_MagicWand EVs_NumericPad EVs_NXTCam EVs_NXTMMX EVs_NXTServo EVs_PFMate EVs_PiLight EVs_PSPNx EVs_RTC EVs_VoltMeter EVShieldBank

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

Detailed Description

This class implements software i2c interface used by EVShield/NXShield on Arduino.

Constructor & Destructor Documentation

§ SoftI2cMaster()

SoftI2cMaster::SoftI2cMaster ( uint8_t  devAddr)

class constructor supplies the device address

Member Function Documentation

§ checkAddress()

bool SoftI2cMaster::checkAddress ( )

this function checks to see if there is any device at its specified address

§ getDeviceID()

char * SoftI2cMaster::getDeviceID ( )

get the name of the device

§ getFirmwareVersion()

char * SoftI2cMaster::getFirmwareVersion ( )

get the version of the firmware

§ getVendorID()

char * SoftI2cMaster::getVendorID ( )

get the name of the vendor

§ getWriteErrorCode()

uint8_t SoftI2cMaster::getWriteErrorCode ( )

Get error of last i2c operation

§ initProtocol()

void SoftI2cMaster::initProtocol ( uint8_t  sclPin = (uint8_t)NULL,
uint8_t  sdaPin = (uint8_t)NULL 

init bus custom scl and sda pins are optional

§ read()

uint8_t SoftI2cMaster::read ( uint8_t  last)

read a byte and send Ack if last is false else Nak to terminate read

§ readByte()

uint8_t SoftI2cMaster::readByte ( uint8_t  location)

read one byte starting at the location

§ readInteger()

int16_t SoftI2cMaster::readInteger ( uint8_t  location)

read two bytes and parse as an integer starting at the location

§ readLong()

uint32_t SoftI2cMaster::readLong ( uint8_t  location)

read and parse as integer type long at the location

§ readRegisters()

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

§ readString()

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

§ restart()

uint8_t SoftI2cMaster::restart ( uint8_t  addressRW)

issue stop condition, pull down scl, and start again

§ setAddress()

bool SoftI2cMaster::setAddress ( uint8_t  address)

set the i2c address for this device

addressnew device address.

§ start()

uint8_t SoftI2cMaster::start ( uint8_t  addressRW)

issue a start condition for i2c address with read/write bit

§ stop()

void SoftI2cMaster::stop ( void  )

issue a stop condition

§ write()

uint8_t SoftI2cMaster::write ( uint8_t  b)

write byte and return true for Ack or false for Nak

§ writeByte()

bool SoftI2cMaster::writeByte ( uint8_t  location,
uint8_t  data 

write one byte starting at the specified register location

§ writeInteger()

bool SoftI2cMaster::writeInteger ( uint8_t  location,
uint16_t  data 

write integer starting at the specified register location

§ writeLong()

bool SoftI2cMaster::writeLong ( uint8_t  location,
uint32_t  data 

write integer type long starting at the specified register location

§ writeRegisters()

bool SoftI2cMaster::writeRegisters ( uint8_t  location,
uint8_t  bytes_to_write,
uint8_t *  buffer = 0 

write bytes starting at the specified register location

§ writeRegistersWithLocation()

bool SoftI2cMaster::writeRegistersWithLocation ( int  bytes,
uint8_t *  buf 

write number of bytes from buffer

Member Data Documentation

§ _so_buffer

uint8_t* SoftI2cMaster::_so_buffer

internal buffer

The documentation for this class was generated from the following files: