Using HID in tufty or badger 2040

I want to make a device using either the tufty2040 or the badger 2040. I will use the onboard buttons to increase the volume on my main laptop as well as perform other action. Almost like a macro pad or a stream deck. From my research it appears that only circuitpython can do this. I have this demo code:

import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

keyboard = Keyboard(usb_hid.devices)

# Send the key combination to increase volume on Windows, Keycode.UP_ARROW)

The problem is I am unsure of how to run the display using circuitpython. Additionaly Id rather continue using pirate flavour micropython. Does anyone know a solution to either of these issues? Thank you

The Badger2040 is fully supported in CircuitPython. Display support uses displayio, there are many guides from Adafruit which will help getting started.

The Tufty does not have official CP support. I have my own build and I am waiting for Pimoroni to give the ok for a pull-request to make it available upstream. Otherwise, display support is the same.

I am a heavy CP user mostly because of the superior graphical support. HID is also not available for MP as far as I know, but this might have changed recently with MP 1.20.

Is there anywhere I can find a function reference for circuitpython to be used on the badger 2040? If it is supported then it helps out more. I can see some exmaple code on the pico-circuitpython-examples/badger2040 at main · pimoroni/pico-circuitpython-examples · GitHub but I was wondering if there was something a bit more like pimoroni-pico/micropython/modules/picographics at main · pimoroni/pimoroni-pico · GitHub

You can find the documentation for CircuitPython here: Just navigate to “documentation” in the top menu. In the docs, you will find infos about every module, including “displayio”.

But you should be aware of the fact that CircuitPython is the core python interpreter with a core set of modules. Everything else is libraries. So the setup is modular and not monolithic like in the Pimoroni version of MicroPython.

With “displayio” alone you will not get far. You must certainly also install libraries (e.g. there is a display-shapes library, or a display-text library and so on).

So I really recommend that you head to and have a look at the beginner’s guides for using displayio. They might not be written for the badger, but that does not play a role because they will work on any of the hundreds of supported devices alike. The guides will also give you hints on which library you need for what task.