Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython.
MIT License
Published by Gadgetoid about 2 years ago
This pre-release is mostly to get a build for Pico Enviro out in the wild.
This build includes hacks to the Pico SDK runtime and standard link in order to read GPIO state and assert pins very early on startup.
The startup clock speed is also increased immensely on Enviro and Badger builds, for a quicker response to user input that triggers a cold boot. (IE: any button press on Badger and all wake events on Enviro)
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.19.6...1.19.7
Published by Gadgetoid about 2 years ago
clear
method for Pico Unicorn should now... clear the display!Note from the future - looks like the standard Badger build below also doesn't include the built in modules - use 1.19.7 instead!
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.19.5...v1.19.6
Published by Gadgetoid about 2 years ago
This is a quick patch release to fix a couple of issues.
The issue with macOS USB causing a hardlock on PicoW startup https://github.com/micropython/micropython/issues/8904 should now be fixed.
Additionally, the partial refresh for Badger 2040 has been fixed at fast/turbo speeds where previously it would busy wait forever.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.19.4...v1.19.5
Published by Gadgetoid over 2 years ago
Finally! A release on a Friday. Things are slowly falling back into place.
⚠️ The Pico W firmware is still building against an unstable release of MicroPython, since there is no stable release yet. There will be bugs. We are currently monitoring the status of an issue with Pico W crashing when connected to USB on macOSX - see: https://github.com/micropython/micropython/issues/8904
This release includes some bug fixes, a change to how our CI fetches compilers and some new bits and bobs.
gc_heap
instead. This should get it working on Pico W boards!pimoroni
for reading the buttons on Inky FrameA slightly technical explanation for future adventurers and those playing along at home.
Our CI builds were coming out a little wonky. This transpired to be an issue with how it was fetching compilers (wget the ARM GCC .zip directly) in order to speed things up. We have reverted this change- after much frustrated tinkering.
If you decide to build MicroPython locally, you can check for a borked build by running:
arm-none-eabi-nm --demangle=gnu-v3 --print-size --size-sort firmware.elf
And keeping an eye out for rogue exception handling symbols such as: d_print_comp_inner
. These indicate - afaik - that -fno-rtti
(no runtime introspection) and --fno-exception
(no runtime exception handling) are not having the desired effect. The resulting, bloated build usually fails spectacularly (doesn't boot) on a Pico.
I'm not sure how these broken builds went unchecked for so long, but things seem to be working... for now...
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.19.3...v1.19.4
Published by Gadgetoid over 2 years ago
This release adds support for Inky Frame, adding a tightly-packed 3-bit pen mode so we can squeeze that huge 600x448 pixel display into the Pico's RAM while leaving enough free for downloading and processing fun things to display. The 3Bit pen also includes ordered dither support, making the best use of the 7 (or 8 if you count "clear") colours on Inky Frame for photos and images.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.19.2...v1.19.3
Published by Gadgetoid over 2 years ago
⚠️ The 1.19.x release of Pimoroni Pico brings an enormous number of breaking changes into the mix. You will probably have to rewrite some of your code!
💬 Discussion, bugs and issues here - https://github.com/pimoroni/pimoroni-pico/issues/392
ℹ️ Pico Wireless users (Including Automation and Inventor) should grab - https://github.com/pimoroni/pimoroni-pico/releases/download/v1.19.2/pimoroni-picow-v1.19.2-micropython.uf2
Aside from introducing Pico Wireless support, this release is rife with small fixes, improvements and - mostly - laying of groundwork to support some new and shiny.
There's a couple of things you should now about MicroPython on Pico W:
You should be especially cautious when using display products, since these eat a huge chunk of RAM. Our PicoGraphics changes mean that, by default, most displays use half the RAM they did before. This really helps!
This release brings some bug fixes to Pico Inky Pack, fixing an issue where displaying a jpeg would cause a hard-lock.
Additionally Inky Pack (and all 1-bit displays) now have 16 "greyscale" shades which are automatically dithered. That means that a pen of 0
is black and a pen of 15
is white- like Badger 2040. Anything between these values will be dithered. This has weird results for text, so stick with black/white if you want it to be readable!
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.19.1...v1.19.2
Published by Gadgetoid over 2 years ago
⚠️ The 1.19.x release of Pimoroni Pico brings an enormous number of breaking changes into the mix. You will probably have to rewrite some of your code!
💬 Discussion, bugs and issues here - https://github.com/pimoroni/pimoroni-pico/issues/392
ℹ️ Pico Wireless users (Including Automation and Inventor) should grab - https://github.com/pimoroni/pimoroni-pico/releases/download/v1.19.1/pimoroni-picow-v1.19.1-micropython.uf2
Aside from introducing Pico Wireless support, this release is rife with small fixes, improvements and - mostly - laying of groundwork to support some new and shiny.
There's a couple of things you should now about MicroPython on Pico W:
You should be especially cautious when using display products, since these eat a huge chunk of RAM. Our PicoGraphics changes mean that, by default, most displays use half the RAM they did before. This really helps!
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.19.0...v1.19.1
Published by Gadgetoid over 2 years ago
⚠️ This release of Pimoroni Pico brings an enormous number of breaking changes into the mix. You will probably have to rewrite some of your code!
💬 Discussion, bugs and issues here - https://github.com/pimoroni/pimoroni-pico/issues/392
The generic ST7789 driver released as part of the 1.18.8 pre-release has been completely re-written into PicoGraphics.
Pico Graphics is now the canonical display library for Pimoroni Pico MicroPython. It includes support for our ST7789, ST7735 and SH1107 based displays.
Too much has changed to explain it here, but see the Pico Graphics documentation to learn more: https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/modules/picographics/README.md
In brief, you now set up a display by creating a PicoGraphics
class instance, and telling it the name of the display you want to use. For Tufty that would be:
from picographics import PicoGraphics, DISPLAY_TUFTY2040
display = PicoGraphics(DISPLAY_TUFTY_2040)
And that's it. Easy!
Some notable additions:
C++ users will find libraries like Pico Explorer have been pared back to basic defines, favouring our new individual libraries to make all the bits go.
The examples should give you a clue how your code needs to change, eg: https://github.com/pimoroni/pimoroni-pico/blob/main/examples/pico_explorer/pico_explorer_demo.cpp
In brief, setting up a display now looks something like this:
ST7789 st7789(PicoExplorer::WIDTH, PicoExplorer::HEIGHT, ROTATE_0, false, get_spi_pins(BG_SPI_FRONT));
PicoGraphics_PenRGB332 graphics(st7789.width, st7789.height, nullptr);
And updating it, like this:
st7789.update(&graphics);
The Pico Graphics variant PicoGraphics_PenRGB332
gives you an RGB332 pen type, 256 colours in half the RAM it previously took to drive a display. You can use PicoGraphics_PenRGBRGB565
for more colours (65K) and less free RAM, or PicoGraphics_PenP4
for fewer colours (16!) and even more RAM for your own code.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.9...v1.19.0
Published by Gadgetoid over 2 years ago
⚠️ This release has some spicy changes that you might not want to be dealing with right now. If you're looking for your code to keep ticking along as usual then please grab v1.18.7. If you want to help find all the ways in which I've broken our MicroPython build... please give this release a go!
This is a bugfix and refactor release for the v1.18.8 beta.
Crucially the ST7789 combined LCD driver has seen some fixes to line
and triangle
which were fixed in #344 in the other libraries, but missed out here.
Additionally some significant refactoring has been applied across all of our MicroPython-wrapped-C++ classes, such that they are allocated within MicroPython's "gc_heap" memory region. This should have no real effect for most users, but fixes an issue where the RP2040 would run out of RAM when allocating classes because they were being allocated in the tiny amount of free RAM left to MicroPython's core/C/C++ code.
This led to some very smelly defensive programming where buffers that should have been constant sized and allocated as part of a class were being allocated with m_new
and passed in as pointers, just to keep the class size down and avoid blowing through the memory.
You can now create 3000 instances of Pimoroni I2C with impunity. Have fun!
I also snuck the ADCFFT library into this release. It's surprisingly effective even under MicroPython!
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.8...v1.18.9
Published by Gadgetoid over 2 years ago
⚠️ This release has some spicy changes that you might not want to be dealing with right now. If you're looking for your code to keep ticking along as usual then please grab v1.18.7. If you want to help find all the ways in which I've broken our MicroPython build... please give this release a go!
We were wasting a lot of precious bytes duplicating code for our display products. Indeed Pico Display, Pico Display 2.0, 240x240 1.3" SPI LCD and the 240x240 round SPI LCD were all using the same ST7789 driver under the hood and we'd reinvented how to read a pin (Pico Display's buttons) in an effort to keep things simple and self contained.
As a consequence I have replaced all of the libraries for these display products with just ST7789 which accepts a width and height corresponding to the product you want to use. This hides the bytearray
buffer wart we needed to avoid display buffers being eaten by MicroPython's GC.
This means you can now do really cool stuff like driving two Pico Display 2.0 boards from one Pico.
ST7789 discards the LED and Button functionality. With Pico Zero, MicroPython's own machine.Pin
and our Button
and RGBLED
libraries on the scene, we really didn't need yet another way to drive RGB LEDs and buttons.
Dropping four libraries in favour of one helps slim down our batteries-included MicroPython build so we can continue to add functionality. It does- however- mean you'll need to make some changes to your code.
Code that once looked like:
import picodisplay as display
width = display.get_width()
height = display.get_height()
display_buffer = bytearray(width * height * 2)
display.init(display_buffer)
Should now look like:
import st7789
WIDTH = 240
HEIGHT = 135
display = st7789.ST7789(WIDTH, HEIGHT, rotate180=False)
And if you want a portrait display you can just swap the width/height like so:
import st7789
WIDTH = 135
HEIGHT = 240
display = st7789.ST7789(WIDTH, HEIGHT, rotate180=False)
For buttons you can use Pico Zero, or our baked-in button library. Our Button library supports auto-repeat if you need it.
Here's how to set up the Pico Display and Pico Display 2.0" buttons:
from pimoroni import Button
button_a = Button(12)
button_b = Button(13)
button_x = Button(14)
button_y = Button(15)
And the RGB LED:
from pimoroni import RGBLED
led = RGBLED(6, 7, 8)
ℹ️ The 160x80 colour LCD uses the ST7735 driver under the hood and the way you use it has not changed!
It's been bugging me for a while, but it wasn't until @alphanumeric007 raised #359 that it truly dawned upon me how our Pimoroni I2C object feels like a dose of not-invented-here syndrome. It's not. It exists because we needed a standard set of I2C functions for our C++ libraries, and it works well for this. However MicroPython already has a standard set of I2C functions, so wrapping our C++ libraries up for it resulted in this ugly wart of a... weird third party I2C library. There was no real reason not to sweep this under the rug as an implementation detail; so I have.
I2C has now changed in two ways:
PimoroniI2C
is a weird superset of machine.I2C
and will work fine as a drop-in replacement if you want to keep using itmachine.I2C
instances will now be accepted by all of our MicroPython I2C-based sensor libraries, and quietly promoted to PimoroniI2C
behind the scenesThis means that, should you wish to, you can now do this:
sda = machine.Pin(4)
scl = machine.Pin(5)
i2c = machine.I2C(0, sda=sda, scl=scl, freq=400_000)
bme280 = BreakoutBME280(i2c)
And machine.I2C
and PimoroniI2C
are equivalent:
>>> import pimoroni_i2c
>>> i2c = pimoroni_i2c.PimoroniI2C(4, 5)
>>> dir(i2c)
['__class__', 'readinto', 'start', 'stop', 'write', 'init', 'readfrom', 'readfrom_into', 'readfrom_mem', 'readfrom_mem_into', 'scan', 'writeto', 'writeto_mem', 'writevto']
>>> import machine
>>> i2c = machine.I2C(0, sda=machine.Pin(4), scl=machine.Pin(5))
>>> dir(i2c)
['__class__', 'readinto', 'start', 'stop', 'write', 'init', 'readfrom', 'readfrom_into', 'readfrom_mem', 'readfrom_mem_into', 'scan', 'writeto', 'writeto_mem', 'writevto']
Your existing scripts should continue to work, and you should generally continue to use PimoroniI2C
since it avoids some extra overhead when used with our libraries. However you can now share one single I2C object (whichever it might be) with both Pimoroni baked-in libraries and any third-party MicroPython libraries you might want to use!
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.7...v1.18.8
Published by Gadgetoid over 2 years ago
Following on from the Servo support @ZodiusInfuser added to the last release, they have now added motor support to Pico. This includes both PWM and PIO flavours, letting you drive up to 15 motors at once!
That's not all. This release also comes with PIO-based encoder support, letting you connect up to 8 quadrature rotary encoders to your projects. Use these as part of your project's interface, or to give feedback on the position and speed of your motors.
These are mostly to drive our own products, but you can use these libraries - both C++ and MicroPython-wrapped-C++ - to drive motors and read encoders connected to any RP2040 board.
Blinka and PlatformDetect versions have been bumped and some more core files added, unfortunately our build is getting a little bloated- we've included too many batteries and there may be cases where this causes MicroPython to crash quite spectacularly and require re-flashing. (because the binary is so big it overwrites its very tippy top when the filesystem is created or written to) We're looking into this!
To try and whittle back our very chunky MicroPython build, we have a project in the works to unify all of our (ST7789-based) Display products under one driver. This includes Pico Display, Pico Display 2.0" and the 240x240 round and Square LCDs. The coded needed to drive these products will change somewhat, and we'll have a migration guide ready to help guide you.
A benefit of this change is that you can- if you're determined- use multiple displays. Watch this space, we're hoping this will find its way into the next release!
See the pending PR for more details: https://github.com/pimoroni/pimoroni-pico/pull/327
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.6...v1.18.7
Published by Gadgetoid over 2 years ago
This release is packed with changes for Badger 2040 and general Pico builds.
@MichaelBell has delved to sweep up any remaining unconverted apps from 1.18.5, making everything possible super power-friendly on Badger 2040. There's also a new over/underclocking API method to help you get the most out of your batteries and slightly improved wake handling
I've overhauled our font rendering, pulling Hershey and Bitmap fonts into their own libraries so they're easy to combine with different drawing libraries and behave the same everywhere they are used. Bitmap fonts will now handle characters like £, ° and many accented characters gracefully. Hershey fonts are lagging behind, but will substitute some accented characters rather than breaking entirely.
The end game is to try and bring support for all the useful characters from - https://www.utf8-chartable.de/
Unfortunately characters outside of this set will get exponentially more complicated to add, and we have to strike a balance somewhere.
As a result of this overhaul, Badger 2040 now supports three bitmap fonts which are demonstrated in the updated fonts app. For now, use these for non-English languages (or even English, since we have many accented loan words), displaying prices in pounds, or temperatures in degrees C.
I've merged a huge changeset that overhauls every single Pico Wireless function to use a standard pattern that's much easier to work with, debug and understand. I've tried to test this as best I can, but it may still contain bugs. Let us know via issues if you have... issues... with your wireless apps.
@ZodiusInfuser has completed a huge project to bring incredible 18-channel PIO servo support to Pico. This is mostly to drive our own products, but you can use these libraries - both C++ and MicroPython-wrapped-C++ - to drive servos connected to any RP2040 board.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.5...v1.18.6
Published by Gadgetoid over 2 years ago
👇 Scroll down to find .uf2 files under "Assets". There are now too many to manually list at the top here! 👇
The super exciting battery changes in this release have been brought to you by @MichaelBell, Bishop of Badger batteries and connoseuir of coins cells.
The TLDR is that battery life in apps like QRGen, Badge and Image is now immensely improved while running from AA, AAA, LiPo or Coin-cell batteries connected to the JST connector.
How did @MichaelBell achieve this enormous improvement? By just turning Badger 2040 off. Yup, MicroPython can't use any power if it's turned completely off. While I've been worring about sleep states and pin wake interrupts Michael has swept in with a brilliantly elegant solution. I wont say simple because there's some clever stuff happening here and it's taken a lot of work to make the best use of it. But it's elegant!
Badger OS now makes liberal use of text files to save the state of various apps, including which app was launched last. When the launcher fires up, it checks its own state and launches the last known app. That app will then load its own state and handle whatever button you pressed to wake up Badger 2040, update the screen and turn off the power again.
Now when you load the Badge app, for example, it'll display the badge and cut the power to your Badger 2040. Even the launcher itself will power off, so you wont drain the battery leaving it running!
badger_os
module with some handy features for saving/loading app state and displaying warnings..pressed()
to handle buttons in Badger OS apps now..halt()
to power off when you're done!Known issues:
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.4...v1.18.5
Published by Gadgetoid over 2 years ago
👇 Scroll down to find .uf2 files under "Assets". There are now too many to manually list at the top here! 👇
As pointed out in #272 we weren't building versions of MicroPython for specific boards, so 4MB, 8MB and 16MB variants were getting left in the dark, with only 2MB being available.
This has now changed. You'll find multiple builds of MicroPython in this release and should use the one that corresponds to your board.
❗ Note: This isn't available for the Blinka build yet. That's a whole other can of worms! If you use this build, let us know because you can sideload the Blinka libraries and it would be really handy to drop it from our auto-builds altogether if it's not seeing much use.
Bader2040 / badgerOS has had a number of fixes (detailed below) but nothing groundbreaking. Notably all the silly bugs I introduced when trying to make the clock example settable have been squashed by @lurch.
Additionally there are some fixes to the rendering of text, which should make 90, 180 and 270 degree rotations look less wonky.
badgerOS now includes a QR code generator: qrgen. Run it once and edit qrcode.txt
via Thonny to set your own URL, title and description.
This same library is baked into all other MicroPython builds, and there's an example .py for Pico Display/Pico Display 2.0" to get you started.
Improvements and documentation will follow!
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.3...v1.18.4
Published by Gadgetoid over 2 years ago
This release includes a slew of updates to the Badger 2040 examples and launcher:
ebook.py
will launch your copy instead of the builtin one. To restore to the builtin just delete your version from the filesystem.checklist.txt
to disk and will update it when you check off an item!Regular (non-badger) MicroPython builds no longer include the Badger2040 module (it's a bit redundant and very chonky) but are otherwise the same as v1.18.2.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/1.18.2...v1.18.3
Published by Gadgetoid over 2 years ago
This release should finally fix the display memory corruption bugs. Sorry it took us so long, it was a tricky one despite the eventual fix being so simple (and staring us in the face).
This release also adds support for Badger 2040, complete with its own build of MicroPython preloaded with a launcher and some tasty examples.
Otherwise the Python builds are the same as v1.18.1.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.1...1.18.2
Published by Gadgetoid over 2 years ago
This releases fixes an issue with I2C for the ICP10125 sensor. Otherwise the Python builds are the same as v1.18.0.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v1.18.0...v1.18.1
Published by Gadgetoid over 2 years ago
This release has the same libraries/modules as v0.3.3 (https://github.com/pimoroni/pimoroni-pico/releases/tag/v0.3.3) however:
We were previously stepping through incremental minor and patch numbers. In an effort to better reflect the dependence upon upstream MicroPython, the Major and Minor (1.18) version numbers now reflect the MicroPython release version.
The Patch version will continue to reflect incremental changes to the library, including bugfixes, newly supported device and so on.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v0.3.3...v1.18.0
Published by Gadgetoid over 2 years ago
This release adds support for the SCD4X series CO2 sensors, exposes the update
method of the Plasma APA102 and WS2812 libraries and fixes the ordering of return values from WS2812's get
method.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v0.3.2...v0.3.3
Published by Gadgetoid almost 3 years ago
This release adds support for the Interstate 75 HUB75 panel driver, plus some other tweaks and fixes detailed below.
Full Changelog: https://github.com/pimoroni/pimoroni-pico/compare/v0.3.1...v0.3.2