This library supports DAC63004 and DAC63004W devices. Currently the implementation allows I2C connection to the device. SPI will be added in the future.
Device diagram |
Evaluation Module |
Warning: If using an ESP32, make sure to properly setup the I2C pins before creating the
I2cDevice
. Add a reference tonanoFramework.Hardware.ESP32
NuGet package and add the following code lines:
//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the I2C GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);
For other devices like STM32, please make sure you're using the preset pins for the I2C/SPI bus you want to use.
- DAC63004W EVM
- Male/Female Jumper Wires
- SCL - SCL
- SDA - SDA
- VCC - 5V
- GND - GND
The following code creates an I2C configuration and instantiates a Dac63004 object. Then it prints the Minimum System Voltage detected by the device at boot. Last it enters a loop where it prints the current Vbus voltage each second.
I2cConnectionSettings settings = new I2cConnectionSettings(1, Bq25798.DefaultI2cAddress);
I2cDevice device = I2cDevice.Create(settings);
using (Bq25798 charger = new Bq25798(device))
{
Debug.WriteLine("");
Debug.WriteLine($"DAC63004 connected to I2C{device.ConnectionSettings.BusId}");
Debug.WriteLine("");
Debug.WriteLine($"Minimum System Voltage is config @ {charger.MinimalSystemVoltage.VoltsDc:N3}V");
while (true)
{
Debug.WriteLine($"Current Vbus: {charger.Vbus.VoltsDc:N3}V");
Debug.WriteLine("");
Thread.Sleep(1000);
}
}
The development of this library was kindly sponsored by OrgPal.IoT!