eth32_get_pwm_parameters

int eth32_get_pwm_parameters(eth32 handle, int channel, int *state, float *freq, float *duty);

Summary

This function is provided for your convenience in working with all of the various PWM settings. It internally calls several of the other API functions to determine the current state of the specified PWM channel and calculate its configuration in more familiar terms (hertz and percentage). This function calculates the frequency and duty cycle of the channel from the PWM base period and the channel's duty period.

Parameters

  • handle - The value returned by the eth32_open function.

  • channel - Specifies the PWM channel number (0 or 1).

  • state - Pointer to a variable which will receive the current state of the PWM channel. This may be PWM_CHANNEL_DISABLED, PWM_CHANNEL_NORMAL, or PWM_CHANNEL_INVERTED.

  • freq - Pointer to a variable which will receive the current frequency of the PWM channels in Hertz.

  • duty - Pointer to a variable which will receive the duty cycle of the PWM channel. This may range from 0.00 to 1.00, representing the duty cycle as a percentage.

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_set_pwm_parameters