From 4a2dd7b944a4b81afdba6a4b1648f2c938d51096 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Wed, 20 Dec 2023 12:14:25 +0100 Subject: [PATCH] docs: document public apis of wiznet driver --- embassy-net-wiznet/Cargo.toml | 1 + embassy-net-wiznet/src/chip/mod.rs | 2 ++ embassy-net-wiznet/src/chip/w5100s.rs | 1 + embassy-net-wiznet/src/chip/w5500.rs | 1 + embassy-net-wiznet/src/lib.rs | 2 ++ 5 files changed, 7 insertions(+) diff --git a/embassy-net-wiznet/Cargo.toml b/embassy-net-wiznet/Cargo.toml index a1f0b0c51..f628d8bd1 100644 --- a/embassy-net-wiznet/Cargo.toml +++ b/embassy-net-wiznet/Cargo.toml @@ -6,6 +6,7 @@ keywords = ["embedded", "wiznet", "embassy-net", "embedded-hal-async", "ethernet categories = ["embedded", "hardware-support", "no-std", "network-programming", "async"] license = "MIT OR Apache-2.0" edition = "2021" +repository = "https://github.com/embassy-rs/embassy" [dependencies] embedded-hal = { version = "1.0.0-rc.3" } diff --git a/embassy-net-wiznet/src/chip/mod.rs b/embassy-net-wiznet/src/chip/mod.rs index 562db515a..b987c2b36 100644 --- a/embassy-net-wiznet/src/chip/mod.rs +++ b/embassy-net-wiznet/src/chip/mod.rs @@ -1,3 +1,4 @@ +//! Wiznet W5100s and W5500 family driver. mod w5500; pub use w5500::W5500; mod w5100s; @@ -45,4 +46,5 @@ pub(crate) mod sealed { } } +/// Trait for Wiznet chips. pub trait Chip: sealed::Chip {} diff --git a/embassy-net-wiznet/src/chip/w5100s.rs b/embassy-net-wiznet/src/chip/w5100s.rs index 07a840370..7d328bce5 100644 --- a/embassy-net-wiznet/src/chip/w5100s.rs +++ b/embassy-net-wiznet/src/chip/w5100s.rs @@ -4,6 +4,7 @@ const SOCKET_BASE: u16 = 0x400; const TX_BASE: u16 = 0x4000; const RX_BASE: u16 = 0x6000; +/// Wizard W5100S chip. pub enum W5100S {} impl super::Chip for W5100S {} diff --git a/embassy-net-wiznet/src/chip/w5500.rs b/embassy-net-wiznet/src/chip/w5500.rs index 61e512946..16236126d 100644 --- a/embassy-net-wiznet/src/chip/w5500.rs +++ b/embassy-net-wiznet/src/chip/w5500.rs @@ -8,6 +8,7 @@ pub enum RegisterBlock { RxBuf = 0x03, } +/// Wiznet W5500 chip. pub enum W5500 {} impl super::Chip for W5500 {} diff --git a/embassy-net-wiznet/src/lib.rs b/embassy-net-wiznet/src/lib.rs index f26f2bbb7..da70d22bd 100644 --- a/embassy-net-wiznet/src/lib.rs +++ b/embassy-net-wiznet/src/lib.rs @@ -1,6 +1,7 @@ #![no_std] #![allow(async_fn_in_trait)] #![doc = include_str!("../README.md")] +#![warn(missing_docs)] pub mod chip; mod device; @@ -47,6 +48,7 @@ pub struct Runner<'d, C: Chip, SPI: SpiDevice, INT: Wait, RST: OutputPin> { /// You must call this in a background task for the driver to operate. impl<'d, C: Chip, SPI: SpiDevice, INT: Wait, RST: OutputPin> Runner<'d, C, SPI, INT, RST> { + /// Run the driver. pub async fn run(mut self) -> ! { let (state_chan, mut rx_chan, mut tx_chan) = self.ch.split(); let mut tick = Ticker::every(Duration::from_millis(500));