mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Explain the const params N_RX & N_TX in the docs of State
On chips with a low amount of ram it's easy to run out of ram. When looking at the current docs for the State struct it is not easy to see that these params can cause a lot of ram usage.
This commit is contained in:
parent
5f9bc6def7
commit
72c2b06520
@ -17,12 +17,22 @@ use embedded_hal_async::spi::SpiDevice;
|
||||
use crate::chip::Chip;
|
||||
use crate::device::WiznetDevice;
|
||||
|
||||
// If you change this update the docs of State
|
||||
const MTU: usize = 1514;
|
||||
|
||||
/// Type alias for the embassy-net driver.
|
||||
pub type Device<'d> = embassy_net_driver_channel::Device<'d, MTU>;
|
||||
|
||||
/// Internal state for the embassy-net integration.
|
||||
///
|
||||
/// The two generic arguments `N_RX` and `N_TX` set the size of the receive and
|
||||
/// send packet queue. With a the ethernet MTU of _1514_ this takes up `N_RX +
|
||||
/// NTX * 1514` bytes. While setting these both to 1 is the minimum this might
|
||||
/// hurt performance as a packet can not be received while processing another.
|
||||
///
|
||||
/// # Warning
|
||||
/// On devices with a small amount of ram (think ~64k) watch out with the size
|
||||
/// of there parameters. They will quickly use too much RAM.
|
||||
pub struct State<const N_RX: usize, const N_TX: usize> {
|
||||
ch_state: ch::State<MTU, N_RX, N_TX>,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user