Skip to content

Commit f6521d8

Browse files
committed
docs/esp32: Add quickref and full docs for esp32.SigmaDelta class.
1 parent a1f3f4e commit f6521d8

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

docs/esp32/general.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ For your convenience, some of technical specifications are provided below:
5353
* ADC: 12-bit SAR ADC up to 18 channels
5454
* DAC: 2 8-bit DACs
5555
* RMT: 8 channels allowing accurate pulse transmit/receive
56+
* SigmaDelta: 8 channels of hardware sigma-delta modulated output
5657
* Programming: using BootROM bootloader from UART - due to external FlashROM
5758
and always-available BootROM bootloader, the ESP32 is not brickable
5859

docs/esp32/quickref.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,20 @@ The RMT is ESP32-specific and allows generation of accurate digital pulses with
457457
# The channel resolution is 100ns (1/(source_freq/clock_div)).
458458
r.write_pulses((1, 20, 2, 40), start=0) # Send 0 for 100ns, 1 for 2000ns, 0 for 200ns, 1 for 4000ns
459459

460+
Sigma-Delta
461+
-----------
462+
463+
An ESP32-specific peripheral for generating hardware sigma-delta modulated output
464+
on any GPIO. See :ref:`esp32.SigmaDelta <esp32.SigmaDelta>` for details. Usage is::
465+
466+
import esp32
467+
from machine import Pin
468+
469+
sd = esp32.SigmaDelta(0, pin=Pin(4), duty=0, prescale=80)
470+
sd.duty(20) # -128 to 127
471+
sd.prescale(160) # 0 to 255
472+
sd.deinit()
473+
460474
OneWire driver
461475
--------------
462476

docs/library/esp32.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,45 @@ For more details see Espressif's `ESP-IDF RMT documentation.
242242
before starting the next stream.
243243

244244

245+
Sigma-Delta
246+
-----------
247+
248+
ESP32 has a second-order sigma-delta modulation module. Each of the eight
249+
independent channels (0-7) are capable of outputting a binary hardware generated
250+
signal with the sigma-delta modulation::
251+
252+
import esp32
253+
from machine import Pin
254+
255+
sd = esp32.SigmaDelta(3, pin=Pin(4), duty=0, prescale=80)
256+
sd # SigmaDelta(channel=3, pin=4, duty=0, prescale=80)
257+
sd.duty(90)
258+
sd.prescale(8)
259+
sd.deinit()
260+
261+
For more details see Espressif's `ESP-IDF Sigma-delta documentation.
262+
<https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/sigmadelta.html>`_.
263+
264+
.. class:: SigmaDelta(channel, \*, pin=None, duty=0, prescale=80)
265+
266+
This class provides access to the Sigma-Delta hardware signal generator.
267+
268+
.. method:: SigmaDelta.duty(duty)
269+
270+
Set the duty of the output signal in the range -128 to 127. A zero value will
271+
result in the output signal's duty of around 50%. Recommended range is -90 to 90.
272+
273+
.. method:: SigmaDelta.prescale(prescale)
274+
275+
Set the sigma-delta channel's clock pre-scale value. The source clock is
276+
APP_CLK, 80MHz. The clock frequency of the sigma-delta channel is
277+
``APP_CLK / pre_scale``.
278+
279+
.. method:: SigmaDelta.deinit()
280+
281+
Disconnect the signal generator from the pin.
282+
283+
245284
Ultra-Low-Power co-processor
246285
----------------------------
247286

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy