STC3115 Arduino I2C Driver
STC3115 Gas Gauge I2C Driver for Arduino
 All Classes Functions
Public Member Functions | Protected Attributes | List of all members
STC3115I2CCore Class Reference
Inheritance diagram for STC3115I2CCore:
STC3115

Public Member Functions

 STC3115I2CCore (uint8_t address=0x70)
 Initialize STC3115 I2C driver and assign the address. More...
 
bool beginI2C ()
 Initialize I2C and check whether the address is available or not. More...
 
bool readRegister (uint8_t *output, uint8_t reg)
 Read an unsigned byte from a register and return the read status. More...
 
bool readRegisterRegion (uint8_t *output, uint8_t reg, uint8_t length)
 Read unsigned bytes from register range. More...
 
bool readRegisterInt16 (int16_t *output, uint8_t reg)
 Read 2 bytes of data and convert it to a signed integer. More...
 
bool readRegisterInt (int *output, uint8_t reg)
 Read signed integer value from a register. More...
 
bool writeRegister (uint8_t reg, uint8_t data)
 Write unsigned byte data to a register. More...
 
bool writeRegisterInt (uint8_t reg, int data)
 Write signed integer data to a register. More...
 
bool writeRegister (uint8_t reg, uint8_t *data, size_t length)
 Write array of unsigned bytes to a register. More...
 

Protected Attributes

uint8_t address
 

Constructor & Destructor Documentation

STC3115I2CCore::STC3115I2CCore ( uint8_t  address = 0x70)

Initialize STC3115 I2C driver and assign the address.

Parameters
address

Member Function Documentation

bool STC3115I2CCore::beginI2C ( )

Initialize I2C and check whether the address is available or not.

Returns
true
false
bool STC3115I2CCore::readRegister ( uint8_t *  output,
uint8_t  reg 
)

Read an unsigned byte from a register and return the read status.

Parameters
outputpointer to the variable that will hold the result
regregister address
Returns
true
false
bool STC3115I2CCore::readRegisterInt ( int *  output,
uint8_t  reg 
)

Read signed integer value from a register.

Parameters
outputpointer to a variable that will hold the result
regregister address
Returns
true
false
bool STC3115I2CCore::readRegisterInt16 ( int16_t *  output,
uint8_t  reg 
)

Read 2 bytes of data and convert it to a signed integer.

Parameters
outputpointer to the variable that will hold the result
regregister address
Returns
true
false
bool STC3115I2CCore::readRegisterRegion ( uint8_t *  output,
uint8_t  reg,
uint8_t  length 
)

Read unsigned bytes from register range.

Parameters
outputarray that will hold the read result
regregister to start reading
lengthlength of the bytes
Returns
true
false
bool STC3115I2CCore::writeRegister ( uint8_t  reg,
uint8_t  data 
)

Write unsigned byte data to a register.

Parameters
regregister address
datadata to be written
Returns
true
false
bool STC3115I2CCore::writeRegister ( uint8_t  reg,
uint8_t *  data,
size_t  length 
)

Write array of unsigned bytes to a register.

Parameters
regregister address
dataarray of unsigned bytes
lengthlength of the array
Returns
true
false
bool STC3115I2CCore::writeRegisterInt ( uint8_t  reg,
int  data 
)

Write signed integer data to a register.

Parameters
regregister address
datadata to be written
Returns
true
false

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