examples: Update

fix-visibility
Harry Ho 2021-06-04 10:28:30 +08:00
parent 1dbe5861f0
commit 41ea7c3b3f
2 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@ use stm32f4xx_hal::{
spi::Spi, spi::Spi,
time::Hertz time::Hertz
}; };
use enc424j600::smoltcp_phy; use enc424j600::SmoltcpDevice;
use smoltcp::wire::{ use smoltcp::wire::{
EthernetAddress, IpAddress, IpCidr, Ipv6Cidr EthernetAddress, IpAddress, IpCidr, Ipv6Cidr
@ -100,7 +100,7 @@ const APP: () = {
struct Resources { struct Resources {
eth_iface: EthernetInterface< eth_iface: EthernetInterface<
'static, 'static,
smoltcp_phy::SmoltcpDevice<SpiEth>>, SmoltcpDevice<SpiEth>>,
itm: ITM itm: ITM
} }
@ -148,8 +148,8 @@ const APP: () = {
let mut spi_eth = { let mut spi_eth = {
let spi_eth_port = Spi::spi1( let spi_eth_port = Spi::spi1(
spi1, (spi1_sck, spi1_miso, spi1_mosi), spi1, (spi1_sck, spi1_miso, spi1_mosi),
enc424j600::spi::interfaces::SPI_MODE, enc424j600::SpiInterfaces::SPI_MODE,
Hertz(enc424j600::spi::interfaces::SPI_CLOCK_FREQ), Hertz(enc424j600::SpiInterfaces::SPI_CLOCK_FREQ),
clocks); clocks);
SpiEth::new(spi_eth_port, spi1_nss) SpiEth::new(spi_eth_port, spi1_nss)
@ -186,7 +186,7 @@ const APP: () = {
// Init smoltcp interface // Init smoltcp interface
let eth_iface = { let eth_iface = {
let device = smoltcp_phy::SmoltcpDevice::new(spi_eth); let device = SmoltcpDevice::new(spi_eth);
let store = unsafe { &mut NET_STORE }; let store = unsafe { &mut NET_STORE };
store.ip_addrs[0] = IpCidr::new(IpAddress::v4(192, 168, 1, 77), 24); store.ip_addrs[0] = IpCidr::new(IpAddress::v4(192, 168, 1, 77), 24);

View File

@ -79,8 +79,8 @@ const APP: () = {
let mut spi_eth = { let mut spi_eth = {
let spi_eth_port = Spi::spi1( let spi_eth_port = Spi::spi1(
spi1, (spi1_sck, spi1_miso, spi1_mosi), spi1, (spi1_sck, spi1_miso, spi1_mosi),
enc424j600::spi::interfaces::SPI_MODE, enc424j600::SpiInterfaces::SPI_MODE,
Hertz(enc424j600::spi::interfaces::SPI_CLOCK_FREQ), Hertz(enc424j600::SpiInterfaces::SPI_CLOCK_FREQ),
clocks); clocks);
SpiEth::new(spi_eth_port, spi1_nss) SpiEth::new(spi_eth_port, spi1_nss)
@ -137,7 +137,7 @@ const APP: () = {
0x00, 0x00, 0x00, 0x00, 0x69, 0xd0, 0x85, 0x9f 0x00, 0x00, 0x00, 0x00, 0x69, 0xd0, 0x85, 0x9f
]; ];
loop { loop {
let mut eth_tx_packet = enc424j600::tx::TxPacket::new(); let mut eth_tx_packet = enc424j600::TxPacket::new();
eth_tx_packet.update_frame(&eth_tx_dat, 64); eth_tx_packet.update_frame(&eth_tx_dat, 64);
iprint!(stim0, iprint!(stim0,
"Sending packet (len={:}): ", eth_tx_packet.get_frame_length()); "Sending packet (len={:}): ", eth_tx_packet.get_frame_length());