update
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
i2c_device_config_t INA260_DEV_CFG = {
|
||||
.dev_addr_length = I2C_ADDR_BIT_LEN_7,
|
||||
.device_address = 0x40,
|
||||
.device_address = INA260_ADDRESS,
|
||||
.scl_speed_hz = 100000,
|
||||
};
|
||||
|
||||
@@ -13,10 +13,11 @@ void ina260_reset() {
|
||||
i2c_write_register_16(INA260_DEV_HANDLE, 0x00, 0x0FFF); // set ina max averaging and max time
|
||||
}
|
||||
|
||||
void ina260_init()
|
||||
esp_err_t ina260_init()
|
||||
{
|
||||
ESP_ERROR_CHECK(i2c_master_bus_add_device(i2c0_bus_hdl, &INA260_DEV_CFG, &INA260_DEV_HANDLE));
|
||||
i2c_write_register_16(INA260_DEV_HANDLE, INA260_CONFIG_REGISTER,
|
||||
esp_err_t ret = i2c_master_bus_add_device(i2c0_bus_hdl, &INA260_DEV_CFG, &INA260_DEV_HANDLE);
|
||||
if (ret != ESP_OK) {return ret;}
|
||||
return i2c_write_register_16(INA260_DEV_HANDLE, INA260_CONFIG_REGISTER,
|
||||
CONFIG_AVG_1024 | CONFIG_VBUSCT_8_244MS | CONFIG_ISHCT_8_244MS | CONFIG_MODE_CURRENT_VOLTAGE_CONTINOUS); // set ina max averaging and max time
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user