Remove cortex-m dependencies for delay #2
|
@ -180,7 +180,7 @@ const APP: () = {
|
|||
|
||||
// Read MAC
|
||||
let mut eth_mac_addr: [u8; 6] = [0; 6];
|
||||
spi_eth.read_from_mac(&mut eth_mac_addr).unwrap();
|
||||
spi_eth.read_from_mac(&mut eth_mac_addr);
|
||||
|
||||
for i in 0..6 {
|
||||
let byte = eth_mac_addr[i];
|
||||
match i {
|
||||
|
@ -192,8 +192,8 @@ const APP: () = {
|
|||
}
|
||||
|
||||
// Init Rx/Tx buffers
|
||||
spi_eth.init_rxbuf().unwrap();
|
||||
spi_eth.init_txbuf().unwrap();
|
||||
spi_eth.init_rxbuf();
|
||||
spi_eth.init_txbuf();
|
||||
iprintln!(stim0, "Ethernet controller initialized");
|
||||
|
||||
// Init smoltcp interface
|
||||
|
|
|
@ -102,7 +102,7 @@ const APP: () = {
|
|||
|
||||
// Read MAC
|
||||
let mut eth_mac_addr: [u8; 6] = [0; 6];
|
||||
spi_eth.read_from_mac(&mut eth_mac_addr).unwrap();
|
||||
spi_eth.read_from_mac(&mut eth_mac_addr);
|
||||
for i in 0..6 {
|
||||
let byte = eth_mac_addr[i];
|
||||
match i {
|
||||
|
@ -114,8 +114,8 @@ const APP: () = {
|
|||
}
|
||||
|
||||
// Init Rx/Tx buffers
|
||||
spi_eth.init_rxbuf().unwrap();
|
||||
spi_eth.init_txbuf().unwrap();
|
||||
spi_eth.init_rxbuf();
|
||||
spi_eth.init_txbuf();
|
||||
iprintln!(stim0, "Ethernet controller initialized");
|
||||
|
||||
init::LateResources {
|
||||
|
@ -157,7 +157,7 @@ const APP: () = {
|
|||
_ => ()
|
||||
};
|
||||
}
|
||||
c.resources.spi_eth.send_raw_packet(ð_tx_packet).unwrap();
|
||||
c.resources.spi_eth.send_raw_packet(ð_tx_packet);
|
||||
iprintln!(stim0, "Packet sent");
|
||||
c.resources.delay.delay_ms(100_u32);
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ pub struct SpiEth<SPI: Transfer<u8>,
|
|||
impl <SPI: Transfer<u8>,
|
||||
NSS: OutputPin,
|
||||
F: FnMut(u32) -> ()> SpiEth<SPI, NSS, F> {
|
||||
pub fn new(spi: SPI, nss: NSS, f: F) -> Self {
|
||||
pub fn new(spi: SPI, nss: NSS, delay_ns: F) -> Self {
|
||||
SpiEth {
|
||||
spi_port: spi::SpiPort::new(spi, nss, f),
|
||||
spi_port: spi::SpiPort::new(spi, nss, delay_ns),
|
||||
rx_buf: rx::RxBuffer::new(),
|
||||
tx_buf: tx::TxBuffer::new()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use embedded_hal::{
|
||||
blocking::{spi::Transfer},
|
||||
blocking::spi::Transfer,
|
||||
sb10q
commented
not needed not needed
|
||||
digital::v2::OutputPin,
|
||||
};
|
||||
|
||||
|
@ -68,13 +68,13 @@ impl <SPI: Transfer<u8>,
|
|||
NSS: OutputPin,
|
||||
F: FnMut(u32) -> ()> SpiPort<SPI, NSS, F> {
|
||||
// TODO: return as Result()
|
||||
pub fn new(spi: SPI, mut nss: NSS, f: F) -> Self {
|
||||
pub fn new(spi: SPI, mut nss: NSS, delay_ns: F) -> Self {
|
||||
sb10q
commented
why why ``f`` and not ``delay_ns``?
|
||||
nss.set_high();
|
||||
|
||||
SpiPort {
|
||||
spi,
|
||||
nss,
|
||||
delay_ns: f,
|
||||
delay_ns,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
unrelated change