module documentation

Device Module

This provides the Device class, a base class for hardware device drivers and similar objects.

The RP2040 has two cores (0 and 1). When running MicroPython by default core 0 is used and core 1 is idle. The RP2040 port of MicroPython uses the _thread module to run code in core 1 and enable communications between the cores.

This module provides a queue for passing events and instructions. Multiple sources may write to the queue. There may be only 1 reader. The reader runs in the main loop. Sources are typically event driven and use a combination of hardware interrupts and timer call-backs.

In the RP2 MicroPython implementaton all interrupts (both hard and soft) are processed in core 0. Core 1 always runs in non - interrupt context.

If using both cores, the structure of the application has to be designed to accomodate this. Device drivers run on core 0. Core 1 runs a main loop which reads the queue and processess entries as they occur.

Author
Paul Redhead
Class Device Device Base Class
Exception ThreadQError Thread Queue Error
Constant MAX_Q_LEN The capacity of the event queue.
MAX_Q_LEN = ΒΆ

The capacity of the event queue.

Value
const(16)