Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,45 @@ | ||
/**************************************************************************/ | ||
/*! | ||
/*! | ||
@file Adafruit_MCP4725.h | ||
@author K. Townsend (Adafruit Industries) | ||
@license BSD (see license.txt) | ||
This is a library for the Adafruit MCP4725 breakout board | ||
----> http://www.adafruit.com/products/935 | ||
Adafruit invests time and resources providing this open source code, | ||
please support Adafruit and open-source hardware by purchasing | ||
products from Adafruit! | ||
@license BSD (see license.txt) | ||
@section HISTORY | ||
This is a library for the Adafruit MCP4725 breakout board | ||
----> http://www.adafruit.com/products/935 | ||
Adafruit invests time and resources providing this open source code, | ||
please support Adafruit and open-source hardware by purchasing | ||
products from Adafruit! | ||
@section HISTORY | ||
v1.0 - First release | ||
*/ | ||
/**************************************************************************/ | ||
|
||
#ifndef _ADAFRUIT_MCP4725_H_ | ||
#define _ADAFRUIT_MCP4725_H_ | ||
|
||
#include <Adafruit_BusIO_Register.h> | ||
#include <Adafruit_I2CDevice.h> | ||
#include <Wire.h> | ||
|
||
#define MCP4725_I2CADDR_DEFAULT (0x62) // Default i2c address | ||
#define MCP4725_CMD_WRITEDAC (0x40) // Writes data to the DAC | ||
#define MCP4725_CMD_WRITEDACEEPROM (0x60) // Writes data to the DAC and the EEPROM (persisting the assigned value after reset) | ||
#define MCP4725_I2CADDR_DEFAULT (0x62) // Default i2c address | ||
#define MCP4725_CMD_WRITEDAC (0x40) // Writes data to the DAC | ||
#define MCP4725_CMD_WRITEDACEEPROM \ | ||
(0x60) // Writes data to the DAC and the EEPROM (persisting the assigned value | ||
// after reset) | ||
|
||
class Adafruit_MCP4725{ | ||
public: | ||
class Adafruit_MCP4725 { | ||
public: | ||
Adafruit_MCP4725(); | ||
bool begin(uint8_t i2c_address = MCP4725_I2CADDR_DEFAULT, | ||
TwoWire *wire = &Wire); | ||
bool setVoltage(uint16_t output, bool writeEEPROM, | ||
uint32_t dac_frequency=400000); | ||
bool setVoltage(uint16_t output, bool writeEEPROM, | ||
uint32_t dac_frequency = 400000); | ||
|
||
private: | ||
private: | ||
Adafruit_I2CDevice *i2c_dev = NULL; | ||
}; | ||
|
||
#endif |