PWM

PWM(etp)

Methods:

Name Description
ctrl

Control PWM pin.

get_info

Query PWM information.

init

Enable/Disable PWM pins.

ctrl

ctrl(pin: str, duty_cycle: float, freq: int = 1000) -> int

Control PWM pin.

Parameters:
  • pin (str) –

    PWM pin identifier.

  • duty_cycle (float) –

    Duty cycle of the PWM signal.

  • freq (int, default: 1000 ) –

    Frequency of the PWM signal in Hz.

Returns:
  • int

    Control status.

get_info

get_info() -> dict

Query PWM information.

Returns:
  • dict

    Dictionary containing PWM information of the following format:

    Key Value Type Description
    num_pwm int Number of PWMs
    max_freq int Maximum frequency of PWM
    port_count int Number of PWM ports
    ports list List of PWM ports and their corresponding pins

init

init(pin_list: dict) -> int

Enable/Disable PWM pins.

Parameters:
  • pin_list (dict) –

    Dictionary containing PWM pins and their enable status.

Returns:
  • int

    Initialization status.