Skip to content

Raspberry

Functions

Has Gpio

Checks if the system has GPIO capabilities.

Return Type: Boolean

Signatures:

bool has_gpio()

Raspi Cleanup

This function should be called when you are finished using the GPIO library. It sets all pin modes to INPUT and values to LOW.

Signatures:

void raspi_cleanup()

Raspi Get Mode

This function retrieves the mode of the specified pin.

Parameters:

NameTypeDescription
pinPinsThe pin to get the mode for.

Return Type: Pin Modes

Signatures:

pin_modes raspi_get_mode(pins pin)

Raspi Init

This function initializes the GPIO library for use. It should be called before any other GPIO functions.

Signatures:

void raspi_init()

Raspi Read

This function reads the value from the specified pin.

Parameters:

NameTypeDescription
pinPinsThe pin to read the value from.

Return Type: Pin Values

Signatures:

pin_values raspi_read(pins pin)

Raspi Set Mode

This function sets the mode of the specified pin to the specified mode.

Parameters:

NameTypeDescription
pinPinsThe pin to set the mode for.
modePin ModesThe mode to set for the pin.

Signatures:

void raspi_set_mode(pins pin, pin_modes mode)

Raspi Set Pull Up Down

This function sets the pull-up/down mode for the specified pin.

Parameters:

NameTypeDescription
pinPinsThe pin to set the pull up/down mode for.
pudPull Up DownThe pull up/down mode to set for the pin.

Signatures:

void raspi_set_pull_up_down(pins pin, pull_up_down pud)

Raspi Set Pwm Dutycycle

This function sets the PWM duty cycle for the specified pin.

Parameters:

NameTypeDescription
pinPinsThe pin to set the PWM duty cycle for.
dutycycleIntegerThe PWM duty cycle to set for the pin.

Signatures:

void raspi_set_pwm_dutycycle(pins pin, int dutycycle)

Raspi Set Pwm Frequency

This function sets the PWM frequency for the specified pin.

Parameters:

NameTypeDescription
pinPinsThe pin to set the PWM frequency for.
frequencyIntegerThe PWM frequency to set for the pin.

Signatures:

void raspi_set_pwm_frequency(pins pin, int frequency)

Raspi Set Pwm Range

This function sets the PWM range for the specified pin.

Parameters:

NameTypeDescription
pinPinsThe pin to set the PWM range for.
rangeIntegerThe PWM range to set for the pin.

Signatures:

void raspi_set_pwm_range(pins pin, int range)

Raspi Write

This function writes the specified value to the specified pin.

Parameters:

NameTypeDescription
pinPinsThe pin to write the value to.
valuePin ValuesThe value to write to the pin.

Signatures:

void raspi_write(pins pin, pin_values value)