-
Notifications
You must be signed in to change notification settings - Fork 51
/
Adafruit_MCP4725.h
37 lines (31 loc) · 1.17 KB
/
Adafruit_MCP4725.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**************************************************************************/
/*!
@file Adafruit_MCP4725.h
*/
/**************************************************************************/
#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)
/**************************************************************************/
/*!
@brief Class for communicating with an MCP4725 DAC
*/
/**************************************************************************/
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);
private:
Adafruit_I2CDevice *i2c_dev = NULL;
};
#endif