librpipGpioPinPulse

uint32_t librpipGpioPinPulse(uint32_t pin, uint32_t length);

Description

Sends a pulse of length length µs down a GPIO pin. The phase of the pulse depends not he pin value when called. A GPIO pin at 0 will send a 0 → 1 → 0 pulse. A GPIO pin at 1 will send a 1 → 0 → 1 pulse.

Parameters

  • uint32_t pin
    The pin number to pulse. The pin should be valid and configured for output.
  • uint32_t length
    The length of the pulse in microseconds. Note that length is unlikely to be perfectly accurate as sleeping in user spaceis really just an opportunity for the CPU to do something else.

Returns

0 on failure, 1 on success.

Example

Setup GPIO pin 16 for output, and then set to low and send a 1ms pulse :

uint32_t feature_set;
feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0);
if(feature_set & LIBRPIP_FEATURE_GPIO) { 
        librpipGpioConfigPinWrite(16, LIBRPIP_GPIO_FLAG_FNC_OUT);
        librpipGpioPinWrite(16, 0);
        librpipGpioPinPulse(16, 1000);
} 
librpipClose();