librpipGpioPinEventWait
uint32_t librpipGpioPinEventWait(uint32_t pin, uint32_t timeout);
Description
Waits for a preconfigured event to occur.
Parameters
- uint32_t pin
The pin number to check. The pin should be valid. - uint32_t timeout
The amount of time to wait in µs (10 -6s).
Returns
0 on failure, 1 on success. The event not occurring in the timeout period is considered a failure.
Example
Setup GPIO pin 16 for rise event and wait to see if it occurs in 35ms :
uint32_t feature_set, triggered; feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0); if(feature_set & LIBRPIP_FEATURE_GPIO) { librpipGpioConfigPinWrite(16, LIBRPIP_GPIO_FLAG_FNC_IN | LIBRPIP_GPIO_FLAG_ED_RISE); if(librpipGpioPinEventWait(16, 35000)) {//pin 16 rose} } librpipClose();