Module rust_pigpio::pigpio [] [src]

Constants

ALT0
ALT1
ALT2
ALT3
ALT4
ALT5
PI_INPUT

Modes

PI_OFF
PI_ON

Values

PI_OUTPUT

Functions

delay

Delays for at least the number of microseconds specified by microseconds.

get_mode

Gets the GPIO mode.

get_pwm_duty_cycle

Returns the PWM dutycycle setting for the GPIO.

get_pwm_frequency

Returns the frequency in hertz used for the GPIO.

get_pwm_range

Returns the dutycycle range used for the GPIO. If a hardware clock or hardware PWM is active on the GPIO the reported range will be 1000000 (1M).

get_pwm_real_range

Returns the real range used for the GPIO. If a hardware clock is active on the GPIO the reported real range will be 1000000 (1M). If hardware PWM is active on the GPIO the reported real range will be approximately 250M divided by the set PWM frequency.

get_servo_pulse_width

Returns the servo pulsewidth setting for the GPIO.

hardware_clock

Starts a hardware clock on a GPIO at the specified frequency. Frequencies above 30MHz are unlikely to work.

hardware_pwm

Starts hardware PWM on a GPIO at the specified frequency and dutycycle. Frequencies above 30MHz are unlikely to work.

initialize

Initialises the library. gpioInitialise must be called before using the other library functions with some exceptions not yet wrapped.

pwm

Starts PWM on the GPIO, dutycycle between 0 (off) and range (fully on). Range defaults to 255.

read

Reads the GPIO level, on or off.

servo

Starts servo pulses on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise). The range supported by servos varies and should probably be determined by experiment. A value of 1500 should always be safe and represents the mid-point of rotation. You can DAMAGE a servo if you command it to move beyond its limits. The following causes an on pulse of 1500 microseconds duration to be transmitted on GPIO 17 at a rate of 50 times per second. This will command a servo connected to GPIO 17 to rotate to its mid-point.

set_mode

Sets the GPIO mode, typically input or output.

set_pwm_frequency

Sets the frequency in hertz to be used for the GPIO.

set_pwm_range

Selects the dutycycle range to be used for the GPIO. Subsequent calls to pwm will use a dutycycle between 0 (off) and range (fully on).

terminate

Terminates the library. Call before program exit. This function resets the used DMA channels, releases memory, and terminates any running threads.

write

Sets the GPIO level, on or off. If PWM or servo pulses are active on the GPIO they are switched off.

Type Definitions

GpioResponse
GpioResult

Responses