Skip to content

Commit 4e40899

Browse files
committed
docs/esp32: Add quickref and full docs for esp32.SigmaDelta class.
1 parent c85d2ba commit 4e40899

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
@@ -379,6 +379,20 @@ The RMT is ESP32-specific and allows generation of accurate digital pulses with
379379
# The channel resolution is 100ns (1/(source_freq/clock_div)).
380380
r.write_pulses((1, 20, 2, 40), start=0) # Send 0 for 100ns, 1 for 2000ns, 0 for 200ns, 1 for 4000ns
381381

382+
Sigma-Delta
383+
-----------
384+
385+
An ESP32-specific peripheral for generating hardware sigma-delta modulated output
386+
on any GPIO. See :ref:`esp32.SigmaDelta <esp32.SigmaDelta>` for details. Usage is::
387+
388+
import esp32
389+
from machine import Pin
390+
391+
sd = esp32.SigmaDelta(0, pin=Pin(4), duty=0, prescale=80)
392+
sd.duty(20) # -128 to 127
393+
sd.prescale(160) # 0 to 255
394+
sd.deinit()
395+
382396
OneWire driver
383397
--------------
384398

docs/library/esp32.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,45 @@ For more details see Espressif's `ESP-IDF RMT documentation.
173173
stream starts at 0 or 1.
174174

175175

176+
Sigma-Delta
177+
-----------
178+
179+
ESP32 has a second-order sigma-delta modulation module. Each of the eight
180+
independent channels (0-7) are capable of outputting a binary hardware generated
181+
signal with the sigma-delta modulation::
182+
183+
import esp32
184+
from machine import Pin
185+
186+
sd = esp32.SigmaDelta(3, pin=Pin(4), duty=0, prescale=80)
187+
sd # SigmaDelta(channel=3, pin=4, duty=0, prescale=80)
188+
sd.duty(90)
189+
sd.prescale(8)
190+
sd.deinit()
191+
192+
For more details see Espressif's `ESP-IDF Sigma-delta documentation.
193+
<https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/sigmadelta.html>`_.
194+
195+
.. class:: SigmaDelta(channel, \*, pin=None, duty=0, prescale=80)
196+
197+
This class provides access to the Sigma-Delta hardware signal generator.
198+
199+
.. method:: SigmaDelta.duty(duty)
200+
201+
Set the duty of the output signal in the range -128 to 127. A zero value will
202+
result in the output signal's duty of around 50%. Recommended range is -90 to 90.
203+
204+
.. method:: SigmaDelta.prescale(prescale)
205+
206+
Set the sigma-delta channel's clock pre-scale value. The source clock is
207+
APP_CLK, 80MHz. The clock frequency of the sigma-delta channel is
208+
``APP_CLK / pre_scale``.
209+
210+
.. method:: SigmaDelta.deinit()
211+
212+
Disconnect the signal generator from the pin.
213+
214+
176215
Ultra-Low-Power co-processor
177216
----------------------------
178217

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