Skip to content

Commit 91ab898

Browse files
committed
Fix examples
1 parent fa59de2 commit 91ab898

File tree

4 files changed

+14
-23
lines changed

4 files changed

+14
-23
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,6 @@ jobs:
136136
use-cross: false
137137
command: build
138138
args: --target=${{ matrix.target }} --example ip-f107 --features stm32f107,smoltcp-phy,log,smoltcp/socket-tcp,smoltcp/socket-icmp,smoltcp/log,smoltcp/verbose
139-
140-
- name: cargo build f1
141-
uses: actions-rs/cargo@v1
142-
with:
143-
use-cross: false
144-
command: build
145-
args: --target=${{ matrix.target }} --features ${{ matrix.feaures }}
146139

147140
# Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
148141
#

examples/arp-smoltcp.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,7 @@ use stm32_eth::{
2828
smi,
2929
stm32::{interrupt, CorePeripherals, Peripherals, SYST},
3030
};
31-
32-
use cortex_m_semihosting::hprintln;
33-
34-
use smoltcp::wire::{
35-
ArpOperation, ArpPacket, ArpRepr, EthernetAddress, EthernetFrame, EthernetProtocol,
36-
EthernetRepr, Ipv4Address,
37-
};
38-
use stm32_eth::{Eth, EthPins, RingEntry, TxError};
31+
use stm32_eth::{EthPins, RingEntry, TxError};
3932

4033
const PHY_REG_BSR: u8 = 0x01;
4134
const PHY_REG_BSR_UP: u16 = 1 << 2;
@@ -72,8 +65,10 @@ fn main() -> ! {
7265
rx_d1: gpioc.pc5,
7366
};
7467

75-
let mut mdio = gpioa.pa2.into_alternate().set_speed(Speed::VeryHigh);
76-
let mut mdc = gpioc.pc1.into_alternate().set_speed(Speed::VeryHigh);
68+
let mut mdio = gpioa.pa2.into_alternate();
69+
mdio.set_speed(Speed::VeryHigh);
70+
let mut mdc = gpioc.pc1.into_alternate();
71+
mdc.set_speed(Speed::VeryHigh);
7772

7873
// ETH_PHY_RESET(RST#) PB2 Chip Reset (active-low)
7974
let _eth_reset = gpiob.pb2.into_push_pull_output().set_high();

examples/arp.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ fn main() -> ! {
6363
rx_d1: gpioc.pc5,
6464
};
6565

66-
let mut mdio = gpioa.pa2.into_alternate().set_speed(Speed::VeryHigh);
67-
let mut mdc = gpioc.pc1.into_alternate().set_speed(Speed::VeryHigh);
66+
let mut mdio = gpioa.pa2.into_alternate();
67+
mdio.set_speed(Speed::VeryHigh);
68+
let mut mdc = gpioc.pc1.into_alternate();
69+
mdc.set_speed(Speed::VeryHigh);
6870

6971
// ETH_PHY_RESET(RST#) PB2 Chip Reset (active-low)
7072
let _eth_reset = gpiob.pb2.into_push_pull_output().set_high();

examples/ip-f107.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use smoltcp::socket::{TcpSocket, TcpSocketBuffer};
2727
use smoltcp::time::Instant;
2828
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address};
2929

30-
use stm32_eth::{Eth, EthPins, RingEntry};
30+
use stm32_eth::{EthPins, RingEntry};
3131

3232
static mut LOGGER: HioLogger = HioLogger {};
3333

@@ -105,16 +105,17 @@ fn main() -> ! {
105105

106106
let mut rx_ring: [RingEntry<_>; 8] = Default::default();
107107
let mut tx_ring: [RingEntry<_>; 2] = Default::default();
108-
let mut eth = Eth::new(
108+
let (mut eth_dma, _eth_mac) = stm32_eth::new(
109109
p.ETHERNET_MAC,
110+
p.ETHERNET_MMC,
110111
p.ETHERNET_DMA,
111112
&mut rx_ring[..],
112113
&mut tx_ring[..],
113114
clocks,
114115
eth_pins,
115116
)
116117
.unwrap();
117-
eth.enable_interrupt();
118+
eth_dma.enable_interrupt();
118119

119120
let local_addr = Ipv4Address::new(10, 0, 0, 1);
120121
let ip_addr = IpCidr::new(IpAddress::from(local_addr), 24);
@@ -124,7 +125,7 @@ fn main() -> ! {
124125
let ethernet_addr = EthernetAddress(SRC_MAC);
125126

126127
let mut sockets: [_; 1] = Default::default();
127-
let mut iface = InterfaceBuilder::new(&mut eth, &mut sockets[..])
128+
let mut iface = InterfaceBuilder::new(&mut eth_dma, &mut sockets[..])
128129
.hardware_addr(ethernet_addr.into())
129130
.ip_addrs(&mut ip_addrs[..])
130131
.neighbor_cache(neighbor_cache)

0 commit comments

Comments
 (0)