References: MicroPython library, ESP32 quick reference, RP2 quick reference. Latest documentation may describe features absent from older installed firmware.
| Module/capability | Wrapped today | Candidate / boundary |
|---|---|---|
| machine.Pin | Digital read/write, pulls, edge IRQ, reusable Pin creation/value | Additional pin modes/options, IRQ trigger variants |
| machine.time_pulse_us | Pulse measurement with explicit level and timeout | Native -2/-1 codes, blocking |
| Ultrasonic distance (component) | Initialize Trig/Echo variable; read cm | HC-SR04-style, returns None on timeout; see ultrasonic |
| Rotary encoder (component) | Initialize variable, consume left/right steps using machine.Pin IRQ | Full-cycle mechanical quadrature; no native encoder API or high-speed guarantee; see encoder |
| machine.ADC | Pin analog read | Resolution/attenuation/read_uv per port; verify units |
| machine.PWM | Native constructor (frequency, either duty unit, optional inversion), init, freq/duty_u16/duty_ns read and write, deinit; passive buzzer and servo objects | Inversion, timers, precision and frequency limits depend on port/firmware |
| machine.I2C | Create, scan, read/write, register read/write, raw buffer write and writevto | Hardware vs soft I2C, address/timeout options |
| machine.UART | Create, any, read/readline/write/close | Framing parameters, readinto, flow control |
| machine.SPI | Hardware SPI create/write/deinit | Read/readinto/write_readinto, SoftSPI |
| machine.TouchPad | Read, threshold comparison | ESP32-only availability |
| neopixel | Create/set/fill/write | Read, timing and RGBW differences |
| display | SSD1306/ST7735 explicit driver definitions, direct initialization, FrameBuffer creation and formats, selected-display text/pixel/clear/refresh | Hardware-specific capabilities, drawing primitives |
| network.WLAN | Station/AP, active, connect/disconnect, status, IP, MAC, RSSI, scans, reconnects, station list | Firmware-specific options and IPv6 |
| MQTT | Client setup/connect, subscribe/publish, callback, check/ping/disconnect | Reconnect policy remains explicit; QoS/TLS support depends on client |
| HTTP | Request, headers, response status/text/content/JSON, close/context | Streaming, firmware/client-specific TLS |
| time | Sleep (ms/µs), ticks, elapsed, epoch, datetime | RTC setters, monotonic variants |
| ntptime | Configuration, query, synchronization | Network/timezone behavior; UTC is not local timezone |
| asyncio | Explicit scheduling, create task, sleep, cancel, generic await | Event/Lock/Queue where supported |
| os, sys, machine, gc | Generic Python access, native file I/O | Directory operations, memory info, reset, RTC, WDT, timers; verify side effects |
Source: shared hardware blocks. The table is an inventory and candidate list, not a version-specific conformance audit. Shared blocks target compatible firmware; standard micro:bit and SPIKE have separate APIs. Some display, event and servo/buzzer operations are explicit composed components rather than one-to-one native functions.
The two driver initialization blocks assign an SSD1306 or ST7735 object to an ordinary variable (default display). Board presets initialize the same default variable directly. Drawing blocks select a variable, call framebuffer methods, and do not inject a driver or implicitly refresh. Only the standalone SSD1306 and ST7735 driver blocks emit driver classes and imports, once per type, at the top of the program. Add the matching driver block before running a screen program (its workspace position does not affect definition order). Initialization blocks emit only constructor assignments. Missing drivers produce an advisory block warning without injecting code or blocking generation, so an advanced user may supply the class separately. Removing the driver block removes its code even if initialization remains. There is no runtime factory or configuration dictionary. Multiple displays can use different variables. Current constructors still initialize their own hardware buses; shared bus objects and additional panel variants are future work. Physical display behavior depends on the wiring, firmware and panel revision.
Planned native graphics coverage and reconstruction of both reference drivers are tracked in FrameBuffer and user-defined display drivers.
Native API reference: machine.PWM. The Pin creation statement saves a machine.Pin object into a variable. Pin and PWM creation suggest names such as pin0 and pwm0 when the GPIO number is known. Create PWM into an object variable using a pin number, a named pin, or an existing machine.Pin object. The remaining PWM statements select that object variable, and reads store their results in a separate variable. Creation and reconfiguration accept either duty_u16 (0–65535) or duty_ns (nanoseconds), never both. Unconnected frequency/duty settings are omitted. The optional inversion checkbox passes invert=True only when selected; not every port supports it. Frequency, duty ratio and pulse width have separate getter and setter blocks that call native methods without unit conversion. init() modifies the existing object; deinit() releases it. Frequency changes can affect other channels sharing a generator; real limits and resolution depend on the hardware.
The generic passive buzzer is a small _Buzzer component implemented in the same PWM module. Create once, then call play(frequency) (Hz, 50% duty, returns immediately), stop() (zero duty, retains PWM), or deinit() (silences and releases PWM). No global pin registry, per-tone reallocation, built-in duration, melody, or scheduler. Active buzzers have different electrical behavior and are not represented by this component.
buzzer = _Buzzer(16)
buzzer.play(440)
time.sleep_ms(200)
buzzer.stop()
buzzer.deinit()Import buzzer-tone for two tones using ordinary wait blocks. Old pin-based buzzer blocks are replaced without a compatibility layer; recreate them in existing projects. Native micro:bit and SPIKE sound blocks remain unchanged.
Matrix:bit's onboard buzzer is connected to GPIO16 (board P6, not P16). Use the shared PWM/buzzer blocks; there is no separate Matrix:bit buzzer driver. See board mapping.
See servo for configuration and semantics. Import servo-sweep, slow sweep or continuous servo. GPIO18 is Matrix:bit P13; select the actual wired pin and calibrate before use.