QNX rpi_gpio
APIs
The rpi_gpio
Python module for QNX closely resembles the RPI.GPIO
module from Linux. However, since the modules aren't identical, you can find the differences listed below.
API Comparison Table
Identifier | Linux RPI.GPIO |
QNX rpi_gpio |
About | Notes | |
---|---|---|---|---|---|
Constants | BCM | ✅ Available | ✅ Available | Broadcom SOC channel numbering | |
BOARD | ✅ Available | ✅ Available | Physical board pin numbering | ||
HIGH | ✅ Available | ✅ Available | High state | ||
LOW | ✅ Available | ✅ Available | Low state | ||
IN | ✅ Available | ✅ Available | Input mode | ||
OUT | ✅ Available | ✅ Available | Output mode | ||
PUD_IP | ✅ Available | ✅ Available | Pull-up resistor | ||
PUD_DOWN | ✅ Available | ✅ Available | Pull-down resistor | ||
PUD_OFF | ✅ Available | ✅ Available | No pull-up or pull-down resistor | ||
RISING | ✅ Available | ✅ Available | Rising edge events | ||
FALLING | ✅ Available | ✅ Available | Falling edge events | ||
BOTH | ✅ Available | ✅ Available | Both edge events | ||
RPI_INFO | ✅ Available | ❌ Not available | Information about the Raspberry Pi | ||
RPI_REVISION | ✅ Available | ❌ Not available | Raspberry Pi board revision | ||
VERSION | ✅ Available | ❌ Not available | Version of the Python module | ||
Basic functions | setmode() | ✅ Available | ✅ Available | Set up numbering mode to use for channels. | |
getmode() | ✅ Available | ❌ Not available | Get numbering mode used for channel numbers (BCM or BOARD). | ||
setup() | ✅ Available | ✅ Available | Configure a GPIO pin as input/output. |
The setup() function in the Linux |
|
input() | ✅ Available | ✅ Available | Read the status of a GPIO input. | ||
output() | ✅ Available | ✅ Available | Turn a GPIO output on or off. |
The output() function in the Linux |
|
cleanup() | ✅ Available | ✅ Available | Restore all used GPIOs to their original state. | The cleanup() function in the Linux
RPI.GPIO has the
ability to clean up individual channels or a set of multiple channels.The
cleanup() function in the QNX |
|
gpio_function() | ✅ Available | ❌ Not available | Return the current GPIO function (IN, OUT, PWM). | ||
setwarnings() | ✅ Available | ❌ Not available | Enable or disable warning messages. | ||
Event handling | add_event_detect() | ✅ Available | ✅ Available | Enable edge detection events for a particular GPIO channel. | |
remove_event_detect() | ✅ Available | ❌ Not available | Remove event detection. | ||
event_detected() | ✅ Available | ❌ Not available | Check if an event was detected. | The event_detected() function in the Raspian RPI.GPIO has the
ability to set bouncetime to handle signal debouncing, but the QNX rpi_gpio module doesn't. |
|
add_event_callback() | ✅ Available | ❌ Not available | Add callback for events. | ||
wait_for_edge() | ✅ Available | ❌ Not available | Block until an edge is detected. | ||
PWM support | start() | ✅ Available | ✅ Available | Start PWM. | The QNX rpi_gpio module has hardware and softare PWM, whereas the
Linux RPI.GPIO module only has software PWM. The QNX
rpi_gpio module also has different PWM modes; the MS mode
and PWM mode. For more information on using PWM, refer to the "[PWM](Using-GPIO-with-Python#pwm)" section. |
ChangeDutyCycle() | ✅ Available | ✅ Available | Change the duty cycle (percentage based). | ||
ChangeDutyCycleAbs() | ❌ Not available | ✅ Available | Change the duty cycle (absolute value based). | ||
ChangeFrequency() | ✅ Available | ✅ Available | Write bytes to and then read from the SPI interface. | ||
stop() | ✅ Available | ✅ Available | Stop PWM. | ||
SPI support | init_spi() | ❌ Not available | ✅ Available | Initialize the SPI interface. | |
write_spi() | ❌ Not available | ✅ Available | Write bytes to the SPI interface. | ||
write_read_spi() | ❌ Not available | ✅ Available | Write data and read the response from the SPI interface. |