__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:mote-phat 作者: pimoroni 项目源码 文件源码
def show():
    """Output the buffer to Mote pHAT"""
    global _gpio_setup

    if not _gpio_setup:
        GPIO.setmode(GPIO.BCM)
        GPIO.setwarnings(False)
        GPIO.setup([DAT_PIN,CLK_PIN],GPIO.OUT)
        GPIO.setup(CHANNEL_PINS,GPIO.OUT)
        atexit.register(_exit)
        _gpio_setup = True

    for index, channel in enumerate(pixels):
        _select_channel(index)
        gamma = _gamma_table if channels[1] else range(256)
        _sof()
        for pixel in channel:
            r, g, b, brightness = pixel
            r, g, b = [gamma[int(x * brightness * _white_point[i]) & 0xff] for i, x in enumerate([r, g, b])]
            _write_byte(LED_SOF | LED_MAX_BR)
            _write_byte(b)
            _write_byte(g)
            _write_byte(r)

        _eof()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号