We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cb903d commit 1db8671Copy full SHA for 1db8671
letmecreate/core/gpio.py
@@ -71,6 +71,21 @@ def get_pin(mikrobus_index, pin_type):
71
return pin.value
72
73
74
+def get_type(gpio_pin):
75
+ """Returns the type of the GPIO
76
+
77
+ Some GPIO's on the Mikrobus has some type (AN, PWM, INT, RST or CS). Other
78
+ GPIO's don't have a type.
79
80
+ Note: An exception is thrown if the type of the gpio cannot be found.
81
+ """
82
+ pin_type = ctypes.c_uint8(0)
83
+ ret = _LIB.gpio_get_type(gpio_pin, ctypes.byref(pin_type))
84
+ if ret < 0:
85
+ raise Exception("gpio get type failed")
86
+ return pin_type.value
87
88
89
def set_direction(gpio_pin, direction):
90
"""Configure GPIO as an input or an output.
91
0 commit comments