-
Notifications
You must be signed in to change notification settings - Fork 41
Class Instantiation
The default INA class instantiation uses no parameters and does not actually perform any actions apart from instantiating the class.
As of v1.0.14 another instantiation call has been added that allows the use of dynamically allocated memory (RAM) rather than EEPROM for storing the individual device information for each INA on the I2C bus. This is done by specifying an unsigned integer in the class instantiation call which contains the maximum number of expected devices. This number is used to allocate dynamic storage for each device, currently 20 bytes per device. No error is raised if the memory cannot be allocated, but the program will subsequently crash when attempting to access a device. Likewise no range checking is done, e.g. when instantiated with "INA_Class INA(4);" but with 5 devices on the I2C bus the program will crash when scanning for the 5th device.
The begin() function call does all of the heavy lifting and initialization. This split is done since some of the initialization functionality might not have been defined at the point in time that the INA class is instantiated, this is due to the way that the Arduino IDE works and there is no control of that from the programmer's side.
INA_Class INA(); // instantiate the class using EEPROM storage for INA device information
//INA_Class INA(6); // instantiate the class using no EEPROM but dynamic RAM for INA device information,
// this example reserves an additional 120 bytes of RAM but leaves EEPROM untouched
/* Program code follows */
INA.begin(1,100000); // +/- 1 Amp and a .1 Ohm resistor (.1 * 1000 * 1000 )
/* Program code follows */
Overview
Installation
Class Instantiation
begin()
setI2CSpeed()
getBusMilliVolts()
getBusRaw()
getShuntMicroVolts()
getShuntRaw()
getBusMicroAmps()
getBusMicroWatts()
getDeviceAddress()
getDeviceName()
setMode()
setAveraging()
setBusConversion()
setShuntConversion()
reset()
waitForConversion()
conversionFinished()
alertOnConversion()
alertOnShuntOverVoltage()
alertOnShuntUnderVoltage()
alertOnBusOverVoltage()
alertOnBusUnderVoltage()
alertOnPowerOverLimit()