librpipGpioPinToggle

uint32_t librpipGpioPinToggle(uint32_t pin);

Description

Reverses the output of a pin. If it was low it will go high. if it was high it will go low.

Parameters

  • uint32_t pin
    The pin number to toggle. The pin should be valid and configured for output.

Returns

0 on failure, 1 on success.

Example

Setup GPIO pin 16 for output, set to high (1) and then toggle:

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, 1);
        librpipGpioPinToggle(16);
}
librpipClose();