diff options
Diffstat (limited to 'docs/samd/quickref.rst')
| -rw-r--r-- | docs/samd/quickref.rst | 58 |
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 ---------------- |
