API reference
Welcome to the API reference for BadgePython.
This reference describes all officially supported APIs of our platform. We try to keep these APIs as stable as possible. There are many more (undocumented) APIs in the firmware, all of which may change at any time!
BadgePython uses MicroPython at it’s core.The libraries and APIs from the upstream MicroPython project are available in BadgePython.
The MicroPython documentation describes the builtin libraries and functions.
We’ve added some badge specific APIs for efficiently controlling hardware like the display and reading the buttons. By implementing the resource intensive parts of driving the hardware in C. This allows for a much more speedy experience and a lot more possibilities and flexibility.
If you want to help with firmware development please tell us! We’re always happy to accept PRs and improvements.
Should you have ideas, problems or observations but no means to act on them then you can always create an issue on Github.
BadgePython APIs
Library | Function | MCM2022 | SHA2017 | Disobey 2019 | Disobey 2020 | HackerHotel 2019 | CampZone 2019 | CampZone 2020 |
---|---|---|---|---|---|---|---|---|
display | Control the display of your badge: create and display text and graphics | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
buttons | Read button status and attach callback functions to button interactions | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
mch22 | MCH2022 specific functions | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Other libraries and APIs
This section lists most of the other libraries that you can use in your apps.
Library | Function | Documentation |
---|---|---|
math | Mathematical functions | MicroPython |
cmath | Mathematical functions for complex numbers | MicroPython |
ubinascii | Utilities for working with binary data (Hex-string, base64 and CRC32 calculation | MicroPython |
ucollections | Collection and container types | MicroPython |
uerrno | System error code reference | MicroPython |
uhashlib | SHA1 and SHA256 hashing algorithms | MicroPython |
uheapq | Heap queue algorithm | MicroPython |
uio | Input/output streams | MicroPython |
ujson | JSON encoding and decoding | MicroPython |
uos | Basic “operating system” services | MicroPython |
ure | Simple regular expressions | MicroPython |
uselect | Wait for events on a set of streams | MicroPython |
usocket | Sockets (TCP, UDP) | MicroPython |
ussl | SSL/TLS module | MicroPython |
ustruct | Pack and unpack primitive data types | MicroPython |
utime | Time related functions | MicroPython |
uzlib | Zlib decompression | MicroPython |
_thread | Multithreading support | MicroPython |
gc | Control the garbage collector | MicroPython |
sys | System specific functions | MicroPython |
machine | Functions related to the hardware (Note: different from upstream version) | MicroPython |
micropython | Access and control MicroPython internals | MicroPython |
network | Network configuration (Please use the wifi library instead when possible) | MicroPython |
esp | ESP32 specific functions (Note: direct flash access has been disabled) | MicroPython |