nodemcu-firmware/docs/modules/sigma-delta.md

1.8 KiB

Sigma-delta Module

Since Origin / Contributor Maintainer Source
2017-01-13 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 output GPIOs.

The signal generation is controlled by the setprescale() and setduty() functions.

sigma_delta.close()

Reenables GPIO functionality at the related pin.

Syntax

sigma_delta.close(channel)

Parameters

  • channel 0~7, sigma-delta channel index

Returns

nil

sigma_delta.setprescale()

Sets the prescale value.

Syntax

sigma_delta.setprescale(channel, value)

Parameters

  • channel 0~7, sigma-delta channel index
  • value prescale 1 to 255

Returns

nil

See also

sigma_delta.setduty()

sigma_delta.setduty()

Sets the duty value.

Syntax

sigma_delta.setduty(channel, value)

Parameters

  • channel 0~7, sigma-delta channel index
  • value duty -128 to 127

Returns

nil

See also

sigma_delta.setprescale()

sigma_delta.setup()

Routes the sigma-delta channel to the specified pin. Target prescale and duty values should be applied prior to enabling the output with this command.

Syntax

sigma_delta.setup(channel, pin)

Parameters

  • channel 0~7, sigma-delta channel index
  • pin IO index, see GPIO Overview

Returns

nil

Example

sigma_delta.setprescale(0, 128)
sigma_delta.setduty(0, 0)
sigma_delta.setup(0, 4)