Skip to content

Latest commit

 

History

History
66 lines (50 loc) · 2 KB

libretiny_pwm.rst

File metadata and controls

66 lines (50 loc) · 2 KB

LibreTiny PWM Output

The LibreTiny PWM platform allows you to use a hardware PWM on BK72xx and RTL87xx chips. Refer to LibreTiny/Boards to find your board and which PWM pins it supports.

# Example configuration entry
output:
  - platform: libretiny_pwm
    pin: P8
    frequency: 1000 Hz
    id: pwm_output

# Example usage in a light
light:
  - platform: monochromatic
    output: pwm_output
    name: "Kitchen Light"

Configuration variables:

  • pin (Required, Pin Schema <config-pin_schema>): The pin to use PWM on.
  • id (Required, config-id): The id to use for this output component.
  • frequency (Optional, frequency): The frequency to run the PWM with. Lower frequencies have more visual artifacts, but can represent much more colors. Defaults to 1000 Hz.
  • All other options from Output <config-output>.

output.libretiny_pwm.set_frequency Action

This Action <config-action> allows you to manually change the frequency of a LibreTiny PWM channel at runtime. Use cases include controlling a passive buzzer (for pitch control).

on_...:
  - output.libretiny_pwm.set_frequency:
      id: pwm_output
      frequency: 100Hz

Configuration variables:

  • id (Required, config-id): The ID of the PWM output to change.
  • frequency (Required, templatable <config-templatable>, float): The frequency to set in hertz.

See Also

  • /components/libretiny
  • /components/output/index
  • /components/light/monochromatic
  • /components/fan/speed
  • /components/power_supply
  • libretiny_pwm/libretiny_pwm.h
  • Edit