docs/modules/sigma-delta.md
| Since | Origin / Contributor | Maintainer | Source |
|---|---|---|---|
| 2016-02-20 | Espressif example, Arnim Läuger | Arnim Läuger | sigma_delta.c |
This module provides access to the sigma-delta component. It's a hardware signal generator that can be routed to any of the GPIOs except pin 0.
The signal generation is controlled by the setprescale() and settarget() functions.
0 < target <= 128
t<sub>high</sub> = (prescale + 1) / 80 µs
t<sub>period</sub> = t<sub>high</sub> * 256 / target
128 < target < 256
t<sub>low</sub> = (prescale + 1) / 80 µs
t<sub>period</sub> = t<sub>low</sub> * 256 / (256 - target)
target = 0
signal stopped at low
Fixed frequency PWM at ~312.5 kHz is availble with the setpwmduty() function.
Stops signal generation and reenables GPIO functionality at the specified pin.
sigma_delta.close(pin)
pin 1~12, IO index
nil
Sets the prescale value.
`sigma_delta.setprescale(value)
value prescale 1 to 255
nil
Operate the sigma-delta module in PWM-like mode with fixed base frequency.
sigma_delta.setpwmduty(ratio)
ratio 0...255 for duty cycle 0...100%, 0 stops the signal at low
nil
-- attach generator to pin 2
sigma_delta.setup(2)
-- set 50% duty cycle ratio (and implicitly start signal)
sigma_delta.setpwmduty(128)
-- stop
sigma_delta.setpwmduty(0)
-- resume with ~99.6% ratio
sigma_delta.setpwmduty(255)
-- stop and detach generator from pin 2
sigma_delta.close(2)
Sets the target value.
sigma_delta.settarget(value)
value target 0 to 255
nil
Stops the signal generator and routes it to the specified pin.
sigma_delta.setup(pin)
pin 1~12, IO index
nil