Skip to content

Commit 3921129

Browse files
committed
update staging 0.18
1 parent 585dd0f commit 3921129

File tree

8 files changed

+57
-39
lines changed

8 files changed

+57
-39
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
## [Unreleased]
99

1010
- Use `write` instead of `modify` to clear flags
11-
- Bump `stm32f4-staging`
11+
- Bump `stm32f4-staging` to 0.18, update other dependencies
1212

1313
## [v0.22.1] - 2024-11-03
1414

Cargo.toml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ features = [
2727
targets = ["thumbv7em-none-eabihf"]
2828

2929
[dependencies]
30-
defmt = { version = "0.3.5", optional = true }
31-
bxcan = { version = "0.7", optional = true }
30+
defmt = { version = "0.3.10", optional = true }
31+
bxcan = { version = "0.8", optional = true }
3232
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
33-
cortex-m-rt = "0.7.3"
33+
cortex-m-rt = "0.7.5"
3434
nb = "1.1"
3535
rand_core = "0.6.4"
3636
synopsys-usb-otg = { version = "0.4.0", features = [
@@ -54,24 +54,24 @@ cortex-m-rtic = { version = "1.1.4", features = [
5454
# rtic2
5555
rtic-time = { version = "2.0", optional = true }
5656
embedded-hal-async = { version = "1.0", optional = true }
57-
rtic = { version = "2.0.1", features = ["thumbv7-backend"], optional = true }
57+
rtic = { version = "2.1.2", features = ["thumbv7-backend"], optional = true }
5858
atomic-polyfill = { version = "1.0.3", optional = true }
5959

60-
stm32-fmc = { version = "0.3.2", optional = true }
60+
stm32-fmc = { version = "0.4.0", optional = true }
6161

62-
enumflags2 = "0.7.8"
62+
enumflags2 = "0.7.11"
6363
embedded-storage = "0.3"
6464
document-features = "0.2"
6565

6666
micromath = { version = "2.1.0", optional = true }
6767

6868
[dependencies.stm32f4]
6969
package = "stm32f4-staging"
70-
version = "0.17.0"
70+
version = "0.18.0"
7171
features = ["atomics"]
7272

7373
[dependencies.time]
74-
version = "0.3.14"
74+
version = "0.3.37"
7575
default-features = false
7676

7777
[dependencies.embedded-hal-02]
@@ -95,21 +95,22 @@ optional = true
9595
[dev-dependencies]
9696
defmt = "0.3.4"
9797
defmt-rtt = "0.4.0"
98-
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
98+
panic-probe = { version = "0.3.2", features = ["print-defmt"] }
9999
panic-semihosting = "0.6.0"
100100
cortex-m-semihosting = "0.5.0"
101101
heapless = "0.8"
102-
panic-halt = "0.2.0"
103-
ssd1306 = "0.8.4"
102+
panic-halt = "1.0.0"
103+
ssd1306 = "0.9.0"
104104
embedded-graphics = "0.8.1"
105105
embedded-graphics-07 = { package = "embedded-graphics", version = "0.7.1" }
106+
embedded-hal-bus = "0.3.0"
106107
usb-device = "0.3.1"
107108
usbd-serial = "0.2.0"
108109
micromath = "2"
109110
dwt-systick-monotonic = "1.1"
110111
st7789 = "0.7.0"
111-
rtt-target = { version = "0.5.0" }
112-
display-interface-spi = "0.4.1"
112+
rtt-target = { version = "0.6.1" }
113+
display-interface-spi-04 = { package = "display-interface-spi", version = "0.4.1" }
113114
ist7920 = "0.1.1"
114115
smart-leds = "0.3.0"
115116
ws2812-spi = { version = "0.4.0", features = [] }
@@ -118,7 +119,7 @@ display-interface = "0.5"
118119
display-interface-04 = { package = "display-interface", version = "0.4.1" }
119120
ft6x06 = "0.1.2"
120121
otm8009a = "0.1"
121-
ushell = "0.3.5"
122+
ushell = "0.3.6"
122123

123124
[dev-dependencies.time]
124125
version = "0.3"
@@ -144,9 +145,9 @@ stm32f412 = ["stm32f4/stm32f412", "gpio-f412"]
144145
stm32f413 = ["stm32f4/stm32f413", "gpio-f413"]
145146
stm32f423 = ["stm32f4/stm32f413", "gpio-f413", "aes"]
146147
stm32f427 = ["stm32f4/stm32f427", "gpio-f427", "fsmc"]
147-
stm32f429 = ["stm32f4/stm32f429", "gpio-f427", "fmc"]
148+
stm32f429 = ["stm32f4/stm32f429", "gpio-f427", "fmc", "ltdc"]
148149
stm32f437 = ["stm32f4/stm32f427", "gpio-f427", "fsmc", "cryp"]
149-
stm32f439 = ["stm32f4/stm32f429", "gpio-f427", "fmc", "cryp"]
150+
stm32f439 = ["stm32f4/stm32f429", "gpio-f427", "fmc", "cryp", "ltdc"]
150151
stm32f446 = ["stm32f4/stm32f446", "gpio-f446"]
151152
stm32f469 = ["stm32f4/stm32f469", "gpio-f469"]
152153
stm32f479 = ["stm32f4/stm32f469", "gpio-f469", "cryp"]
@@ -335,7 +336,6 @@ gpio-f427 = [
335336
"dma2d",
336337
"eth",
337338
"i2c3",
338-
"ltdc",
339339
"otg-fs",
340340
"otg-hs",
341341
"rng",

examples/analog-stopwatch-with-spi-ssd1306.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ use crate::hal::{
1919
timer::{CounterUs, Event, FTimer, Flag, Timer},
2020
};
2121

22-
use core::cell::{Cell, RefCell};
2322
use core::fmt::Write;
2423
use core::ops::DerefMut;
24+
use core::{
25+
cell::{Cell, RefCell},
26+
convert::Infallible,
27+
};
2528
use cortex_m::interrupt::{free, CriticalSection, Mutex};
2629
use heapless::String;
2730

@@ -34,6 +37,7 @@ use embedded_graphics::{
3437
primitives::{Circle, Line, PrimitiveStyle, PrimitiveStyleBuilder},
3538
text::Text,
3639
};
40+
use embedded_hal_bus::spi::ExclusiveDevice;
3741
use micromath::F32Ext;
3842

3943
use ssd1306::{prelude::*, Ssd1306};
@@ -61,6 +65,19 @@ enum StopwatchState {
6165
Stopped,
6266
}
6367

68+
struct DummyPin;
69+
impl embedded_hal::digital::ErrorType for DummyPin {
70+
type Error = Infallible;
71+
}
72+
impl embedded_hal::digital::OutputPin for DummyPin {
73+
fn set_high(&mut self) -> Result<(), Self::Error> {
74+
Ok(())
75+
}
76+
fn set_low(&mut self) -> Result<(), Self::Error> {
77+
Ok(())
78+
}
79+
}
80+
6481
#[entry]
6582
fn main() -> ! {
6683
let mut dp = pac::Peripherals::take().unwrap();
@@ -117,7 +134,8 @@ fn main() -> ! {
117134
ss.set_low();
118135

119136
// Set up the display
120-
let interface = SPIInterfaceNoCS::new(spi, dc);
137+
let spi_device = ExclusiveDevice::new_no_delay(spi, DummyPin).unwrap();
138+
let interface = SPIInterface::new(spi_device, dc);
121139
let mut disp = Ssd1306::new(interface, DisplaySize128x64, DisplayRotation::Rotate0)
122140
.into_buffered_graphics_mode();
123141
disp.init().unwrap();

examples/ist7920-bidi-normal-spi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::hal::{pac, prelude::*, timer::Timer};
1111

1212
use hal::spi::{Mode, Phase, Polarity};
1313

14-
use display_interface_spi::SPIInterface;
14+
use display_interface_spi_04::SPIInterface;
1515
use ist7920::Ist7920;
1616

1717
#[entry]

examples/stopwatch-with-ssd1306-and-interrupts-and-dma-i2c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use core::ops::DerefMut;
3838
use core::sync::atomic::{AtomicBool, Ordering};
3939
use cortex_m::interrupt::{free, CriticalSection, Mutex};
4040
use cortex_m_rt::entry;
41-
use display_interface_04::{DataFormat, DisplayError, WriteOnlyDataCommand};
41+
use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
4242
use embedded_graphics::{
4343
mono_font::{
4444
ascii::{FONT_6X12, FONT_9X15},

src/dsi.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl DsiHost {
175175
dsi.wrpcr().modify(|_, w| w.regen().set_bit());
176176
// Wait for it to be ready
177177
block_with_timeout(
178-
|| dsi.wisr().read().rrs() == false,
178+
|| dsi.wisr().read().rrs().bit_is_clear(),
179179
DSI_TIMEOUT_MS,
180180
cycles_1ms,
181181
Error::RegTimeout,
@@ -201,7 +201,7 @@ impl DsiHost {
201201
cortex_m::asm::delay(cycles_1ms / 2);
202202
// Wait for the lock
203203
block_with_timeout(
204-
|| dsi.wisr().read().pllls() == false,
204+
|| dsi.wisr().read().pllls().bit_is_clear(),
205205
DSI_TIMEOUT_MS,
206206
cycles_1ms,
207207
Error::PllTimeout,
@@ -221,7 +221,7 @@ impl DsiHost {
221221
);
222222

223223
// Configure the number of active data lanes
224-
dsi.pcconfr()
224+
dsi.pconfr()
225225
.modify(|_, w| unsafe { w.nl().bits(dsi_config.lane_count as u8) }); // 0b00 - 1 lanes, 0b01 - 2 lanes
226226

227227
// Set TX escape clock division factor
@@ -244,7 +244,7 @@ impl DsiHost {
244244
/ odf;
245245
let f_pix_khz = f_phy_hz / 1_000 / 8;
246246
let uix4 = 4_000_000_000 / f_phy_hz;
247-
dsi.wpcr1()
247+
dsi.wpcr0()
248248
.modify(|_, w| unsafe { w.uix4().bits(uix4 as u8) });
249249

250250
match dsi_config.interrupts {
@@ -474,12 +474,12 @@ impl DsiHost {
474474
w.lp2hs_time().bits(phy_timers.dataline_lp2hs)
475475
});
476476
self.dsi
477-
.pcconfr()
477+
.pconfr()
478478
.modify(|_, w| unsafe { w.sw_time().bits(phy_timers.stop_wait_time) });
479479
}
480480

481481
pub fn force_rx_low_power(&mut self, force: bool) {
482-
self.dsi.wpcr2().modify(|_, w| w.flprxlpm().bit(force));
482+
self.dsi.wpcr1().modify(|_, w| w.flprxlpm().bit(force));
483483
}
484484

485485
fn long_write(&mut self, cmd: u8, buf: &[u8], ghcr_dt: u8) -> Result<(), Error> {
@@ -588,7 +588,7 @@ impl DsiHostCtrlIo for DsiHost {
588588
// debug!("DSI write: {:x?}", kind);
589589
// wait for command fifo to be empty
590590
block_with_timeout(
591-
|| self.dsi.gpsr().read().cmdfe() == false,
591+
|| self.dsi.gpsr().read().cmdfe().bit_is_clear(),
592592
DSI_TIMEOUT_MS,
593593
self.cycles_1ms,
594594
Error::FifoTimeout,

src/i2c.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,14 @@ impl<I2C: Instance> I2c<I2C> {
287287
Address::Seven(addr) => {
288288
self.i2c
289289
.dr()
290-
.write(|w| unsafe { w.bits(u32::from(addr) << 1) });
290+
.write(|w| unsafe { w.bits(u16::from(addr) << 1) });
291291
}
292292
Address::Ten(addr) => {
293293
let [msbs, lsbs] = addr.to_be_bytes();
294294
let msbs = ((msbs & 0b11) << 1) & 0b11110000;
295295
let dr = self.i2c.dr();
296-
dr.write(|w| unsafe { w.bits(u32::from(msbs)) });
297-
dr.write(|w| unsafe { w.bits(u32::from(lsbs)) });
296+
dr.write(|w| unsafe { w.bits(u16::from(msbs)) });
297+
dr.write(|w| unsafe { w.bits(u16::from(lsbs)) });
298298
}
299299
}
300300

@@ -348,20 +348,20 @@ impl<I2C: Instance> I2c<I2C> {
348348
Address::Seven(addr) => {
349349
self.i2c
350350
.dr()
351-
.write(|w| unsafe { w.bits((u32::from(addr) << 1) | 1) });
351+
.write(|w| unsafe { w.bits((u16::from(addr) << 1) | 1) });
352352
}
353353
Address::Ten(addr) => {
354354
let [msbs, lsbs] = addr.to_be_bytes();
355355
let msbs = ((msbs & 0b11) << 1) | 0b11110000;
356356
let dr = self.i2c.dr();
357357
if first_transaction {
358-
dr.write(|w| unsafe { w.bits(u32::from(msbs)) });
359-
dr.write(|w| unsafe { w.bits(u32::from(lsbs)) });
358+
dr.write(|w| unsafe { w.bits(u16::from(msbs)) });
359+
dr.write(|w| unsafe { w.bits(u16::from(lsbs)) });
360360
}
361361
self.i2c.cr1().modify(|_, w| w.start().set_bit());
362362
// Wait until START condition was generated
363363
while self.i2c.sr1().read().sb().bit_is_clear() {}
364-
dr.write(|w| unsafe { w.bits(u32::from(msbs | 1)) });
364+
dr.write(|w| unsafe { w.bits(u16::from(msbs | 1)) });
365365
}
366366
}
367367

@@ -401,7 +401,7 @@ impl<I2C: Instance> I2c<I2C> {
401401
{}
402402

403403
// Push out a byte of data
404-
self.i2c.dr().write(|w| unsafe { w.bits(u32::from(byte)) });
404+
self.i2c.dr().write(|w| unsafe { w.bits(u16::from(byte)) });
405405

406406
// Wait until byte is transferred
407407
// Check for any potential error conditions.

src/i2c/dma.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,9 @@ where
460460
fn send_address(&mut self, addr: u8, read: bool) -> Result<(), super::Error> {
461461
let i2c = &self.hal_i2c.i2c;
462462

463-
let mut to_send_addr = u32::from(addr) << 1;
463+
let mut to_send_addr = u16::from(addr) << 1;
464464
if read {
465-
to_send_addr += 1;
465+
to_send_addr |= 1;
466466
}
467467

468468
// Set up current address, we're trying to talk to

0 commit comments

Comments
 (0)