Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 8e80a8d

Browse files
committed
update esp8266
1 parent c051020 commit 8e80a8d

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ readme = "README.md"
1010

1111
[dependencies]
1212
embedded-hal = { version = "0.2", features = ["unproven"] }
13-
esp8266 = "0.3"
13+
esp8266 = "0.4"
1414
nb = "1"
1515
void = { version = "1", default-features = false }
1616
xtensa-lx-rt = { version = "0.7", optional = true, features = ["lx106"] }
@@ -27,6 +27,7 @@ interrupt = ["paste"]
2727

2828
[profile.dev]
2929
lto = true
30+
opt-level = 1
3031

3132
[profile.release]
3233
lto = true

examples/enc28j60.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use esp8266_hal::target::Peripherals;
2828
use panic_halt as _;
2929
use smoltcp::iface::{EthernetInterfaceBuilder, NeighborCache};
3030
use smoltcp::socket::{SocketSet, TcpSocket, TcpSocketBuffer};
31-
use smoltcp::time::{Instant};
31+
use smoltcp::time::Instant;
3232
use smoltcp::wire;
3333
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address};
3434

@@ -85,7 +85,7 @@ fn main() -> ! {
8585
7 * KB,
8686
MAC.0,
8787
)
88-
.unwrap()
88+
.unwrap()
8989
};
9090

9191
// LED on after initialization

src/spi.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl SPI1Master {
6161
mosi,
6262
};
6363

64-
spi.spi.spi_ctrl.write_with_zero(|w| w);
64+
unsafe { spi.spi.spi_ctrl.write_with_zero(|w| w) };
6565
spi.set_frequency(frequency);
6666
spi.spi.spi_user.write(|w| {
6767
w.spi_usr_mosi()
@@ -72,7 +72,7 @@ impl SPI1Master {
7272
.set_bit()
7373
});
7474
spi.set_data_bits(8);
75-
spi.spi.spi_ctrl1.write_with_zero(|w| w);
75+
unsafe { spi.spi.spi_ctrl1.write_with_zero(|w| w) };
7676

7777
spi
7878
}
@@ -108,21 +108,25 @@ impl SPI1Master {
108108
iomux
109109
.io_mux_conf
110110
.modify(|_, w| w.spi1_clk_equ_sys_clk().set_bit());
111-
self.spi
112-
.spi_clock
113-
.write_with_zero(|w| w.spi_clk_equ_sysclk().set_bit());
111+
unsafe {
112+
self.spi
113+
.spi_clock
114+
.write_with_zero(|w| w.spi_clk_equ_sysclk().set_bit())
115+
};
114116
} else {
115117
iomux
116118
.io_mux_conf
117119
.modify(|_, w| w.spi1_clk_equ_sys_clk().clear_bit());
118-
self.spi.spi_clock.write_with_zero(|w| unsafe {
119-
w.spi_clkcnt_n()
120-
.bits(frequency as u8 - 1)
121-
.spi_clkcnt_h()
122-
.bits((frequency as u8) / 2 - 1)
123-
.spi_clkcnt_l()
124-
.bits((frequency as u8 - 1) & 0x40)
125-
});
120+
unsafe {
121+
self.spi.spi_clock.write_with_zero(|w| {
122+
w.spi_clkcnt_n()
123+
.bits(frequency as u8 - 1)
124+
.spi_clkcnt_h()
125+
.bits((frequency as u8) / 2 - 1)
126+
.spi_clkcnt_l()
127+
.bits((frequency as u8 - 1) & 0x40)
128+
})
129+
};
126130
}
127131
}
128132

0 commit comments

Comments
 (0)