Pwmx.Paths (Pwmx v0.1.0)

Copy Markdown View Source

Path helpers for the Sysfs backend.

Summary

Functions

The base sysfs path for PWM devices

Path for a specific PWM chip

Path to set/read the duty cycle of an output

Path to enable or disable an output

Path to export an output

Path giving the number of PWM outputs in a specific chip

Path for a specific PWM output in a specific chip

Path to set/read the period of an output

Path to set/read the polarity of an output

Path to unexport an output

Functions

base_path()

@spec base_path() :: binary()

The base sysfs path for PWM devices

iex> Pwmx.Paths.base_path()
"/sys/class/pwm"

chip_path(chip)

@spec chip_path(binary()) :: binary()

Path for a specific PWM chip

iex> Pwmx.Paths.chip_path("virtualchip0")
"/sys/class/pwm/virtualchip0"

duty_cycle_path(chip, output)

@spec duty_cycle_path(binary(), binary() | integer()) :: binary()

Path to set/read the duty cycle of an output

iex> Pwmx.Paths.duty_cycle_path("virtualchip0", 1)
"/sys/class/pwm/virtualchip0/pwm1/duty_cycle"

enable_path(chip, output)

@spec enable_path(binary(), binary() | integer()) :: binary()

Path to enable or disable an output

iex> Pwmx.Paths.enable_path("virtualchip0", 1)
"/sys/class/pwm/virtualchip0/pwm1/enable"

export_path(chip)

@spec export_path(binary()) :: binary()

Path to export an output

iex> Pwmx.Paths.export_path("virtualchip0")
"/sys/class/pwm/virtualchip0/export"

npwm_path(chip)

@spec npwm_path(binary()) :: binary()

Path giving the number of PWM outputs in a specific chip

iex> Pwmx.Paths.npwm_path("virtualchip0")
"/sys/class/pwm/virtualchip0/npwm"

output_path(chip, output)

@spec output_path(binary(), binary() | integer()) :: binary()

Path for a specific PWM output in a specific chip

iex> Pwmx.Paths.output_path("virtualchip0", 1)
"/sys/class/pwm/virtualchip0/pwm1"

period_path(chip, output)

@spec period_path(binary(), binary() | integer()) :: binary()

Path to set/read the period of an output

iex> Pwmx.Paths.period_path("virtualchip0", 1)
"/sys/class/pwm/virtualchip0/pwm1/period"

polarity_path(chip, output)

@spec polarity_path(binary(), binary() | integer()) :: binary()

Path to set/read the polarity of an output

iex> Pwmx.Paths.polarity_path("virtualchip0", 1)
"/sys/class/pwm/virtualchip0/pwm1/polarity"

unexport_path(chip)

@spec unexport_path(binary()) :: binary()

Path to unexport an output

iex> Pwmx.Paths.unexport_path("virtualchip0")
"/sys/class/pwm/virtualchip0/unexport"