def get_raw_value(channel):
"""Read raw value from ADC Click in range 0..4095
channel: must be in range 0-3. Channel 2 is not available on Ci40.
Note: An exception is thrown if it fails to communicate with the click.
"""
value = ctypes.c_uint16(0)
ret = _LIB.adc_click_get_raw_value(channel, ctypes.byref(value))
if ret < 0:
raise Exception("adc click get raw value failed")
return value.value
评论列表
文章目录