summaryrefslogtreecommitdiff
path: root/docs/samd/quickref.rst
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-12-02 21:08:46 +0100
committerDamien George <damien@micropython.org>2022-12-14 12:48:24 +1100
commite69313f89c607976da2a7e06ad49b8db9fe1caf9 (patch)
treeeb2fec3ad51be6ed4c7bf323cff760a7edc3a08f /docs/samd/quickref.rst
parenta73dcb3d228008a6225fd80627d3b9566470c687 (diff)
samd: Add a vref=num option to the ADC and DAC constructor.
ADC: The argument of vref=num is an integer. Values for num are: SAMD21: 0 INT1V 1.0V voltage reference 1 INTVCC0 1/1.48 Analog voltage supply 2 INTVCC1 1/2 Analog voltage supply (only for VDDANA > 2.0V) 3 VREFA External reference 4 VREFB External reference SAMD51: 0 INTREF internal bandgap reference 1 INTVCC1 Analog voltage supply 2 INTVCC0 1/2 Analog voltage supply (only for VDDANA > 2.0v) 3 AREFA External reference A 4 AREFB External reference B 5 AREFC External reference C (ADC1 only) DAC: The argument of vref=num is an integer. Suitable values: SAMD21: 0 INT1V Internal voltage reference 1 VDDANA Analog voltage supply 2 VREFA External reference SAMD51: 0 INTREF Internal bandgap reference 1 VDDANA Analog voltage supply 2 VREFAU Unbuffered external voltage reference (not buffered in DAC) 4 VREFAB Buffered external voltage reference (buffered in DAC).
Diffstat (limited to 'docs/samd/quickref.rst')
-rw-r--r--docs/samd/quickref.rst58
1 files changed, 53 insertions, 5 deletions
diff --git a/docs/samd/quickref.rst b/docs/samd/quickref.rst
index 5e8298d1b..aa3d563f7 100644
--- a/docs/samd/quickref.rst
+++ b/docs/samd/quickref.rst
@@ -254,16 +254,38 @@ an external ADC.
ADC Constructor
```````````````
-.. class:: ADC(dest, *, average=16)
+.. class:: ADC(dest, *, average=16, vref=n)
:noindex:
- Construct and return a new ADC object using the following parameters:
+Construct and return a new ADC object using the following parameters:
- - *dest* is the Pin object on which the ADC is output.
+ - *dest* is the Pin object on which the ADC is output.
- Keyword arguments:
+Keyword arguments:
+
+ - *average* is used to reduce the noise. With a value of 16 the LSB noise is about 1 digit.
+ - *vref* sets the reference voltage for the ADC.
+
+ The default setting is for 3.3V. Other values are:
- - *average* is used to reduce the noise. With a value of 16 the LSB noise is about 1 digit.
+ ==== ============================== ===============================
+ vref SAMD21 SAMD51
+ ==== ============================== ===============================
+ 0 1.0V voltage reference internal bandgap reference (1V)
+ 1 1/1.48 Analogue voltage supply Analogue voltage supply
+ 2 1/2 Analogue voltage supply 1/2 Analogue voltage supply
+ 3 External reference A External reference A
+ 4 External reference B External reference B
+ 5 - External reference C
+ ==== ============================== ===============================
+
+ADC Methods
+```````````
+
+.. method:: read_u16()
+
+Read a single ADC value as unsigned 16 bit quantity. The voltage range is defined
+by the vref option of the constructor, the resolutions by the bits option.
DAC (digital to analog conversion)
----------------------------------
@@ -280,6 +302,32 @@ The DAC class provides a fast digital to analog conversion. Usage example::
The resolution of the DAC is 12 bit for SAMD51 and 10 bit for SAMD21. SAMD21 devices
have 1 DAC channel at GPIO PA02, SAMD51 devices have 2 DAC channels at GPIO PA02 and PA05.
+DAC Constructor
+```````````````
+
+.. class:: DAC(id, *, vref=3)
+ :noindex:
+
+The vref arguments defines the output voltage range, the callback option is used for
+dac_timed(). Suitable values for vref are:
+
+==== ============================ ================================
+vref SAMD21 SAMD51
+==== ============================ ================================
+0 Internal voltage reference Internal bandgap reference (~1V)
+1 Analogue voltage supply Analogue voltage supply
+2 External reference Unbuffered external reference
+3 - Buffered external reference
+==== ============================ ================================
+
+DAC Methods
+```````````
+
+.. method:: write(value)
+
+Write a single value to the selected DAC output. The value range is 0-1023 for
+SAMD21 and 0-4095 for SAMD51. The voltage range depends on the vref setting.
+
Software SPI bus
----------------