SparkFun_smol_Power_Board_Arduino_Library
|
#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... | |
Communication interface for the SparkFun smôl Power Board
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.
deviceAddress | The I2C address of the Power Board. Default is SFE_SMOL_POWER_DEFAULT_I2C_ADDRESS 0x50. Can be changed with setI2CAddress. |
wirePort | The TwoWire (I2C) port used to communicate with the Power Board. Default is Wire. |
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.
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.
registerAddress | The (software) register address being read from. |
buffer | A pointer to the byte array which will hold the read data. |
packetLength | The number of bytes to be read. |
waitMS | The number of ms to wait before attempting to read the data. This gives the ATtiny43U time to collect the data. |
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.
registerAddress | The (software) register address being read from. |
buffer | A pointer to the byte which will hold the read data. |
waitMS | The number of ms to wait before attempting to read the data. This gives the ATtiny43U time to collect the data. |
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.
registerAddress | The (software) register address being written to. |
buffer | A pointer to the byte array to be written. |
packetLength | The number of bytes to be written. |
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.
registerAddress | The (software) register address being written to. |
value | The data byte to be written. |