librpipPwmStatusRead

uint32_t librpipPwmStatusRead(uint32_t id, uint32_t* status);

Description

Reads the current status of a PWM.

Parameters

  • uint32_t id
    The PWM device to read. The PWM device needs to have been detected during the librpipInit().
  • uint32_t* status
    A pointer to a uint32_t which will hold the current status. Value will be one of LIBRPIP_PWM_STATUS_*

Returns

0 on failure, 1 on success.

Example

See if PWM0 is currently enabled:

uint32_t feature_set, status;
feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0);
if(feature_set & LIBRPIP_FEATURE_PWM0) { 
        librpipPwmStatusRead(0, &status);
        if(status==LIBRPIP_PWM_STATUS_ON) 
                fprintf(stdout,"PWM0 is on!");
}
librpipClose();