librpipServoConfigRead

uint32_t librpipServoConfigRead(uint32_t id, uint32_t* range, uint32_t* pmin, uint32_t* pmax);

Description

Gets the current servo configuration for a PWM.

Parameters

  • uint32_t id
    The PWM device to use. The PWM device needs to have been detected during the librpipInit().
  • uint32_t* range
    A pointer to a uint32_t that will hold the range.
  • uint32_t* pmin
    A pointer to a uint32_t that will hold the minimum pulse length.
  • uint32_t* pmax
    A pointer to a uint32_t that will hold the maximum pulse length.

Returns

0 on failure, 1 on success.

Example

get the current servo config on PWM0:

uint32_t feature_set, range, pmin, pmax;
feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0);
if(feature_set & LIBRPIP_FEATURE_PWM0) { 
        librpipServoConfigRead(0, &range, &pmin, &pmax);
}
librpipClose();