Skip to content

Commit

Permalink
docs: document public apis of wiznet driver
Browse files Browse the repository at this point in the history
  • Loading branch information
lulf committed Dec 20, 2023
1 parent 52a801f commit 4a2dd7b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions embassy-net-wiznet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 2 additions & 0 deletions embassy-net-wiznet/src/chip/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Wiznet W5100s and W5500 family driver.
mod w5500;
pub use w5500::W5500;
mod w5100s;
Expand Down Expand Up @@ -45,4 +46,5 @@ pub(crate) mod sealed {
}
}

/// Trait for Wiznet chips.
pub trait Chip: sealed::Chip {}
1 change: 1 addition & 0 deletions embassy-net-wiznet/src/chip/w5100s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
1 change: 1 addition & 0 deletions embassy-net-wiznet/src/chip/w5500.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub enum RegisterBlock {
RxBuf = 0x03,
}

/// Wiznet W5500 chip.
pub enum W5500 {}

impl super::Chip for W5500 {}
Expand Down
2 changes: 2 additions & 0 deletions embassy-net-wiznet/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![allow(async_fn_in_trait)]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]

pub mod chip;
mod device;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 4a2dd7b

Please sign in to comment.