diff options
Diffstat (limited to 'cyw43/src/lib.rs')
| -rw-r--r-- | cyw43/src/lib.rs | 10 |
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. |
| 7 | pub(crate) mod fmt; | 9 | pub(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. | ||
| 105 | pub struct State { | 108 | pub 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 | ||
| 111 | impl State { | 114 | impl 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)] |
| 122 | pub enum PowerManagementMode { | 127 | pub 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. | ||
| 206 | pub type NetDriver<'a> = ch::Device<'a, MTU>; | 212 | pub 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. | ||
| 208 | pub async fn new<'a, PWR, SPI>( | 218 | pub async fn new<'a, PWR, SPI>( |
| 209 | state: &'a mut State, | 219 | state: &'a mut State, |
| 210 | pwr: PWR, | 220 | pwr: PWR, |
