|
sub_pwm_set |
Top Previous Next |
| Got to SUB-20 page |
|
Synopsis int sub_pwm_set( sub_handle hndl, int pwm_n, int duty )
Configure specific PWM output. Parameters
Duty cycle
Effective duty cycle in percent can be calculated as
DUTY% = duty/limit * 100%
Duty cycle resolution in bits depends on limit. It can be in range of 1 bit for limit=2 up to 8 bit for limit=255 Return value On success function returns 0. Otherwise error code. Example
/* Set PWM resolution=10ms, limit=100, frequency=1Hz */ sub_pwm_config( hndl, 10000, 100 );
/* Set PWM_0 pin (GPIO24) to output state */ sub_gpio_config( hndl, 0x01000000, &config, 0x01000000 );
/* Output 50% duty cycle on PWM_0 pin */ sub_pwm_set( hndl, 0, 50 ); See also Compatibility
|