Skip to main content

device_envoy/
lib.rs

1#![doc = include_str!("../README.md")]
2//!
3//! # Glossary
4//!
5//! Resources available on the Pico 1 and Pico 2:
6//!
7//! - **PIO ([Programmable I/O](https://medium.com/data-science/nine-pico-pio-wats-with-rust-part-1-9d062067dc25)):** Pico 1 has 2. Pico 2 has 3.
8//! - **DMA ([Direct Memory Access](https://en.wikipedia.org/wiki/Direct_memory_access)):** Both Pico 1 and 2 have 12 channels.
9//! - **PWM ([Pulse Width Modulation](https://en.wikipedia.org/wiki/Pulse-width_modulation)) Slices:** Both  Pico 1 and 2 have 8 slices (& 16 channels). These "slices"
10//!   are unrelated Rust slices.
11#![cfg_attr(target_os = "none", no_std)]
12#![cfg_attr(target_os = "none", no_main)]
13#![cfg_attr(docsrs, feature(doc_cfg))]
14#![allow(async_fn_in_trait, reason = "single-threaded embedded")]
15
16// Compile-time checks: exactly one board must be selected (unless testing with host feature)
17#[cfg(all(target_os = "none", not(any(feature = "pico1", feature = "pico2"))))]
18compile_error!("Must enable exactly one board feature: 'pico1' or 'pico2'");
19
20#[cfg(all(target_os = "none", feature = "pico1", feature = "pico2"))]
21compile_error!("Cannot enable both 'pico1' and 'pico2' features simultaneously");
22
23// Compile-time checks: exactly one architecture must be selected (unless testing with host feature)
24#[cfg(all(target_os = "none", not(any(feature = "arm", feature = "riscv"))))]
25compile_error!("Must enable exactly one architecture feature: 'arm' or 'riscv'");
26
27#[cfg(all(target_os = "none", feature = "arm", feature = "riscv"))]
28compile_error!("Cannot enable both 'arm' and 'riscv' features simultaneously");
29
30// Compile-time check: pico1 only supports ARM
31#[cfg(all(target_os = "none", feature = "pico1", feature = "riscv"))]
32compile_error!("Pico 1 (RP2040) only supports ARM architecture, not RISC-V");
33
34#[cfg(target_os = "none")]
35pub(crate) mod bit_matrix_led4;
36// PIO interrupt bindings - shared by led_strip::strip and led_strip
37#[cfg(target_os = "none")]
38#[doc(hidden)]
39pub mod pio_irqs;
40#[cfg(feature = "host")]
41/// Utilities for converting frames to PNG images (host testing only).
42pub mod to_png;
43// These modules require embedded targets.
44#[cfg(target_os = "none")]
45pub mod button;
46#[cfg(target_os = "none")]
47pub mod char_lcd;
48#[cfg(all(feature = "wifi", target_os = "none"))]
49pub(crate) mod clock;
50#[cfg(all(feature = "wifi", target_os = "none"))]
51pub mod clock_sync;
52mod error;
53#[cfg(target_os = "none")]
54pub mod flash_array;
55#[cfg(target_os = "none")]
56pub mod ir;
57#[cfg(target_os = "none")]
58pub mod led;
59pub mod led2d;
60#[cfg(target_os = "none")]
61pub mod led4;
62pub mod led_strip;
63#[cfg(target_os = "none")]
64pub mod rfid;
65#[cfg(target_os = "none")]
66pub mod servo;
67#[cfg(target_os = "none")]
68pub mod servo_player;
69#[cfg(target_os = "none")]
70pub(crate) mod time_sync;
71#[cfg(all(feature = "wifi", target_os = "none"))]
72pub mod wifi_auto;
73
74// Re-export error types and result (used throughout)
75pub use crate::error::{Error, Result};