eth32_set_pwm_channel

int eth32_set_pwm_channel(eth32 handle, int channel, int state);

Summary

This function configures the state of the specified PWM channel. When a channel is disabled, the I/O pin will function as a normal digital I/O pin. When the channel is enabled, that I/O pin will be overridden and the pin will become the PWM output. However, note that the pin must be put into output mode using the eth32_set_direction or eth32_set_direction_bit functions.

Parameters

  • handle - The value returned by the eth32_open function.

  • channel - Specifies the PWM channel number whose state should be set (0 or 1).

  • state - Specifies the new state of the PWM channel. This may be:

    • PWM_CHANNEL_DISABLED - The PWM pin will function as a normal digital I/O pin.

    • PWM_CHANNEL_NORMAL - The PWM pin will function as a PWM output. It will be high for the time specified by the duty period and low for the rest of the PWM base period.

    • PWM_CHANNEL_INVERTED - The PWM pin will function as a PWM output. It will be low for the time specified by the duty period and high for the rest of the PWM base period.

Return Value

This function returns zero on success and a negative error code on failure. Please see the Error Codes section for possible error codes.

See Also

eth32_get_pwm_channel, eth32_set_pwm_base_period, eth32_set_pwm_clock_state, eth32_set_pwm_duty_period,