Skip to content

Commit 3d2fbd1

Browse files
committed
upd deps & release 0.23
1 parent a5b7cab commit 3d2fbd1

15 files changed

+119
-85
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## [v0.23.0] - 2025-09-22
11+
1012
- Implement `embedded_hal::i2c::I2c` for `I2cMasterDma` [#838]
1113
- Back to `stm32f4`
1214
- Implement `Ptr`, `Sealed`, `Steal` for generic `Periph` [#834]
@@ -1116,7 +1118,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
11161118

11171119
- Support for stm32f407 and stm32f429.
11181120

1119-
[Unreleased]: https://github.com/stm32-rs/stm32f4xx-hal/compare/v0.22.1...HEAD
1121+
[Unreleased]: https://github.com/stm32-rs/stm32f4xx-hal/compare/v0.23.0...HEAD
1122+
[v0.23.0]: https://github.com/stm32-rs/stm32f4xx-hal/compare/v0.22.1...v0.23.0
11201123
[v0.22.1]: https://github.com/stm32-rs/stm32f4xx-hal/compare/v0.22.0...v0.22.1
11211124
[v0.22.0]: https://github.com/stm32-rs/stm32f4xx-hal/compare/v0.21.0...v0.22.0
11221125
[v0.21.0]: https://github.com/stm32-rs/stm32f4xx-hal/compare/v0.20.0...v0.21.0

Cargo.toml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license = "0BSD"
1111
name = "stm32f4xx-hal"
1212
readme = "README.md"
1313
repository = "https://github.com/stm32-rs/stm32f4xx-hal"
14-
version = "0.22.1"
14+
version = "0.23.0"
1515

1616
[package.metadata.docs.rs]
1717
features = [
@@ -27,12 +27,13 @@ features = [
2727
targets = ["thumbv7em-none-eabihf"]
2828

2929
[dependencies]
30-
defmt = { version = "0.3.10", optional = true }
30+
defmt = { version = "1.0.1", optional = true }
3131
bxcan = { version = "0.8", optional = true }
3232
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
3333
cortex-m-rt = "0.7.5"
3434
nb = "1.1"
35-
rand_core = "0.6.4"
35+
rand_core_06 = { package = "rand_core", version = "0.6.4" }
36+
rand_core = "0.9.3"
3637
synopsys-usb-otg = { version = "0.4.0", features = [
3738
"cortex-m",
3839
], optional = true }
@@ -52,14 +53,14 @@ cortex-m-rtic = { version = "1.1.4", features = [
5253
"test-critical-section",
5354
], optional = true }
5455
# rtic2
55-
rtic-time = { version = "2.0", optional = true }
56+
rtic-time = { version = "2.0.1", optional = true }
5657
embedded-hal-async = { version = "1.0", optional = true }
57-
rtic = { version = "2.1.2", features = ["thumbv7-backend"], optional = true }
58+
rtic = { version = "2.2", features = ["thumbv7-backend"], optional = true }
5859
atomic-polyfill = { version = "1.0.3", optional = true }
5960

6061
stm32-fmc = { version = "0.4.0", optional = true }
6162

62-
enumflags2 = "0.7.11"
63+
enumflags2 = "0.7.12"
6364
embedded-storage = "0.3"
6465
document-features = "0.2"
6566

@@ -70,7 +71,7 @@ version = "0.16.0"
7071
features = ["atomics"]
7172

7273
[dependencies.time]
73-
version = "0.3.37"
74+
version = "0.3.44"
7475
default-features = false
7576

7677
[dependencies.embedded-hal-02]
@@ -92,27 +93,28 @@ version = "0.5.0"
9293
optional = true
9394

9495
[dev-dependencies]
95-
defmt = "0.3.4"
96-
defmt-rtt = "0.4.0"
97-
panic-probe = { version = "0.3.2", features = ["print-defmt"] }
96+
static_cell = "2.1.1"
97+
defmt = "1.0.1"
98+
defmt-rtt = "1.0"
99+
panic-probe = { version = "1.0", features = ["print-defmt"] }
98100
panic-semihosting = "0.6.0"
99101
cortex-m-semihosting = "0.5.0"
100-
heapless = "0.8"
102+
heapless = "0.9.1"
101103
panic-halt = "1.0.0"
102-
ssd1306 = "0.9.0"
104+
ssd1306 = "0.10.0"
103105
embedded-graphics = "0.8.1"
104106
embedded-graphics-07 = { package = "embedded-graphics", version = "0.7.1" }
105107
embedded-hal-bus = "0.3.0"
106108
usb-device = "0.3.1"
107109
usbd-serial = "0.2.0"
108-
micromath = "2"
110+
micromath = "2.1"
109111
dwt-systick-monotonic = "1.1"
110112
st7789 = "0.7.0"
111113
rtt-target = { version = "0.6.1" }
112114
display-interface-spi-04 = { package = "display-interface-spi", version = "0.4.1" }
113115
ist7920 = "0.1.1"
114-
smart-leds = "0.3.0"
115-
ws2812-spi = { version = "0.4.0", features = [] }
116+
smart-leds = "0.4.0"
117+
ws2812-spi = { version = "0.5.1", features = [] }
116118
hd44780-driver = "0.4.0"
117119
display-interface = "0.5"
118120
display-interface-04 = { package = "display-interface", version = "0.4.1" }

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ You also need to add some dependencies to your `Cargo.toml`:
8989

9090
```toml
9191
[dependencies]
92-
embedded-hal = "0.2"
92+
embedded-hal = "1.0"
9393
nb = "1"
9494
cortex-m = "0.7"
9595
cortex-m-rt = "0.7"
9696
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
97-
panic-halt = "0.2"
97+
panic-halt = "1.0"
9898

9999
[dependencies.stm32f4xx-hal]
100-
version = "0.22.1"
100+
version = "0.23.0"
101101
features = ["stm32f407"] # replace the model of your microcontroller here
102102
# and add other required features
103103
```

examples/ltdc-screen/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use embedded_graphics::{
1313
text::Text,
1414
};
1515

16+
use static_cell::ConstStaticCell;
1617
use stm32f4xx_hal::{
1718
ltdc::{BluePins, GreenPins, Layer, LtdcPins, PixelFormat, RedPins},
1819
pac,
@@ -28,7 +29,8 @@ const HEIGHT: u16 = 272;
2829

2930
// Graphics framebuffer
3031
const FB_GRAPHICS_SIZE: usize = (WIDTH as usize) * (HEIGHT as usize);
31-
static mut FB_LAYER1: [u16; FB_GRAPHICS_SIZE] = [0; FB_GRAPHICS_SIZE];
32+
static FB_LAYER1: ConstStaticCell<[u16; FB_GRAPHICS_SIZE]> =
33+
ConstStaticCell::new([0; FB_GRAPHICS_SIZE]);
3234

3335
#[entry]
3436
fn main() -> ! {
@@ -85,7 +87,7 @@ fn main() -> ! {
8587
let mut display = screen::Stm32F7DiscoDisplay::new(perif.LTDC, perif.DMA2D, pins);
8688
display
8789
.controller
88-
.config_layer(Layer::L1, unsafe { &mut FB_LAYER1 }, PixelFormat::RGB565);
90+
.config_layer(Layer::L1, FB_LAYER1.take(), PixelFormat::RGB565);
8991

9092
display.controller.enable_layer(Layer::L1);
9193
display.controller.reload();

examples/qspi-w25q.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct W25Q<PINS: QspiPins> {
1818
qspi: Qspi<PINS>,
1919
}
2020

21+
#[allow(unused)]
2122
pub struct DeviceId(u8);
2223

2324
impl<PINS> W25Q<PINS>

examples/rtic-dual-i2s-audio-in-out.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ mod app {
121121
#[local]
122122
struct Local {
123123
logs_chan: rtt_target::UpChannel,
124-
adc_p: Producer<'static, (i32, i32), 2>,
125-
process_c: Consumer<'static, (i32, i32), 2>,
126-
process_p: Producer<'static, (i32, i32), 2>,
127-
dac_c: Consumer<'static, (i32, i32), 2>,
124+
adc_p: Producer<'static, (i32, i32)>,
125+
process_c: Consumer<'static, (i32, i32)>,
126+
process_p: Producer<'static, (i32, i32)>,
127+
dac_c: Consumer<'static, (i32, i32)>,
128128
}
129129

130130
#[init(local = [queue_1: Queue<(i32,i32), 2> = Queue::new(),queue_2: Queue<(i32,i32), 2> = Queue::new()])]

examples/rtic-i2s-audio-in-out.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ mod app {
124124
#[local]
125125
struct Local {
126126
logs_chan: rtt_target::UpChannel,
127-
adc_p: Producer<'static, (i32, i32), 2>,
128-
process_c: Consumer<'static, (i32, i32), 2>,
129-
process_p: Producer<'static, (i32, i32), 2>,
130-
dac_c: Consumer<'static, (i32, i32), 2>,
127+
adc_p: Producer<'static, (i32, i32)>,
128+
process_c: Consumer<'static, (i32, i32)>,
129+
process_p: Producer<'static, (i32, i32)>,
130+
dac_c: Consumer<'static, (i32, i32)>,
131131
}
132132

133133
#[init(local = [queue_1: Queue<(i32,i32), 2> = Queue::new(),queue_2: Queue<(i32,i32), 2> = Queue::new()])]

examples/rtic-usb-cdc-echo.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use panic_halt as _;
55

66
#[rtic::app(device = stm32f4xx_hal::pac, peripherals = true, dispatchers = [USART1])]
77
mod app {
8+
use static_cell::{ConstStaticCell, StaticCell};
89
use stm32f4xx_hal::{
910
gpio::{Output, PC13},
1011
otg_fs::{UsbBus, UsbBusType, USB},
@@ -33,8 +34,9 @@ mod app {
3334

3435
#[init]
3536
fn init(ctx: init::Context) -> (Shared, Local, init::Monotonics) {
36-
static mut EP_MEMORY: [u32; 1024] = [0; 1024];
37-
static mut USB_BUS: Option<usb_device::bus::UsbBusAllocator<UsbBusType>> = None;
37+
static EP_MEMORY: ConstStaticCell<[u32; 1024]> = ConstStaticCell::new([0; 1024]);
38+
static USB_BUS: StaticCell<usb_device::bus::UsbBusAllocator<UsbBusType>> =
39+
StaticCell::new();
3840

3941
let dp = ctx.device;
4042

@@ -59,22 +61,17 @@ mod app {
5961
pin_dp: gpioa.pa12.into(),
6062
hclk: rcc.clocks.hclk(),
6163
};
62-
unsafe {
63-
USB_BUS.replace(UsbBus::new(usb, &mut EP_MEMORY));
64-
}
65-
66-
let usb_serial = usbd_serial::SerialPort::new(unsafe { USB_BUS.as_ref().unwrap() });
67-
let usb_dev = UsbDeviceBuilder::new(
68-
unsafe { USB_BUS.as_ref().unwrap() },
69-
UsbVidPid(0x16c0, 0x27dd),
70-
)
71-
.device_class(usbd_serial::USB_CLASS_CDC)
72-
.strings(&[StringDescriptors::default()
73-
.manufacturer("Fake Company")
74-
.product("Product")
75-
.serial_number("TEST")])
76-
.unwrap()
77-
.build();
64+
let usb_bus = USB_BUS.init(UsbBus::new(usb, EP_MEMORY.take()));
65+
66+
let usb_serial = usbd_serial::SerialPort::new(usb_bus);
67+
let usb_dev = UsbDeviceBuilder::new(usb_bus, UsbVidPid(0x16c0, 0x27dd))
68+
.device_class(usbd_serial::USB_CLASS_CDC)
69+
.strings(&[StringDescriptors::default()
70+
.manufacturer("Fake Company")
71+
.product("Product")
72+
.serial_number("TEST")])
73+
.unwrap()
74+
.build();
7875

7976
(
8077
Shared {

examples/spi-dma.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use core::cell::RefCell;
99
use cortex_m::interrupt::Mutex;
1010
use cortex_m_rt::entry;
1111
use embedded_hal_02::spi::{Mode, Phase, Polarity};
12+
use static_cell::ConstStaticCell;
1213
use stm32f4xx_hal::pac::interrupt;
1314
use stm32f4xx_hal::{
1415
dma::{config, MemoryToPeripheral, Stream4, StreamsTuple, Transfer},
@@ -105,12 +106,12 @@ fn DMA1_STREAM4() {
105106
// Its important to clear fifo errors as the transfer is paused until it is cleared
106107
transfer.clear_flags(DmaFlag::FifoError | DmaFlag::TransferComplete);
107108
if flags.is_transfer_complete() {
108-
unsafe {
109-
static mut BUFFER: [u8; ARRAY_SIZE] = [0; ARRAY_SIZE];
110-
for (i, b) in BUFFER.iter_mut().enumerate() {
111-
*b = (i + 1) as u8;
112-
}
113-
transfer.next_transfer(&mut BUFFER).unwrap();
109+
static BUFFER: ConstStaticCell<[u8; ARRAY_SIZE]> =
110+
ConstStaticCell::new([0; ARRAY_SIZE]);
111+
let buffer = BUFFER.take();
112+
for (i, b) in buffer.iter_mut().enumerate() {
113+
*b = (i + 1) as u8;
114114
}
115+
transfer.next_transfer(buffer).unwrap();
115116
}
116117
}

examples/uart-dma.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use stm32f4xx_hal::dma::{DmaFlag, PeripheralToMemory, Stream1};
88
use core::cell::RefCell;
99
use cortex_m::interrupt::Mutex;
1010
use cortex_m_rt::entry;
11+
use static_cell::ConstStaticCell;
1112
use stm32f4xx_hal::dma::config::DmaConfig;
1213
use stm32f4xx_hal::pac::Interrupt;
1314
use stm32f4xx_hal::pac::{interrupt, DMA1};
@@ -74,7 +75,8 @@ pub static G_UART3_TX: Mutex<RefCell<Option<serial::Tx<pac::USART3>>>> =
7475
Mutex::new(RefCell::new(None));
7576

7677
// dma buffer
77-
pub static mut RX_UART3_BUFFER: [u8; UART_BUFFER_SIZE] = [0; UART_BUFFER_SIZE];
78+
pub static RX_UART3_BUFFER: ConstStaticCell<[u8; UART_BUFFER_SIZE]> =
79+
ConstStaticCell::new([0; UART_BUFFER_SIZE]);
7880

7981
// a wrapper function that reads out of the uart ring buffer
8082
pub fn uart3_read_until(eol: u8) -> Option<[u8; UART_BUFFER_SIZE]> {
@@ -208,16 +210,14 @@ fn USART3() {
208210
if transfer.is_idle() {
209211
// Calc received bytes count
210212
let bytes_count = UART_BUFFER_SIZE - transfer.number_of_transfers() as usize;
211-
unsafe {
212-
let mut buffer = [0; UART_BUFFER_SIZE];
213-
match transfer.next_transfer(&mut RX_UART3_BUFFER) {
214-
Ok((b, _)) => buffer = *b,
215-
Err(_err) => {}
216-
}
217-
if let Some(ring_buffer) = G_UART3_BUFFER.borrow(cs).borrow_mut().as_mut() {
218-
for i in 0..bytes_count {
219-
ring_buffer.push(buffer[i]);
220-
}
213+
let mut buffer = [0; UART_BUFFER_SIZE];
214+
match transfer.next_transfer(RX_UART3_BUFFER.take()) {
215+
Ok((b, _)) => buffer = *b,
216+
Err(_err) => {}
217+
}
218+
if let Some(ring_buffer) = G_UART3_BUFFER.borrow(cs).borrow_mut().as_mut() {
219+
for i in 0..bytes_count {
220+
ring_buffer.push(buffer[i]);
221221
}
222222
}
223223
}

0 commit comments

Comments
 (0)