2020# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121# THE SOFTWARE.
2222"""
23- `Adafruit_MCP4725`
24- ====================================================
23+ `adafruit_mcp4725` - MCP4725 digital to analog converter
24+ ========================================================
2525
2626CircuitPython module for the MCP4725 digital to analog converter. See
2727examples/simpletest.py for a demo of the usage.
3535
3636
3737# Internal constants:
38- _MCP4725_DEFAULT_ADDRESS = const ( 0b01100010 )
38+ _MCP4725_DEFAULT_ADDRESS = 0b01100010
3939_MCP4725_WRITE_FAST_MODE = const (0b00000000 )
4040
4141
4242class MCP4725 :
4343 """MCP4725 12-bit digital to analog converter. This class has a similar
44- interface as the CircuitPython AnalogOut class and can be used in place
45- of that module. To construct pass the following parameters to the
46- initializer:
47- - i2c: The I2C bus.
44+ interface as the CircuitPython AnalogOut class and can be used in place
45+ of that module.
4846
49- Optionally pass:
50- - address: The address of the device if set differently from the default.
47+ :param ~busio.I2C i2c: The I2C bus.
48+ :param int address: The address of the device if set differently from the default.
5149 """
5250
5351
@@ -99,11 +97,12 @@ def _read(self):
9997
10098 @property
10199 def value (self ):
102- """Get and set the DAC value as a 16-bit unsigned value compatible
103- with the AnalogOut class. Note that the MCP4725 is still just a 12-bit
104- device so quantization will occur. If you'd like to instead deal with
105- the raw 12-bit value use the raw_value property, or the normalized_value
106- property to deal with a 0...1 float value.
100+ """The DAC value as a 16-bit unsigned value compatible with the
101+ :py:class:`~analogio.AnalogOut` class.
102+
103+ Note that the MCP4725 is still just a 12-bit device so quantization will occur. If you'd
104+ like to instead deal with the raw 12-bit value use the raw_value property, or the
105+ normalized_value property to deal with a 0...1 float value.
107106 """
108107 raw_value = self ._read ()
109108 # Scale up to 16-bit range.
@@ -118,9 +117,8 @@ def value(self, val):
118117
119118 @property
120119 def raw_value (self ):
121- """Get and set the DAC value as a 12-bit unsigned value. This is the
122- the true resolution of the DAC and will never peform scaling or run
123- into quantization error.
120+ """The DAC value as a 12-bit unsigned value. This is the the true resolution of the DAC
121+ and will never peform scaling or run into quantization error.
124122 """
125123 return self ._read ()
126124
@@ -130,8 +128,7 @@ def raw_value(self, val):
130128
131129 @property
132130 def normalized_value (self ):
133- """Get and set the DAC value as a floating point number in the range
134- 0 to 1.0.
131+ """The DAC value as a floating point number in the range 0.0 to 1.0.
135132 """
136133 return self ._read ()/ 4095.0
137134
0 commit comments