![]() This is the final piece of the puzzle. Prior to this rather considerable change, Pimoroni breakouts were not de-init'ing I2C when they failed to init() This change adds a __del__ method which cleans up the I2C instance attached to a MicroPython object. Under the hood this calls i2c_deinit() and resets the associated pins to their default state. This means that I2C is now cleaned up during a *soft* reset, so running a script with the wrong pins, seeing an error, changing the pins and running it again will not result in subsequent I2C errors. Previously a hard reset was required. To recreate on Breakout Garden run the following code: ``` from breakout_potentiometer import BreakoutPotentiometer from pimoroni_i2c import PimoroniI2C i2c = PimoroniI2C() pot = BreakoutPotentiometer(i2c) ``` This will fail correctly with "Potentiometer breakout not found when initialising." (The default pins are configured for Pico Explorer) Now change that to the following and run again without hard-resetting: ``` from breakout_potentiometer import BreakoutPotentiometer from pimoroni_i2c import PimoroniI2C i2c = PimoroniI2C(4, 5) pot = BreakoutPotentiometer(i2c) ``` This should now work, since the failed I2C instance was cleaned up. Without this change, the second attempt would result in an inexplicable failure. Since most? (many?) Pico users do not have a reset button, this trap requiring a hard-reset is pretty nasty and would likely have resulted in a support nightmare. Whew. |
||
---|---|---|
.github/workflows | ||
common | ||
drivers | ||
examples | ||
libraries | ||
micropython | ||
.gitignore | ||
.gitmodules | ||
CMakeLists.txt | ||
LICENSE | ||
README.md | ||
pico_sdk_import.cmake | ||
setting-up-micropython.md | ||
setting-up-the-pico-sdk.md |
README.md
Pimoroni Pico Libraries and Examples
Welcome to the brave new world of Pico! This repository contains the C/C++ and MicroPython libraries for our range of Raspberry Pi Pico addons.
First of all you need to decide if your project is going to be done in MicroPython or using C/C++ with the Pico SDK. We have instructions for both here:
- MicroPython: The easiest way to get start, setup is a breeze! Click here to view instructions for MicroPython
- C/C++: For more advanced users that want to unleash the full power of Pico! Click here to view instructions for C/C++
Software support for our Pico range
It's very early days for Pico and we've been working our little socks off to get everything ready for launch.
Most of our Pico addons have support for both C/C++ and MicroPython but we're still catching up a little bit in places.
The table below shows the current state of compatibly and some notes to set expectations:
Product | C/C++ Library | MicroPython Library | Notes |
---|---|---|---|
Pico Explorer Base | Yes | Yes | |
Pico RGB Keypad | Yes | Yes | |
Pico Unicorn Pack | Yes | Yes | MicroPython support added in v0.0.3 Alpha |
Pico Audio Pack | Yes | No | Limited support for MicroPython planned |
Pico Scroll Pack | Yes | Yes | |
Pico Display Pack | Yes | Yes |
We will keep this information updated as things develop.
Note: It's very early days for Raspberry Pi Pico and it's likely that our libraries will undergo quite a lot of changes over the next couple of weeks as we take in feedback and expand the functionality.