表題の組み合わせでハマったのでメモ
環境
- Raspberry Pi Pico
- CircuitPython(adafruit-circuitpython-raspberry_pi_pico-en_GB-6.2.0.uf2)
- SSD1306ドライバーのOLED(128*32)
- ライブラリ(adafruit-circuitpython-bundle-6.x-mpy-20210430)
動いたライブラリ
adafruit_displayio_ssd1306.mpy他(adafruit_scd_30.mpyはセンサーのライブラリで不要)
~/develop/scd30_pico/lib$ ls
adafruit_bus_device adafruit_displayio_ssd1306.mpy adafruit_scd30.mpy
adafruit_display_text adafruit_framebuf.mpy
コード。
# SPDX-FileCopyrightText: 2020 by Bryan Siepert, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import time
import board
import busio
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_displayio_ssd1306
import adafruit_scd30
displayio.release_displays()
i2c_oled = busio.I2C(scl=board.GP19, sda=board.GP18)
display_bus = displayio.I2CDisplay(i2c_oled, device_address=0x3C)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
scd = adafruit_scd30.SCD30(i2c_oled)
try:
while True:
CO2 = scd.CO2
print(CO2)
text_group = displayio.Group(max_size=10)
# Draw a label
text = str(CO2)
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFFFF, x=0, y=4)
text_group.append(text_area)
display.show(text_group)
time.sleep(2)
except Exception as e:
print(type(e))
print(e.args)
print(e)
動かなかったライブラリ
adafruit_ssd1306
事象
初期化すると、PCにUSBとして認識されなくなる
i2c = busio.I2C(board.GP21, board.GP20)
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
上記で下の感じ
[4936305.202012] usb 2-2: new full-speed USB device number 74 using xhci_hcd
[4936305.202193] usb 2-2: Device not responding to setup address.
[4936305.410209] usb 2-2: Device not responding to setup address.
[4936305.618018] usb 2-2: device not accepting address 74, error -71
[4936305.746021] usb 2-2: new full-speed USB device number 75 using xhci_hcd
[4936305.746221] usb 2-2: Device not responding to setup address.
[4936305.954217] usb 2-2: Device not responding to setup address.
[4936306.162031] usb 2-2: device not accepting address 75, error -71
[4936306.162095] usb usb2-port2: unable to enumerate USB device
バグなのか使い方か不明。まだissueの流れが早すぎて見るの諦めた。