aboutsummaryrefslogtreecommitdiff
path: root/cyw43/src/lib.rs
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2023-12-19 16:08:06 +0100
committerUlf Lilleengen <[email protected]>2023-12-19 16:08:06 +0100
commit39c166ef9b754c5caa44ef4dd4a4e216078dbcea (patch)
treecece1955c41b80d92bd8056cc265a91cf3d0cf79 /cyw43/src/lib.rs
parent5e76c8b41a05c89652a6c53061107482adc4125f (diff)
docs: document public apis for cyw43 driver
Diffstat (limited to 'cyw43/src/lib.rs')
-rw-r--r--cyw43/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/cyw43/src/lib.rs b/cyw43/src/lib.rs
index 300465e36..19b0cb194 100644
--- a/cyw43/src/lib.rs
+++ b/cyw43/src/lib.rs
@@ -2,6 +2,8 @@
2#![no_main] 2#![no_main]
3#![allow(async_fn_in_trait)] 3#![allow(async_fn_in_trait)]
4#![deny(unused_must_use)] 4#![deny(unused_must_use)]
5#![doc = include_str!("../README.md")]
6#![warn(missing_docs)]
5 7
6// This mod MUST go first, so that the others see its macros. 8// This mod MUST go first, so that the others see its macros.
7pub(crate) mod fmt; 9pub(crate) mod fmt;
@@ -102,6 +104,7 @@ const CHIP: Chip = Chip {
102 chanspec_ctl_sb_mask: 0x0700, 104 chanspec_ctl_sb_mask: 0x0700,
103}; 105};
104 106
107/// Driver state.
105pub struct State { 108pub struct State {
106 ioctl_state: IoctlState, 109 ioctl_state: IoctlState,
107 ch: ch::State<MTU, 4, 4>, 110 ch: ch::State<MTU, 4, 4>,
@@ -109,6 +112,7 @@ pub struct State {
109} 112}
110 113
111impl State { 114impl State {
115 /// Create new driver state holder.
112 pub fn new() -> Self { 116 pub fn new() -> Self {
113 Self { 117 Self {
114 ioctl_state: IoctlState::new(), 118 ioctl_state: IoctlState::new(),
@@ -118,6 +122,7 @@ impl State {
118 } 122 }
119} 123}
120 124
125/// Power management modes.
121#[derive(Debug, Clone, Copy, PartialEq, Eq)] 126#[derive(Debug, Clone, Copy, PartialEq, Eq)]
122pub enum PowerManagementMode { 127pub enum PowerManagementMode {
123 /// Custom, officially unsupported mode. Use at your own risk. 128 /// Custom, officially unsupported mode. Use at your own risk.
@@ -203,8 +208,13 @@ impl PowerManagementMode {
203 } 208 }
204} 209}
205 210
211/// Embassy-net driver.
206pub type NetDriver<'a> = ch::Device<'a, MTU>; 212pub type NetDriver<'a> = ch::Device<'a, MTU>;
207 213
214/// Create a new instance of the CYW43 driver.
215///
216/// Returns a handle to the network device, control handle and a runner for driving the low level
217/// stack.
208pub async fn new<'a, PWR, SPI>( 218pub async fn new<'a, PWR, SPI>(
209 state: &'a mut State, 219 state: &'a mut State,
210 pwr: PWR, 220 pwr: PWR,