Class that stores state and functions for interacting with the MCP4728 I2C Digital Potentiometer.
More...
#include <Adafruit_MCP4728.h>
|
| Adafruit_MCP4728 () |
| Instantiates a new MCP4728 class.
|
|
bool | begin (uint8_t i2c_address=MCP4728_I2CADDR_DEFAULT, TwoWire *wire=&Wire) |
| Sets up the hardware and initializes I2C. More...
|
|
bool | setChannelValue (MCP4728_channel_t channel, uint16_t new_value, MCP4728_vref_t new_vref=MCP4728_VREF_VDD, MCP4728_gain_t new_gain=MCP4728_GAIN_1X, MCP4728_pd_mode_t new_pd_mode=MCP4728_PD_MODE_NORMAL, bool udac=false) |
| Sets the input register for a given channel to the specified settings. More...
|
|
bool | fastWrite (uint16_t channel_a_value, uint16_t channel_b_value, uint16_t channel_c_value, uint16_t channel_d_value) |
| Set the values of all four channels simultaneously with minimal delay or configuration. More...
|
|
bool | saveToEEPROM (void) |
| Saves the DAC's input register settings to the internal EEPROM, makeing them the default values when the ADC is powered on. More...
|
|
Class that stores state and functions for interacting with the MCP4728 I2C Digital Potentiometer.
◆ begin()
Sets up the hardware and initializes I2C.
- Parameters
-
i2c_address | The I2C address to be used. |
wire | The Wire object to be used for I2C connections. |
- Returns
- True if initialization was successful, otherwise false.
◆ setChannelValue()
Sets the input register for a given channel to the specified settings.
- Parameters
-
channel | The channel to update |
new_value | The new value to assign |
new_vref | Optional vref setting - Defaults to MCP4728_VREF_VDD |
new_gain | Optional gain setting - Defaults to MCP4728_GAIN_1X |
new_pd_mode | Optional power down mode setting - Defaults to MCP4728_PD_MOOE_NORMAL |
udac | Optional UDAC setting - Defaults to false , latching immediately. Set to true to latch when the LDAC pin is pulled low |
- Returns
- true if the write was successful
-
false if there was an error with I2C communication between the MCU and the DAC
◆ fastWrite()
bool Adafruit_MCP4728::fastWrite |
( |
uint16_t |
channel_a_value, |
|
|
uint16_t |
channel_b_value, |
|
|
uint16_t |
channel_c_value, |
|
|
uint16_t |
channel_d_value |
|
) |
| |
Set the values of all four channels simultaneously with minimal delay or configuration.
- Parameters
-
channel_a_value | The value to assign to channel A |
channel_b_value | The value to assign to channel B |
channel_c_value | The value to assign to channel C |
channel_d_value | The value to assign to channel D |
- Returns
- true if the write was successful
-
false if there was an error with I2C communication between the MCU and the DAC
◆ saveToEEPROM()
bool Adafruit_MCP4728::saveToEEPROM |
( |
void |
| ) |
|
Saves the DAC's input register settings to the internal EEPROM, makeing them the default values when the ADC is powered on.
- Returns
- true if the write was successful
-
false if there was an error with I2C communication between the MCU and the DAC
The documentation for this class was generated from the following files: