Compare commits

..

No commits in common. "736d63dcad45b96634773d04c000f5ab53b78454" and "d358103664e309520765844370341462bdb2c814" have entirely different histories.

3 changed files with 2 additions and 8 deletions

View File

@ -5,9 +5,8 @@ description = "Embbeded Rust Ethernet driver for ENC424J600 Ethernet controller
authors = ["Harry Ho <hh@m-labs.hk>"] authors = ["Harry Ho <hh@m-labs.hk>"]
version = "0.1.0" version = "0.1.0"
keywords = ["ethernet", "eth", "enc424j600", "stm32", "stm32f4xx"] keywords = ["ethernet", "eth", "enc424j600", "stm32", "stm32f4xx"]
repository = "https://git.m-labs.hk/M-Labs/ENC424J600" repository = "https://github.com/smoltcp-rs/ENC424J600"
edition = "2018" edition = "2018"
license = "BSD-2-Clause"
[dependencies] [dependencies]
volatile-register = "0.2" volatile-register = "0.2"

View File

@ -16,7 +16,7 @@ pub mod tx;
pub mod smoltcp_phy; pub mod smoltcp_phy;
/// Max raw frame array size /// Max raw frame array size
pub const RAW_FRAME_LENGTH_MAX: usize = 1518; pub const RAW_FRAME_LENGTH_MAX: usize = 0x1000;
pub trait EthController { pub trait EthController {
fn init_dev(&mut self, delay: &mut impl DelayUs<u16>) -> Result<(), EthControllerError>; fn init_dev(&mut self, delay: &mut impl DelayUs<u16>) -> Result<(), EthControllerError>;
@ -29,7 +29,6 @@ pub trait EthController {
} }
/// TODO: Improve these error types /// TODO: Improve these error types
#[derive(Debug)]
pub enum EthControllerError { pub enum EthControllerError {
SpiPortError, SpiPortError,
GeneralError, GeneralError,

View File

@ -131,17 +131,13 @@ impl <SPI: Transfer<u8>,
match self.spi.transfer(&mut buf) { match self.spi.transfer(&mut buf) {
Ok(_) => { Ok(_) => {
// Disable chip select // Disable chip select
cortex_m::asm::delay(10_u32);
self.nss.set_high(); self.nss.set_high();
cortex_m::asm::delay(4_u32);
Ok(buf[2]) Ok(buf[2])
}, },
// TODO: Maybe too naive? // TODO: Maybe too naive?
Err(_) => { Err(_) => {
// Disable chip select // Disable chip select
cortex_m::asm::delay(10_u32);
self.nss.set_high(); self.nss.set_high();
cortex_m::asm::delay(4_u32);
Err(SpiPortError::TransferError) Err(SpiPortError::TransferError)
} }
} }