librpipPwmConfigWrite
uint32_t librpipPwmConfigWrite(uint32_t id, uint32_t period, uint32_t duty_cycle, uint32_t flags);/pre>
Description
Configures a PWM.
Parameters
- uint32_t id
The PWM device to configure. The PWM device needs to have been detected during the librpipInit(). - uint32_t period
The period in nano seconds (10 -9 s ). Allowed values are 109ns to 2,000,000,000ns (2s) - uint32_t duty_cycle
The duty cycle is the length the pulse is on in nano seconds. Allowed values are 0 to period. - uint32_t flags
One of the LIBRPIP_PWM_FLAGS_* constants or zero for none.
Returns
0 on failure, 1 on success.
Example
Sets PWM0 with 100µs period, 25µs duty cycle (25%) normal polarity:
uint32_t feature_set; feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0); if(feature_set & LIBRPIP_FEATURE_PWM0) { librpipPwmConfigWrite(0, 100000, 25000, LIBRPIP_PWM_FLAG_POLARITY_NORMAL); } librpipClose();