SparkFun_smol_Power_Board_Arduino_Library
Public Member Functions | List of all members
SMOL_POWER_BOARD_IO Class Reference

#include <SparkFun_smol_Power_Board_IO.h>

Public Member Functions

 SMOL_POWER_BOARD_IO ()
 Create an object to communicate with the SparkFun smôl Power Board over I2C.
 
bool begin (byte address, TwoWire &wirePort)
 Begin communication with the SparkFun smôl Power Board over I2C. More...
 
bool isConnected ()
 Reads the smôl Power Board's I2C address and confirms it matches _address. More...
 
bool readSingleByte (byte registerAddress, byte *buffer, byte waitMS=0)
 Read a single byte from the SparkFun smôl Power Board over I2C. First the register address is written, then the data byte is read. More...
 
bool writeSingleByte (byte registerAddress, byte value)
 Write a single byte to the SparkFun smôl Power Board over I2C. More...
 
bool readMultipleBytes (byte registerAddress, byte *buffer, byte packetLength, byte waitMS=0)
 Read multiple bytes from the SparkFun smôl Power Board over I2C. First the register address is written, then the data bytes are read. More...
 
bool writeMultipleBytes (byte registerAddress, const byte *buffer, byte packetLength)
 Write multiple bytes to the SparkFun smôl Power Board over I2C. More...
 

Detailed Description

Communication interface for the SparkFun smôl Power Board

Member Function Documentation

◆ begin()

bool SMOL_POWER_BOARD_IO::begin ( byte  address,
TwoWire &  wirePort 
)

Begin communication with the SparkFun smôl Power Board over I2C.

Starts two wire interface.

Parameters
deviceAddressThe I2C address of the Power Board. Default is SFE_SMOL_POWER_DEFAULT_I2C_ADDRESS 0x50. Can be changed with setI2CAddress.
wirePortThe TwoWire (I2C) port used to communicate with the Power Board. Default is Wire.
Returns
True if communication with the Power Board was successful, otherwise false.

◆ isConnected()

bool SMOL_POWER_BOARD_IO::isConnected ( )

Reads the smôl Power Board's I2C address and confirms it matches _address.

Returns true if we get a reply from the I2C device.

Returns
True if communication with the Power Board was successful, otherwise false.

◆ readMultipleBytes()

bool SMOL_POWER_BOARD_IO::readMultipleBytes ( byte  registerAddress,
byte *  buffer,
byte  packetLength,
byte  waitMS = 0 
)

Read multiple bytes from the SparkFun smôl Power Board over I2C. First the register address is written, then the data bytes are read.

Reads multiple bytes from a register into buffer byte array.

Parameters
registerAddressThe (software) register address being read from.
bufferA pointer to the byte array which will hold the read data.
packetLengthThe number of bytes to be read.
waitMSThe number of ms to wait before attempting to read the data. This gives the ATtiny43U time to collect the data.
Returns
True if the data was read successfully, otherwise false.

◆ readSingleByte()

bool SMOL_POWER_BOARD_IO::readSingleByte ( byte  registerAddress,
byte *  buffer,
byte  waitMS = 0 
)

Read a single byte from the SparkFun smôl Power Board over I2C. First the register address is written, then the data byte is read.

Read a single byte from a register.

Parameters
registerAddressThe (software) register address being read from.
bufferA pointer to the byte which will hold the read data.
waitMSThe number of ms to wait before attempting to read the data. This gives the ATtiny43U time to collect the data.
Returns
True if the data byte was read successfully, otherwise false.

◆ writeMultipleBytes()

bool SMOL_POWER_BOARD_IO::writeMultipleBytes ( byte  registerAddress,
const byte *  buffer,
byte  packetLength 
)

Write multiple bytes to the SparkFun smôl Power Board over I2C.

Writes multiple bytes to register from buffer byte array.

Parameters
registerAddressThe (software) register address being written to.
bufferA pointer to the byte array to be written.
packetLengthThe number of bytes to be written.
Returns
True if communication with the Power Board was successful, otherwise false.

◆ writeSingleByte()

bool SMOL_POWER_BOARD_IO::writeSingleByte ( byte  registerAddress,
byte  value 
)

Write a single byte to the SparkFun smôl Power Board over I2C.

Writes a single byte into a register.

Parameters
registerAddressThe (software) register address being written to.
valueThe data byte to be written.
Returns
True if communication with the Power Board was successful, otherwise false.

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