repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb-dfu/src/application.rs | embassy-usb-dfu/src/application.rs | //! Application part of DFU logic
use embassy_boot::BlockingFirmwareState;
use embassy_time::{Duration, Instant};
use embassy_usb::control::{InResponse, OutResponse, Recipient, RequestType};
use embassy_usb::driver::Driver;
use embassy_usb::{Builder, FunctionBuilder, Handler};
use embedded_storage::nor_flash::NorFlash;... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb-dfu/src/dfu.rs | embassy-usb-dfu/src/dfu.rs | //! DFU bootloader part of DFU logic
use embassy_boot::{AlignedBuffer, BlockingFirmwareUpdater, FirmwareUpdaterError};
use embassy_usb::control::{InResponse, OutResponse, Recipient, RequestType};
use embassy_usb::driver::Driver;
use embassy_usb::{Builder, FunctionBuilder, Handler};
use embedded_storage::nor_flash::{Nor... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb-dfu/src/fmt.rs | embassy-usb-dfu/src/fmt.rs | #![macro_use]
#![allow(unused)]
use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/build.rs | embassy-nxp/build.rs | use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, fs};
use cfg_aliases::cfg_aliases;
use nxp_pac::metadata;
use nxp_pac::metadata::{METADATA, Peripheral};
#[allow(unused)]
use proc_macro2::TokenStream;
use proc_macro2::{Ident, Literal, Span};
use quote::format_ident;
#[allow... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/build_common.rs | embassy-nxp/build_common.rs | // NOTE: this file is copy-pasted between several Embassy crates, because there is no
// straightforward way to share this code:
// - it cannot be placed into the root of the repo and linked from each build.rs using `#[path =
// "../build_common.rs"]`, because `cargo publish` requires that all files published with a cr... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/lib.rs | embassy-nxp/src/lib.rs | #![no_std]
#![allow(unsafe_op_in_unsafe_fn)]
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
#[cfg(feature = "lpc55-core0")]
pub mod dma;
pub mod gpio;
#[cfg(feature = "lpc55-core0")]
pub mod pint;
#[cfg(feature = "lpc55-core0")]
pub mod pwm;
#[cfg(feature = "lpc55-core0")]
pub mod s... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/usart.rs | embassy-nxp/src/usart.rs | #![macro_use]
//! Universal Synchronous/Asynchronous Receiver/Transmitter (USART) driver.
#[cfg_attr(feature = "lpc55-core0", path = "./usart/lpc55.rs")]
mod inner;
pub use inner::*;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/pwm.rs | embassy-nxp/src/pwm.rs | #![macro_use]
//! Pulse-Width Modulation (PWM) driver.
#[cfg_attr(feature = "lpc55-core0", path = "./pwm/lpc55.rs")]
mod inner;
pub use inner::*;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/pint.rs | embassy-nxp/src/pint.rs | //! Pin Interrupt module.
use core::cell::RefCell;
use core::future::Future;
use core::pin::Pin as FuturePin;
use core::task::{Context, Poll};
use critical_section::Mutex;
use embassy_hal_internal::interrupt::InterruptExt;
use embassy_sync::waitqueue::AtomicWaker;
use crate::Peri;
use crate::gpio::{self, AnyPin, Leve... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/dma.rs | embassy-nxp/src/dma.rs | #![macro_use]
//! Direct Memory Access (DMA) driver.
#[cfg_attr(feature = "lpc55-core0", path = "./dma/lpc55.rs")]
mod inner;
pub use inner::*;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/sct.rs | embassy-nxp/src/sct.rs | #![macro_use]
use embassy_hal_internal::PeripheralType;
use nxp_pac::iocon::vals::PioFunc;
use crate::gpio;
/// SCT instance.
#[allow(private_bounds)]
pub trait Instance: SealedInstance + PeripheralType {}
pub(crate) trait SealedInstance {}
/// An SCT output.
#[allow(private_bounds)]
pub trait Output<T: Instance>:... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/iomuxc.rs | embassy-nxp/src/iomuxc.rs | #![macro_use]
/// An IOMUXC pad.
///
/// This trait does not imply that GPIO can be used with this pad. [`Pin`](crate::gpio::Pin) must
/// also be implemented for GPIO.
#[allow(private_bounds)]
pub trait Pad: SealedPad {}
pub(crate) trait SealedPad {
/// Address of the pad register for this pad.
const PAD: *m... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/fmt.rs | embassy-nxp/src/fmt.rs | //! Copied from embassy-rp
#![macro_use]
#![allow(unused)]
use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert {
($($x:tt)*) => {
{
#[cf... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/gpio.rs | embassy-nxp/src/gpio.rs | //! General purpose input/output (GPIO) driver.
#![macro_use]
#[cfg_attr(feature = "lpc55-core0", path = "./gpio/lpc55.rs")]
#[cfg_attr(rt1xxx, path = "./gpio/rt1xxx.rs")]
mod inner;
pub use inner::*;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/gpio/rt1xxx.rs | embassy-nxp/src/gpio/rt1xxx.rs | #![macro_use]
use core::future::Future;
use core::ops::Not;
use core::pin::Pin as FuturePin;
use core::task::{Context, Poll};
use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
use embassy_sync::waitqueue::AtomicWaker;
use nxp_pac::gpio::vals::Icr;
use nxp_pac::iomuxc::vals::Pus;
use crate::chip::{io... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/gpio/lpc55.rs | embassy-nxp/src/gpio/lpc55.rs | #![macro_use]
use embassy_hal_internal::{PeripheralType, impl_peripheral};
use crate::Peri;
use crate::pac::common::{RW, Reg};
use crate::pac::iocon::vals::{PioDigimode, PioMode};
use crate::pac::{GPIO, IOCON, SYSCON, iocon};
pub(crate) fn init() {
// Enable clocks for GPIO, PINT, and IOCON
SYSCON.ahbclkctrl... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/pwm/lpc55.rs | embassy-nxp/src/pwm/lpc55.rs | #![macro_use]
use core::sync::atomic::{AtomicU8, AtomicU32, Ordering};
use embassy_hal_internal::Peri;
use crate::gpio::AnyPin;
use crate::pac::iocon::vals::{PioDigimode, PioMode, PioOd, PioSlew};
use crate::pac::sct0::vals;
use crate::pac::syscon::vals::{SctRst, SctclkselSel};
use crate::pac::{SCT0, SYSCON};
use cr... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/time_driver/rtc.rs | embassy-nxp/src/time_driver/rtc.rs | use core::cell::{Cell, RefCell};
use core::task::Waker;
use critical_section::CriticalSection;
use embassy_hal_internal::interrupt::{InterruptExt, Priority};
use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex;
use embassy_time_driver::{Driver, time_driver_impl};
use embassy_time_queue_utils::Queue;
use c... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/time_driver/pit.rs | embassy-nxp/src/time_driver/pit.rs | //! Time driver using Periodic Interrupt Timer (PIT)
//!
//! This driver is used with the iMXRT1xxx parts.
//!
//! The PIT is run in lifetime mode. Timer 1 is chained to timer 0 to provide a free-running 64-bit timer.
//! The 64-bit timer is used to track how many ticks since boot.
//!
//! Timer 2 counts how many ticks... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/usart/lpc55.rs | embassy-nxp/src/usart/lpc55.rs | #![macro_use]
use core::fmt::Debug;
use core::future::poll_fn;
use core::marker::PhantomData;
use core::sync::atomic::{AtomicBool, Ordering};
use core::task::Poll;
use embassy_futures::select::{Either, select};
use embassy_hal_internal::interrupt::InterruptExt;
use embassy_hal_internal::{Peri, PeripheralType};
use em... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | true |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/dma/lpc55.rs | embassy-nxp/src/dma/lpc55.rs | #![macro_use]
use core::cell::RefCell;
use core::future::Future;
use core::pin::Pin;
use core::sync::atomic::{Ordering, compiler_fence};
use core::task::{Context, Poll};
use critical_section::Mutex;
use embassy_hal_internal::interrupt::InterruptExt;
use embassy_hal_internal::{PeripheralType, impl_peripheral};
use emb... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/chips/mimxrt1011.rs | embassy-nxp/src/chips/mimxrt1011.rs | // This must be imported so that __preinit is defined.
use imxrt_rt as _;
pub(crate) mod _generated {
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(non_snake_case)]
#![allow(missing_docs)]
include!(concat!(env!("OUT_DIR"), "/_generated.rs"));
}
pub use _generated::*;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/chips/mimxrt1062.rs | embassy-nxp/src/chips/mimxrt1062.rs | // This must be imported so that __preinit is defined.
use imxrt_rt as _;
pub(crate) mod _generated {
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(non_snake_case)]
#![allow(missing_docs)]
include!(concat!(env!("OUT_DIR"), "/_generated.rs"));
}
pub use _generated::*;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-nxp/src/chips/lpc55.rs | embassy-nxp/src/chips/lpc55.rs | pub(crate) mod _generated {
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(non_snake_case)]
#![allow(missing_docs)]
include!(concat!(env!("OUT_DIR"), "/_generated.rs"));
}
pub use _generated::*;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/lib.rs | embassy-net/src/lib.rs | #![no_std]
#![allow(async_fn_in_trait)]
#![allow(unsafe_op_in_unsafe_fn)]
#![warn(missing_docs)]
#![doc = include_str!("../README.md")]
//! ## Feature flags
#![doc = document_features::document_features!(feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#)]
#[cfg(not(any(feature = "proto... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/icmp.rs | embassy-net/src/icmp.rs | //! ICMP sockets.
use core::future::{Future, poll_fn};
use core::mem;
use core::task::{Context, Poll};
use smoltcp::iface::{Interface, SocketHandle};
pub use smoltcp::phy::ChecksumCapabilities;
use smoltcp::socket::icmp;
pub use smoltcp::socket::icmp::{Endpoint as IcmpEndpoint, PacketMetadata};
use smoltcp::wire::IpA... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | true |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/time.rs | embassy-net/src/time.rs | #![allow(unused)]
use embassy_time::{Duration, Instant};
use smoltcp::time::{Duration as SmolDuration, Instant as SmolInstant};
pub(crate) fn instant_to_smoltcp(instant: Instant) -> SmolInstant {
SmolInstant::from_micros(instant.as_micros() as i64)
}
pub(crate) fn instant_from_smoltcp(instant: SmolInstant) -> In... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/dns.rs | embassy-net/src/dns.rs | //! DNS client compatible with the `embedded-nal-async` traits.
//!
//! This exists only for compatibility with crates that use `embedded-nal-async`.
//! Prefer using [`Stack::dns_query`](crate::Stack::dns_query) directly if you're
//! not using `embedded-nal-async`.
use heapless::Vec;
pub use smoltcp::socket::dns::{D... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/udp.rs | embassy-net/src/udp.rs | //! UDP sockets.
use core::future::{Future, poll_fn};
use core::mem;
use core::task::{Context, Poll};
use smoltcp::iface::{Interface, SocketHandle};
use smoltcp::socket::udp;
pub use smoltcp::socket::udp::{PacketMetadata, UdpMetadata};
use smoltcp::wire::IpListenEndpoint;
use crate::Stack;
/// Error returned by [`U... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/raw.rs | embassy-net/src/raw.rs | //! Raw sockets.
use core::future::{Future, poll_fn};
use core::mem;
use core::task::{Context, Poll};
use embassy_net_driver::Driver;
use smoltcp::iface::{Interface, SocketHandle};
use smoltcp::socket::raw;
pub use smoltcp::socket::raw::PacketMetadata;
pub use smoltcp::wire::{IpProtocol, IpVersion};
use crate::Stack... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/tcp.rs | embassy-net/src/tcp.rs | //! TCP sockets.
//!
//! # Listening
//!
//! `embassy-net` does not have a `TcpListener`. Instead, individual `TcpSocket`s can be put into
//! listening mode by calling [`TcpSocket::accept`].
//!
//! Incoming connections when no socket is listening are rejected. To accept many incoming
//! connections, create many sock... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | true |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/driver_util.rs | embassy-net/src/driver_util.rs | use core::task::Context;
use embassy_net_driver::{Capabilities, Checksum, Driver, RxToken, TxToken};
use smoltcp::phy::{self, Medium};
use smoltcp::time::Instant;
pub(crate) struct DriverAdapter<'d, 'c, T>
where
T: Driver,
{
// must be Some when actually using this to rx/tx
pub cx: Option<&'d mut Context<... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net/src/fmt.rs | embassy-net/src/fmt.rs | #![macro_use]
#![allow(unused)]
use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-executor-timer-queue/src/lib.rs | embassy-executor-timer-queue/src/lib.rs | //! Timer queue item for embassy-executor integrated timer queues
//!
//! `embassy-executor` provides the memory needed to implement integrated timer queues. This crate
//! exists to separate that memory from `embassy-executor` itself, to decouple the timer queue's
//! release cycle from `embassy-executor`.
//!
//! Thi... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/build.rs | embassy-sync/build.rs | #[path = "./build_common.rs"]
mod common;
fn main() {
let mut cfgs = common::CfgSet::new();
common::set_target_cfgs(&mut cfgs);
}
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/build_common.rs | embassy-sync/build_common.rs | // NOTE: this file is copy-pasted between several Embassy crates, because there is no
// straightforward way to share this code:
// - it cannot be placed into the root of the repo and linked from each build.rs using `#[path =
// "../build_common.rs"]`, because `cargo publish` requires that all files published with a cr... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/lib.rs | embassy-sync/src/lib.rs | #![cfg_attr(not(feature = "std"), no_std)]
#![allow(async_fn_in_trait)]
#![allow(clippy::new_without_default)]
#![allow(unsafe_op_in_unsafe_fn)]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
// internal use
mod ring_buff... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/rwlock.rs | embassy-sync/src/rwlock.rs | //! Async read-write lock.
//!
//! This module provides a read-write lock that can be used to synchronize data between asynchronous tasks.
use core::cell::{RefCell, UnsafeCell};
use core::fmt;
use core::future::{Future, poll_fn};
use core::ops::{Deref, DerefMut};
use core::task::Poll;
use crate::blocking_mutex::Mutex ... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/mutex.rs | embassy-sync/src/mutex.rs | //! Async mutex.
//!
//! This module provides a mutex that can be used to synchronize data between asynchronous tasks.
use core::cell::{RefCell, UnsafeCell};
use core::future::{Future, poll_fn};
use core::ops::{Deref, DerefMut};
use core::task::Poll;
use core::{fmt, mem};
use crate::blocking_mutex::Mutex as BlockingMu... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/signal.rs | embassy-sync/src/signal.rs | //! A synchronization primitive for passing the latest value to a task.
use core::cell::Cell;
use core::future::{Future, poll_fn};
use core::task::{Context, Poll, Waker};
use crate::blocking_mutex::Mutex;
use crate::blocking_mutex::raw::RawMutex;
/// Single-slot signaling primitive for a _single_ consumer.
///
/// Th... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/lazy_lock.rs | embassy-sync/src/lazy_lock.rs | //! Synchronization primitive for initializing a value once, allowing others to get a reference to the value.
use core::cell::UnsafeCell;
use core::mem::ManuallyDrop;
use core::sync::atomic::{AtomicBool, Ordering};
/// The `LazyLock` is a synchronization primitive that allows for
/// initializing a value once, and al... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/watch.rs | embassy-sync/src/watch.rs | //! A synchronization primitive for passing the latest value to **multiple** receivers.
use core::cell::RefCell;
use core::future::{Future, poll_fn};
use core::marker::PhantomData;
use core::ops::{Deref, DerefMut};
use core::task::{Context, Poll};
use crate::blocking_mutex::Mutex;
use crate::blocking_mutex::raw::RawM... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | true |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/ring_buffer.rs | embassy-sync/src/ring_buffer.rs | use core::ops::Range;
#[derive(Debug)]
pub struct RingBuffer<const N: usize> {
start: usize,
end: usize,
full: bool,
}
impl<const N: usize> RingBuffer<N> {
pub const fn new() -> Self {
Self {
start: 0,
end: 0,
full: false,
}
}
pub fn push_bu... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/once_lock.rs | embassy-sync/src/once_lock.rs | //! Synchronization primitive for initializing a value once, allowing others to await a reference to the value.
use core::cell::Cell;
use core::fmt::{Debug, Formatter};
use core::future::{Future, poll_fn};
use core::mem::MaybeUninit;
use core::sync::atomic::{AtomicBool, Ordering};
use core::task::Poll;
/// The `OnceL... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/pipe.rs | embassy-sync/src/pipe.rs | //! Async byte stream pipe.
use core::cell::{RefCell, UnsafeCell};
use core::convert::Infallible;
use core::future::Future;
use core::ops::Range;
use core::pin::Pin;
use core::task::{Context, Poll};
use crate::blocking_mutex::Mutex;
use crate::blocking_mutex::raw::RawMutex;
use crate::ring_buffer::RingBuffer;
use cra... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/semaphore.rs | embassy-sync/src/semaphore.rs | //! A synchronization primitive for controlling access to a pool of resources.
use core::cell::{Cell, RefCell};
use core::convert::Infallible;
use core::future::{Future, poll_fn};
use core::task::{Poll, Waker};
use heapless::Deque;
use crate::blocking_mutex::Mutex;
use crate::blocking_mutex::raw::RawMutex;
use crate:... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/zerocopy_channel.rs | embassy-sync/src/zerocopy_channel.rs | //! A zero-copy queue for sending values between asynchronous tasks.
//!
//! It can be used concurrently by a producer (sender) and a
//! consumer (receiver), i.e. it is an "SPSC channel".
//!
//! This queue takes a Mutex type so that various
//! targets can be attained. For example, a ThreadModeMutex can be used
//! ... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/priority_channel.rs | embassy-sync/src/priority_channel.rs | //! A queue for sending values between asynchronous tasks.
//!
//! Similar to a [`Channel`](crate::channel::Channel), however [`PriorityChannel`] sifts higher priority items to the front of the queue.
//! Priority is determined by the `Ord` trait. Priority behavior is determined by the [`Kind`] parameter of the channel... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/channel.rs | embassy-sync/src/channel.rs | //! A queue for sending values between asynchronous tasks.
//!
//! It can be used concurrently by multiple producers (senders) and multiple
//! consumers (receivers), i.e. it is an "MPMC channel".
//!
//! Receivers are competing for messages. So a message that is received by
//! one receiver is not received by any oth... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | true |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/fmt.rs | embassy-sync/src/fmt.rs | #![macro_use]
#![allow(unused)]
use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/pubsub/mod.rs | embassy-sync/src/pubsub/mod.rs | //! Implementation of [PubSubChannel], a queue where published messages get received by all subscribers.
#![deny(missing_docs)]
use core::cell::RefCell;
use core::fmt::Debug;
use core::task::{Context, Poll};
use heapless::Deque;
use self::publisher::{ImmediatePub, Pub};
use self::subscriber::Sub;
use crate::blockin... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/pubsub/publisher.rs | embassy-sync/src/pubsub/publisher.rs | //! Implementation of anything directly publisher related
use core::future::Future;
use core::marker::PhantomData;
use core::ops::{Deref, DerefMut};
use core::pin::Pin;
use core::task::{Context, Poll};
use super::{PubSubBehavior, PubSubChannel};
use crate::blocking_mutex::raw::RawMutex;
/// A publisher to a channel
... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/pubsub/subscriber.rs | embassy-sync/src/pubsub/subscriber.rs | //! Implementation of anything directly subscriber related
use core::future::Future;
use core::marker::PhantomData;
use core::ops::{Deref, DerefMut};
use core::pin::Pin;
use core::task::{Context, Poll};
use super::{PubSubBehavior, PubSubChannel, WaitResult};
use crate::blocking_mutex::raw::RawMutex;
/// A subscriber... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/blocking_mutex/raw.rs | embassy-sync/src/blocking_mutex/raw.rs | //! Mutex primitives.
//!
//! This module provides a trait for mutexes that can be used in different contexts.
use core::marker::PhantomData;
/// Raw mutex trait.
///
/// This mutex is "raw", which means it does not actually contain the protected data, it
/// just implements the mutex mechanism. For most uses you shou... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/blocking_mutex/mod.rs | embassy-sync/src/blocking_mutex/mod.rs | //! Blocking mutex.
//!
//! This module provides a blocking mutex that can be used to synchronize data.
pub mod raw;
use core::cell::UnsafeCell;
use self::raw::RawMutex;
/// Blocking mutex (not async)
///
/// Provides a blocking mutual exclusion primitive backed by an implementation of [`raw::RawMutex`].
///
/// Whi... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/waitqueue/atomic_waker_turbo.rs | embassy-sync/src/waitqueue/atomic_waker_turbo.rs | use core::ptr;
use core::ptr::NonNull;
use core::sync::atomic::{AtomicPtr, Ordering};
use core::task::Waker;
/// Utility struct to register and wake a waker.
/// If a waker is registered, registering another waker will replace the previous one without waking it.
/// The intended use case is to wake tasks from interrup... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/waitqueue/multi_waker.rs | embassy-sync/src/waitqueue/multi_waker.rs | use core::task::Waker;
use heapless::Vec;
/// Utility struct to register and wake multiple wakers.
/// Queue of wakers with a maximum length of `N`.
/// Intended for waking multiple tasks.
#[derive(Debug)]
pub struct MultiWakerRegistration<const N: usize> {
wakers: Vec<Waker, N>,
}
impl<const N: usize> MultiWake... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/waitqueue/atomic_waker.rs | embassy-sync/src/waitqueue/atomic_waker.rs | use core::cell::Cell;
use core::task::Waker;
use crate::blocking_mutex::Mutex;
use crate::blocking_mutex::raw::{CriticalSectionRawMutex, RawMutex};
/// Utility struct to register and wake a waker.
/// If a waker is registered, registering another waker will replace the previous one without waking it.
/// Intended to ... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/waitqueue/mod.rs | embassy-sync/src/waitqueue/mod.rs | //! Async low-level wait queues
#[cfg_attr(feature = "turbowakers", path = "atomic_waker_turbo.rs")]
mod atomic_waker;
pub use atomic_waker::*;
mod waker_registration;
pub use waker_registration::*;
mod multi_waker;
pub use multi_waker::*;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/src/waitqueue/waker_registration.rs | embassy-sync/src/waitqueue/waker_registration.rs | use core::mem;
use core::task::Waker;
/// Utility struct to register and wake a waker.
/// If a waker is registered, registering another waker will replace the previous one.
/// The previous waker will be woken in this case, giving it a chance to reregister itself.
/// Although it is possible to wake multiple tasks th... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/tests/ui.rs | embassy-sync/tests/ui.rs | #[cfg(not(miri))]
#[test]
fn ui() {
let t = trybuild::TestCases::new();
// These test cases should fail to compile since OnceLock and LazyLock should not unconditionally implement sync
// for all types. These tests are regression tests against the following issues:
// * https://github.com/embassy-rs/em... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs | embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs | use embassy_sync::lazy_lock::LazyLock;
fn main() {
let x = 128u8;
let x_ptr: *const u8 = core::ptr::addr_of!(x);
let closure_capturing_non_sync_variable = || unsafe { core::ptr::read(x_ptr) };
check_sync(LazyLock::new(closure_capturing_non_sync_variable));
}
fn check_sync<T: Sync>(_lazy_lock: T) {}
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/tests/ui/sync_impl/lazy_lock_type.rs | embassy-sync/tests/ui/sync_impl/lazy_lock_type.rs | use embassy_sync::lazy_lock::LazyLock;
// *mut u8 is not Sync, so LazyLock should not implement Sync for this type. This should fail to compile.
static GLOBAL: LazyLock<*mut u8> = LazyLock::new(|| core::ptr::null_mut());
fn main() {}
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-sync/tests/ui/sync_impl/once_lock.rs | embassy-sync/tests/ui/sync_impl/once_lock.rs | use embassy_sync::once_lock::OnceLock;
// *mut u8 is not Sync, so OnceLock should not implement Sync for this type. This should fail to compile.
static GLOBAL: OnceLock<*mut u8> = OnceLock::new();
fn main() {}
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-adin1110/src/lib.rs | embassy-net-adin1110/src/lib.rs | #![cfg_attr(not(test), no_std)]
#![deny(clippy::pedantic)]
#![allow(async_fn_in_trait)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::missing_panics_doc)]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
// must go first!
mod fmt;
mod crc32;
mod crc8;
m... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | true |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-adin1110/src/phy.rs | embassy-net-adin1110/src/phy.rs | use crate::mdio::MdioBus;
#[allow(dead_code, non_camel_case_types, clippy::upper_case_acronyms)]
#[repr(u8)]
/// Clause 22 Registers
pub enum RegsC22 {
/// MII Control Register
CONTROL = 0x00,
/// MII Status Register
STATUS = 0x01,
/// PHY Identifier 1 Register
PHY_ID1 = 0x02,
/// PHY Ident... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-adin1110/src/crc8.rs | embassy-net-adin1110/src/crc8.rs | /// CRC-8/ITU
const CRC8X_TABLE: [u8; 256] = [
0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77, 0x7e,
0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb,
0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-adin1110/src/mdio.rs | embassy-net-adin1110/src/mdio.rs | /// PHY Address: (0..=0x1F), 5-bits long.
#[allow(dead_code)]
type PhyAddr = u8;
/// PHY Register: (0..=0x1F), 5-bits long.
#[allow(dead_code)]
type RegC22 = u8;
/// PHY Register Clause 45.
#[allow(dead_code)]
type RegC45 = u16;
/// PHY Register Value
#[allow(dead_code)]
type RegVal = u16;
#[allow(dead_code)]
const... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-adin1110/src/crc32.rs | embassy-net-adin1110/src/crc32.rs | /// CRC32 lookup table.
pub const CRC32R_LOOKUP_TABLE: [u32; 256] = [
0x0000_0000,
0x7707_3096,
0xEE0E_612C,
0x9909_51BA,
0x076D_C419,
0x706A_F48F,
0xE963_A535,
0x9E64_95A3,
0x0EDB_8832,
0x79DC_B8A4,
0xE0D5_E91E,
0x97D2_D988,
0x09B6_4C2B,
0x7EB1_7CBD,
0xE7B8_2... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-adin1110/src/fmt.rs | embassy-net-adin1110/src/fmt.rs | #![macro_use]
#![allow(unused)]
use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-adin1110/src/regs.rs | embassy-net-adin1110/src/regs.rs | use core::fmt::{Debug, Display};
use bitfield::{bitfield, bitfield_bitrange, bitfield_fields};
#[allow(missing_docs)]
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(u16)]
/// SPI REGISTER DETAILS
/// Table 38.
pub enum SpiRegisters {
IDVER... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/build.rs | embassy-usb/build.rs | use std::collections::HashMap;
use std::fmt::Write;
use std::path::PathBuf;
use std::{env, fs};
static CONFIGS: &[(&str, usize)] = &[
// BEGIN AUTOGENERATED CONFIG FEATURES
// Generated by gen_config.py. DO NOT EDIT.
("MAX_INTERFACE_COUNT", 4),
("MAX_HANDLER_COUNT", 4),
// END AUTOGENERATED CONFIG ... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/control.rs | embassy-usb/src/control.rs | //! USB control data types.
use core::mem;
use crate::driver::Direction;
/// Control request type.
#[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RequestType {
/// Request is a USB standard request. Usually handled by
/// [`UsbDevice`](c... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/msos.rs | embassy-usb/src/msos.rs | //! Microsoft OS Descriptors
//!
//! <https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-os-2-0-descriptors-specification>
use core::mem::size_of;
use crate::descriptor::{BosWriter, capability_type};
use crate::types::InterfaceNumber;
/// A serialized Microsoft OS 2.0 Descriptor set.
///
/// ... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/descriptor.rs | embassy-usb/src/descriptor.rs | //! Utilities for writing USB descriptors.
use embassy_usb_driver::EndpointType;
use crate::CONFIGURATION_VALUE;
use crate::builder::Config;
use crate::driver::EndpointInfo;
use crate::types::{InterfaceNumber, StringIndex};
/// Standard descriptor types
#[allow(missing_docs)]
pub mod descriptor_type {
pub const D... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/builder.rs | embassy-usb/src/builder.rs | use heapless::Vec;
use crate::config::MAX_HANDLER_COUNT;
use crate::descriptor::{BosWriter, DescriptorWriter, SynchronizationType, UsageType};
use crate::driver::{Driver, Endpoint, EndpointAddress, EndpointInfo, EndpointType};
use crate::msos::{DeviceLevelDescriptor, FunctionLevelDescriptor, MsOsDescriptorWriter};
use... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/lib.rs | embassy-usb/src/lib.rs | #![no_std]
#![allow(unsafe_op_in_unsafe_fn)]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
pub use embassy_usb_driver as driver;
mod builder;
pub mod class;
pub mod control;
pub mod descriptor;
mod descriptor_reader;
pu... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/descriptor_reader.rs | embassy-usb/src/descriptor_reader.rs | use crate::descriptor::descriptor_type;
use crate::driver::EndpointAddress;
use crate::types::InterfaceNumber;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct ReadError;
pub struct Reader<'a> {
data: &'a [u8],
}
impl<'a> Reader<'a> {
pub const fn ... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/types.rs | embassy-usb/src/types.rs | //! USB types.
/// A handle for a USB interface that contains its number.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(transparent)]
pub struct InterfaceNumber(pub u8);
impl InterfaceNumber {
pub(crate) const fn new(index: u8) -> InterfaceNumber {
... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/fmt.rs | embassy-usb/src/fmt.rs | #![macro_use]
#![allow(unused)]
use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/hid.rs | embassy-usb/src/class/hid.rs | //! USB HID (Human Interface Device) class implementation.
use core::mem::MaybeUninit;
use core::ops::Range;
use core::sync::atomic::{AtomicUsize, Ordering};
#[cfg(feature = "usbd-hid")]
use ssmarshal::serialize;
#[cfg(feature = "usbd-hid")]
use usbd_hid::descriptor::AsInputReport;
use crate::control::{InResponse, O... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/cdc_acm.rs | embassy-usb/src/class/cdc_acm.rs | //! CDC-ACM class implementation, aka Serial over USB.
use core::cell::{Cell, RefCell};
use core::future::{Future, poll_fn};
use core::mem::{self, MaybeUninit};
use core::sync::atomic::{AtomicBool, Ordering};
use core::task::Poll;
use embassy_sync::blocking_mutex::CriticalSectionMutex;
use embassy_sync::waitqueue::Wa... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/mod.rs | embassy-usb/src/class/mod.rs | //! Implementations of well-known USB classes.
pub mod cdc_acm;
pub mod cdc_ncm;
pub mod cmsis_dap_v2;
pub mod hid;
pub mod midi;
pub mod uac1;
pub mod web_usb;
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/midi.rs | embassy-usb/src/class/midi.rs | //! MIDI class implementation.
use crate::Builder;
use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
/// This should be used as `device_class` when building the `UsbDevice`.
pub const USB_AUDIO_CLASS: u8 = 0x01;
const USB_AUDIOCONTROL_SUBCLASS: u8 = 0x01;
const USB_MIDISTREAMING_SUBCLASS... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/cmsis_dap_v2.rs | embassy-usb/src/class/cmsis_dap_v2.rs | //! CMSIS-DAP V2 class implementation.
use core::mem::MaybeUninit;
use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
use crate::types::StringIndex;
use crate::{Builder, Handler, msos};
/// State for the CMSIS-DAP v2 USB class.
pub struct State {
control: MaybeUninit<Control>,
}
stru... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/web_usb.rs | embassy-usb/src/class/web_usb.rs | //! WebUSB API capability implementation.
//!
//! See https://wicg.github.io/webusb
use core::mem::MaybeUninit;
use crate::control::{InResponse, Recipient, Request, RequestType};
use crate::descriptor::capability_type;
use crate::driver::Driver;
use crate::{Builder, Handler};
const USB_CLASS_VENDOR: u8 = 0xff;
const... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/uac1/class_codes.rs | embassy-usb/src/class/uac1/class_codes.rs | //! Audio Device Class Codes as defined in Universal Serial Bus Device Class
//! Definition for Audio Devices, Release 1.0, Appendix A and Universal Serial
//! Bus Device Class Definition for Audio Data Formats, Release 1.0, Appendix
//! A.1.1 (Audio Data Format Type I Codes)
#![allow(dead_code)]
/// The current versi... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/uac1/speaker.rs | embassy-usb/src/class/uac1/speaker.rs | //! USB Audio Class 1.0 - Speaker device
//!
//! Provides a class with a single audio streaming interface (host to device),
//! that advertises itself as a speaker. Includes explicit sample rate feedback.
//!
//! Various aspects of the audio stream can be configured, for example:
//! - sample rate
//! - sample resoluti... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/uac1/mod.rs | embassy-usb/src/class/uac1/mod.rs | //! USB Audio Class 1.0 implementations for different applications.
//!
//! Contains:
//! - The `speaker` class with a single audio streaming interface (host to device)
pub mod speaker;
mod class_codes;
mod terminal_type;
/// The maximum supported audio channel index (corresponds to `Top`).
/// FIXME: Use `core::mem... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/uac1/terminal_type.rs | embassy-usb/src/class/uac1/terminal_type.rs | //! USB Audio Terminal Types from Universal Serial Bus Device Class Definition
//! for Terminal Types, Release 1.0
/// USB Audio Terminal Types from "Universal Serial Bus Device Class Definition
/// for Terminal Types, Release 1.0"
#[repr(u16)]
#[non_exhaustive]
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
#[allow(mis... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/cdc_ncm/embassy_net.rs | embassy-usb/src/class/cdc_ncm/embassy_net.rs | //! [`embassy-net`](https://crates.io/crates/embassy-net) driver for the CDC-NCM class.
use embassy_futures::select::{Either, select};
use embassy_net_driver_channel as ch;
use embassy_net_driver_channel::driver::LinkState;
use embassy_usb_driver::Driver;
use super::{CdcNcmClass, Receiver, Sender};
/// Internal stat... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-usb/src/class/cdc_ncm/mod.rs | embassy-usb/src/class/cdc_ncm/mod.rs | //! CDC-NCM class implementation, aka Ethernet over USB.
//!
//! # Compatibility
//!
//! Windows: NOT supported in Windows 10 (though there's apparently a driver you can install?). Supported out of the box in Windows 11.
//!
//! Linux: Well-supported since forever.
//!
//! Android: Support for CDC-NCM is spotty and var... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-time-queue-utils/build.rs | embassy-time-queue-utils/build.rs | fn main() {}
| rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-time-queue-utils/src/lib.rs | embassy-time-queue-utils/src/lib.rs | #![no_std]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
#[cfg(feature = "_generic-queue")]
pub mod queue_generic;
#[cfg(not(feature = "_generic-queue"))]
pub mod queue_integrated;
#[cfg(feature = "_generic-queue")]
pub use queue_generic::Queue;
#[cfg(not(feature = "_generic-queue"))]
pub use queue_in... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-time-queue-utils/src/queue_integrated.rs | embassy-time-queue-utils/src/queue_integrated.rs | //! Timer queue operations.
use core::cell::Cell;
use core::cmp::min;
use core::ptr::NonNull;
use core::task::Waker;
use embassy_executor_timer_queue::TimerQueueItem;
/// An item in the timer queue.
#[derive(Default)]
struct QueueItem {
/// The next item in the queue.
///
/// If this field contains `Some`... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-time-queue-utils/src/queue_generic.rs | embassy-time-queue-utils/src/queue_generic.rs | //! Generic timer queue implementations.
//!
//! Time queue drivers may use this to simplify their implementation.
use core::cmp::{Ordering, min};
use core::task::Waker;
use heapless::Vec;
#[derive(Debug)]
struct Timer {
at: u64,
waker: Waker,
}
impl PartialEq for Timer {
fn eq(&self, other: &Self) -> b... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-esp-hosted/src/control.rs | embassy-net-esp-hosted/src/control.rs | use embassy_net_driver_channel as ch;
use embassy_net_driver_channel::driver::{HardwareAddress, LinkState};
use heapless::String;
use micropb::{MessageDecode, MessageEncode, PbEncoder};
use crate::ioctl::Shared;
use crate::proto::{self, CtrlMsg};
/// Errors reported by control.
#[derive(Copy, Clone, PartialEq, Eq, De... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-esp-hosted/src/lib.rs | embassy-net-esp-hosted/src/lib.rs | #![no_std]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
#![allow(async_fn_in_trait)]
use embassy_futures::select::{Either4, select4};
use embassy_net_driver_channel as ch;
use embassy_net_driver_channel::driver::LinkState;
use embassy_time::{Duration, Instant, Timer};
use embedded_hal::digital::Output... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-esp-hosted/src/iface.rs | embassy-net-esp-hosted/src/iface.rs | use embassy_time::Timer;
use embedded_hal::digital::InputPin;
use embedded_hal_async::digital::Wait;
use embedded_hal_async::spi::SpiDevice;
/// Physical interface trait for communicating with the ESP chip.
pub trait Interface {
/// Wait for the HANDSHAKE signal indicating the ESP is ready for a new transaction.
... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
embassy-rs/embassy | https://github.com/embassy-rs/embassy/blob/f242d794e3325bc9b3559e50d2ea7fc293e1d574/embassy-net-esp-hosted/src/ioctl.rs | embassy-net-esp-hosted/src/ioctl.rs | use core::cell::RefCell;
use core::future::{Future, poll_fn};
use core::task::Poll;
use embassy_sync::waitqueue::WakerRegistration;
use crate::fmt::Bytes;
#[derive(Clone, Copy)]
pub struct PendingIoctl {
pub buf: *mut [u8],
pub req_len: usize,
}
#[derive(Clone, Copy)]
enum IoctlState {
Pending(PendingIo... | rust | Apache-2.0 | f242d794e3325bc9b3559e50d2ea7fc293e1d574 | 2026-01-04T15:48:40.485023Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.