-
Notifications
You must be signed in to change notification settings - Fork 38
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
5 changed files
with
232 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.. |DAC2Unit| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/Unit-DAC2/img-d3d02dea-e7ad-4543-ae7c-84957de8329e.webp | ||
:target: https://docs.m5stack.com/en/unit/Unit-DAC2 | ||
:height: 200px | ||
:width: 200 px | ||
|
||
.. |DAC2Hat| image:: https://static-cdn.m5stack.com/resource/docs/products/hat/Hat-DAC2/img-26204d9b-195c-4c62-afbb-5b3232c09381.webp | ||
:target: https://docs.m5stack.com/en/hat/Hat-DAC2 | ||
:height: 200px | ||
:width: 200 px | ||
|
||
.. |init.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/dac2/init.svg | ||
|
||
.. |setDACOutputVoltageRange.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/dac2/setDACOutputVoltageRange.svg | ||
|
||
.. |setVoltage.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/dac2/setVoltage.svg | ||
|
||
.. |setVoltageBoth.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/dac2/setVoltageBoth.svg | ||
|
||
.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/dac2/example.svg |
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
DAC2 Unit | ||
========= | ||
|
||
.. include:: ../refs/unit.dac2.ref | ||
|
||
The `Dac2` class interfaces with a GP8413 15-bit Digital to Analog Converter (DAC), capable of converting digital signals into two channels of analog voltage output, ranging from 0-5V and 0-10V. | ||
|
||
Support the following products: | ||
|
||
|
||
|DAC2Unit| | ||
|
||
|DAC2Hat| | ||
|
||
|
||
|
||
Micropython Example:: | ||
|
||
import os, sys, io | ||
import M5 | ||
from M5 import * | ||
import time | ||
from unit import DAC2Unit | ||
|
||
i2c = I2C(0, scl=Pin(1), sda=Pin(2), freq=400000) | ||
dac2_0 = DAC2Unit(i2c0, 0x59) | ||
dac2_0.setDACOutputVoltageRange(dac2_0.RANGE_10V) | ||
dac2_0.setVoltage(7.5, channel=dac2_0.CHANNEL_BOTH) | ||
|
||
|
||
UIFLOW2 Example: | ||
|
||
|example.svg| | ||
|
||
|
||
.. only:: builder_html | ||
|
||
|
||
class DAC2Unit | ||
-------------- | ||
|
||
Constructors | ||
--------------------------- | ||
|
||
.. class:: DAC2Unit(i2c0, addr) | ||
|
||
Create an DAC2Unit object. | ||
|
||
- ``I2C0`` is I2C Port. | ||
- ``addr`` I2C address of the DAC (default is `0x59`).. | ||
|
||
UIFLOW2: | ||
|
||
|init.svg| | ||
|
||
|
||
Methods | ||
---------------------- | ||
|
||
.. method:: MiniScaleUnit.setDACOutputVoltageRange(_range) | ||
|
||
|
||
Sets the output voltage range of the DAC. | ||
|
||
- ``_range`` The DAC output voltage range, either `DAC2Unit.RANGE_5V` or `DAC2Unit.RANGE_10V`.. | ||
|
||
UIFLOW2: | ||
|
||
|setDACOutputVoltageRange.svg| | ||
|
||
.. method:: MiniScaleUnit.setVoltage(voltage, channel=Dac2.CHANNEL_BOTH) | ||
|
||
|
||
Sets the output voltage of the DAC. | ||
|
||
- ``voltage`` Desired output voltage from 0.0 to range maximum (5V or 10V). | ||
- ``channel`` The DAC channel to set. Options are `Dac2.CHANNEL_0`, `Dac2.CHANNEL_1`, or `Dac2.CHANNEL_BOTH`. | ||
|
||
UIFLOW2: | ||
|
||
|setVoltage.svg| | ||
|
||
|
||
.. method:: MiniScaleUnit.setVoltageBoth(voltage0, voltage1) | ||
|
||
|
||
Sets the output voltage for both channels. | ||
|
||
- ``voltage0`` Desired output voltage from 0.0 to range maximum (5V or 10V). | ||
- ``voltage1`` Desired output voltage from 0.0 to range maximum (5V or 10V). | ||
|
||
UIFLOW2: | ||
|
||
|setVoltageBoth.svg| |
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 |
---|---|---|
|
@@ -20,3 +20,4 @@ Unit | |
op90.rst | ||
op180.rst | ||
miniscale.rst | ||
dac2.rst |
Oops, something went wrong.