JetBrains / intellij-micropython

Plugin for MicroPython devices in PyCharm and IntelliJ
https://plugins.jetbrains.com/plugin/9777-micropython
Apache License 2.0
506 stars 106 forks source link

Auto-detect a wider range of RP2040 devices #257

Closed rtyley closed 10 months ago

rtyley commented 10 months ago

At the moment, the device-path detection for Raspberry Pi USB devices only recognises one specific id: 2E8A:0005, the vanilla Raspberry Pi Pico running MicroPython firmware:

image

Plethora of RP2040 devices...

However, there are many devices using the RP2040 that are similar to the Raspberry Pi Pico and run MicroPython in the same way (_Adafruit Feather RP2040, Pimoroni Badger 2040, Raspberry Breadstick_, etc) - these all use the same vendor id as the Pico (2E8A), but have different product ids from the large 0x1000 - 0x1fff range which Raspberry Pi sub-license.

Not all of the devices in the 0x1000 - 0x1fff range actually run MicroPython (eg 0x1069, the Zoid Technology Matrix, runs QMK firmware and quite possibly doesn't have a MicroPython build), but if it's plugged into a developers machine and they're trying to access MicroPython on it, it probably does.

Changes made in this PR

See https://github.com/raspberrypi/usb-pid#assignment - Raspberry Pi have allocated the productId range 0x1000 - 0x1fff for Commercial RP2040 devices, of which they have allocated over 100 ids as of 2023.

rtyley commented 10 months ago

Thanks for the thumbs up @lancelote - I've now signed the JetBrains Contributor License Agreement (CLA) - if the change looks good to you that's great, please merge!

I've tested the changes locally with a Pimoroni Pico LiPo, and they work as intended.

lancelote commented 10 months ago

@rtyley Thank you for the excellent contribution 👍

rtyley commented 10 months ago

Ah wonderful, thank you!