def get_pin(mikrobus_index, pin_type):
"""Returns GPIO index of a pin on provided mikrobus
Note: An exception is thrown if the gpio cannot be found.
"""
pin = ctypes.c_uint8(0)
ret = _LIB.gpio_get_pin(mikrobus_index, pin_type, ctypes.byref(pin))
if ret < 0:
raise Exception("gpio get pin failed")
return pin.value
评论列表
文章目录