-
Notifications
You must be signed in to change notification settings - Fork 41
setI2CSpeed()
Arnd edited this page Oct 29, 2018
·
3 revisions
The I2C bus defaults to the slowest speed, 100KHz. The INA devices allow for higher speeds and this call will change the bus speed, one of the following constants can be used:
Constant | Speed |
---|---|
INA_I2C_STANDARD_MODE | 100KHz |
INA_I2C_FAST_MODE | 400KHz |
INA_I2C_FAST_MODE_PLUS | 1MHz |
INA_I2C_HIGH_SPEED_MODE | 3.4MHz |
Note that the I2C bus speed should be that of the slowest device attached to the bus.
INA_Class INA(); // Instantiate the class
void setup() {
INA.begin(1,100000); // 1A max current and a 0.1 Ohm shunt resistor
// Note that a power resistor should be used
// to dissipate sufficient generated heat,
// Watts = Amps² x Resistance (0.1W in this case)
INA.setI2CSpeed(INA_I2C_FAST_MODE_PLUS); // increase bus speed to 1MHz
} // of Setup
void loop() {
/* ... */
} // of main loop
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()