def set_leds_state(pixels):
"""Set LED's
Layout of the array:
RGB RGB RGB RGB RGB RGB RGB RGB
RGB RGB RGB RGB RGB RGB RGB RGB
RGB RGB RGB RGB RGB RGB RGB RGB
RGB RGB RGB RGB RGB RGB RGB RGB
RGB RGB RGB RGB RGB RGB RGB RGB
RGB RGB RGB RGB RGB RGB RGB RGB
RGB RGB RGB RGB RGB RGB RGB RGB
RGB RGB RGB RGB RGB RGB RGB RGB
The first 24 bytes of the array stores the first line of the LED's, the
following 24 bytes stores the second line, etc.
Each value of the array should not be greater than 0x1F.
Note: An exception is thrown if it fails.
"""
buffer = (ctypes.c_uint8 * len(pixels))(*pixels)
ret = _LIB.rpisensehat_set_leds_state(buffer)
if ret < 0:
raise Exception("rpisensehat set leds state failed")
评论列表
文章目录