Copper Serial Registry
A shared serial port registry for Copper components to register and retrieve serial ports in no-std environments.
Overview
This library provides a global registry for serial ports that can be shared between different Copper components like bridges. It's designed to work in both std and no-std environments.
Usage
Registering a Serial Port
use cu_serial_registry;
use ;
// Register a serial port at slot 0
let serial_port = /* your serial implementation */;
register?;
Retrieving a Serial Port
// Take the serial port from slot 0
let serial: = take;
Features
- no-std compatible: Works in embedded environments
- Type-safe: Uses Rust's type system to ensure correct serial port types
- Thread-safe: Uses spin locks for concurrent access
- Bounded: Supports up to
MAX_SERIAL_SLOTS(8) serial ports - Zero-cost when unused: Minimal overhead
Integration with Copper Bridges
This registry is used by Copper bridges like CRSF and MSP to allow sharing serial ports between components in no-std environments where traditional dependency injection isn't available.