Skip to content

Commit deb918e

Browse files
jbeaurivageianrrees
authored andcommitted
chore(atsamd-hal)!: MSRV to 1.85.1, 2024 edition
PR #875
1 parent a089676 commit deb918e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+520
-445
lines changed

atsamd-hal-macros/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
authors = ["Tethys Svensson"]
33
name = "atsamd-hal-macros"
4-
rust-version = "1.77.2"
4+
rust-version = "1.85.1"
55
version = "0.2.5"
6-
edition = "2021"
6+
edition = "2024"
77
license = "MIT OR Apache-2.0"
88
categories = ["embedded", "hardware-support", "no-std"]
99
description = "Procedural macros for the atsamd-hal library"

atsamd-hal-macros/build.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ fn load_peripheral_mapping(
251251
peripheral
252252
.only
253253
.as_ref()
254-
.map_or(true, |only| only.contains(key))
254+
.is_none_or(|only| only.contains(key))
255255
&& peripheral
256256
.except
257257
.as_ref()
258-
.map_or(true, |except| !except.contains(key))
258+
.is_none_or(|except| !except.contains(key))
259259
})
260260
.cloned();
261261
peripheral_mapping
@@ -271,9 +271,11 @@ fn load_peripheral_mapping(
271271
}
272272

273273
for (sub_peripheral_key, sub_peripheral) in peripheral_sub_mapping {
274-
assert!(peripheral_mapping
275-
.insert(sub_peripheral_key, sub_peripheral)
276-
.is_none());
274+
assert!(
275+
peripheral_mapping
276+
.insert(sub_peripheral_key, sub_peripheral)
277+
.is_none()
278+
);
277279
}
278280

279281
Ok(peripheral_mapping)

hal/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ authors = [
1313
categories = ["embedded", "hardware-support", "no-std"]
1414
description = "HAL and Peripheral access API for ATSAMD11, ATSAMD21, ATSAMD51, ATSAME51, ATSAME53 and ATSAME54 microcontrollers"
1515
documentation = "https://docs.rs/crate/atsamd-hal/"
16-
edition = "2021"
16+
edition = "2024"
1717
keywords = ["no-std", "arm", "cortex-m", "embedded-hal"]
1818
license = "MIT OR Apache-2.0"
1919
name = "atsamd-hal"
2020
readme = "README.md"
2121
repository = "https://github.com/atsamd-rs/atsamd"
22-
rust-version = "1.77.2"
22+
rust-version = "1.85.1"
2323
version = "0.22.0"
2424

2525
[package.metadata.docs.rs]

hal/src/async_hal/interrupts.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ macro_rules! declare_multiple_interrupts {
9191
$(#[$cfg])*
9292
impl $crate::async_hal::interrupts::InterruptSource for $name {
9393
unsafe fn enable() {
94-
$($crate::pac::Interrupt::$irq.enable();)+
94+
unsafe {
95+
$($crate::pac::Interrupt::$irq.enable();)+
96+
}
9597
}
9698

9799
fn disable() {
@@ -242,7 +244,9 @@ pub trait InterruptSource: crate::typelevel::Sealed {
242244

243245
impl<T: Interrupt> InterruptSource for T {
244246
unsafe fn enable() {
245-
Self::enable();
247+
unsafe {
248+
Self::enable();
249+
}
246250
}
247251

248252
fn disable() {
@@ -278,7 +282,7 @@ pub trait Interrupt: crate::typelevel::Sealed {
278282
/// Do not enable any interrupt inside a critical section.
279283
#[inline]
280284
unsafe fn enable() {
281-
Self::IRQ.enable()
285+
unsafe { Self::IRQ.enable() }
282286
}
283287

284288
/// Disable the interrupt.

hal/src/async_hal/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
//!
77
//! This module provides the basis for interacting with peripherals through
88
//! `async` APIs. Notably, in order to function correctly and wake an `await`ing
9-
//! [`Future`](core::future::Future), peripherals must be able to signal when
10-
//! their respective interrupts fire. Traditionally, the user manually writes
11-
//! their own interrupt handlers. When using `async` APIs, the peripherals
12-
//! effectively take control of their own interrupt handlers in order to wake
13-
//! tasks at the appropriate time.
9+
//! [`Future`], peripherals must be able to signal when their respective
10+
//! interrupts fire. Traditionally, the user manually writes their own interrupt
11+
//! handlers. When using `async` APIs, the peripherals effectively take control
12+
//! of their own interrupt handlers in order to wake tasks at the appropriate
13+
//! time.
1414
//!
1515
//! ## Using the `async` APIs
1616
//!
@@ -172,7 +172,7 @@ macro_rules! bind_interrupts {
172172

173173
$(
174174
#[allow(non_snake_case)]
175-
#[no_mangle]
175+
#[unsafe(no_mangle)]
176176
unsafe extern "C" fn $irq() {
177177
$(
178178
<$handler as $crate::async_hal::interrupts::Handler<$crate::async_hal::interrupts::$irq>>::on_interrupt();
@@ -225,7 +225,7 @@ macro_rules! bind_multiple_interrupts {
225225

226226
$(
227227
#[allow(non_snake_case)]
228-
#[no_mangle]
228+
#[unsafe(no_mangle)]
229229
unsafe extern "C" fn $irq() {
230230
<$handler as $crate::async_hal::interrupts::Handler<$crate::async_hal::interrupts::$int_source>>::on_interrupt();
231231
}

hal/src/delay.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Delays
22
33
use atsamd_hal_macros::hal_cfg;
4-
use cortex_m::peripheral::syst::SystClkSource;
54
use cortex_m::peripheral::SYST;
5+
use cortex_m::peripheral::syst::SystClkSource;
66

77
use crate::clock::GenericClockController;
88
use crate::ehal::delay::DelayNs;
@@ -13,7 +13,7 @@ use crate::time::Hertz;
1313
use crate::typelevel::Increment;
1414

1515
#[hal_cfg("rtc-d5x")]
16-
use crate::clock::v2::{gclk::Gclk0Id, Source};
16+
use crate::clock::v2::{Source, gclk::Gclk0Id};
1717

1818
/// System timer (SysTick) as a delay provider
1919
pub struct Delay {

hal/src/dmac/async_api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use atsamd_hal_macros::hal_cfg;
44

55
use crate::{
6-
async_hal::interrupts::{Handler, DMAC},
7-
dmac::{waker::WAKERS, TriggerSource},
6+
async_hal::interrupts::{DMAC, Handler},
7+
dmac::{TriggerSource, waker::WAKERS},
88
util::BitIter,
99
};
1010

hal/src/dmac/channel/mod.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ use core::sync::atomic;
3939
use atsamd_hal_macros::{hal_cfg, hal_macro_helper};
4040

4141
use super::{
42+
Beat, Buffer, Error,
4243
dma_controller::{ChId, PriorityLevel, TriggerAction, TriggerSource},
4344
sram::{self, DmacDescriptor},
4445
transfer::{BufferPair, Transfer},
45-
Beat, Buffer, Error,
4646
};
4747
use crate::typelevel::{Is, Sealed};
4848
use modular_bitfield::prelude::*;
@@ -351,7 +351,9 @@ impl<Id: ChId, S: Status> Channel<Id, S> {
351351
core::ptr::null_mut()
352352
};
353353

354-
write_descriptor(descriptor, source, destination, descaddr);
354+
unsafe {
355+
write_descriptor(descriptor, source, destination, descaddr);
356+
}
355357
}
356358

357359
/// Add a linked descriptor after the first descriptor in the transfer.
@@ -524,7 +526,9 @@ impl<Id: ChId> Channel<Id, Ready> {
524526
D: Buffer<Beat = S::Beat>,
525527
{
526528
Transfer::<Self, BufferPair<S, D>>::check_buffer_pair(source, dest)?;
527-
self.transfer_unchecked(source, dest, trig_src, trig_act, linked_descriptor);
529+
unsafe {
530+
self.transfer_unchecked(source, dest, trig_src, trig_act, linked_descriptor);
531+
}
528532
Ok(())
529533
}
530534

@@ -559,10 +563,12 @@ impl<Id: ChId> Channel<Id, Ready> {
559563
S: Buffer,
560564
D: Buffer<Beat = S::Beat>,
561565
{
562-
self.fill_descriptor(source, dest, false);
566+
unsafe {
567+
self.fill_descriptor(source, dest, false);
563568

564-
if let Some(next) = linked_descriptor {
565-
self.link_next(next as *mut _);
569+
if let Some(next) = linked_descriptor {
570+
self.link_next(next as *mut _);
571+
}
566572
}
567573

568574
self.configure_trigger(trig_src, trig_act);

hal/src/dmac/channel/reg.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ use core::marker::PhantomData;
1717
use paste::paste;
1818

1919
use crate::pac::{
20-
self,
20+
self, Dmac, Peripherals,
21+
dmac::{Busych, Intstatus, Pendch, Swtrigctrl},
2122
dmac::{
2223
busych::BusychSpec, intstatus::IntstatusSpec, pendch::PendchSpec,
2324
swtrigctrl::SwtrigctrlSpec,
2425
},
25-
dmac::{Busych, Intstatus, Pendch, Swtrigctrl},
26-
Dmac, Peripherals,
2726
};
2827

2928
#[hal_cfg(any("dmac-d11", "dmac-d21"))]
@@ -33,13 +32,13 @@ use pac::dmac as channel_regs;
3332
use pac::dmac::channel as channel_regs;
3433

3534
use channel_regs::{
36-
chctrla::ChctrlaSpec, chctrlb::ChctrlbSpec, chintenclr::ChintenclrSpec,
37-
chintenset::ChintensetSpec, chintflag::ChintflagSpec, chstatus::ChstatusSpec,
35+
Chctrla, Chctrlb, Chintenclr, Chintenset, Chintflag, Chstatus, chctrla::ChctrlaSpec,
36+
chctrlb::ChctrlbSpec, chintenclr::ChintenclrSpec, chintenset::ChintensetSpec,
37+
chintflag::ChintflagSpec, chstatus::ChstatusSpec,
3838
};
39-
use channel_regs::{Chctrla, Chctrlb, Chintenclr, Chintenset, Chintflag, Chstatus};
4039

4140
#[hal_cfg("dmac-d5x")]
42-
use pac::dmac::channel::{chprilvl::ChprilvlSpec, Chprilvl};
41+
use pac::dmac::channel::{Chprilvl, chprilvl::ChprilvlSpec};
4342

4443
//==============================================================================
4544
// RegisterBlock

hal/src/dmac/dma_controller.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,11 @@ impl<T> DmaController<T> {
293293
pub fn into_future<I>(self, _interrupts: I) -> DmaController<I>
294294
where
295295
I: crate::async_hal::interrupts::Binding<
296-
crate::async_hal::interrupts::DMAC,
297-
super::async_api::InterruptHandler,
298-
>,
296+
crate::async_hal::interrupts::DMAC,
297+
super::async_api::InterruptHandler,
298+
>,
299299
{
300-
use crate::async_hal::interrupts::{InterruptSource, DMAC};
300+
use crate::async_hal::interrupts::{DMAC, InterruptSource};
301301

302302
DMAC::unpend();
303303
unsafe { DMAC::enable() };
@@ -320,9 +320,9 @@ impl<T> DmaController<T> {
320320
impl<I> DmaController<I>
321321
where
322322
I: crate::async_hal::interrupts::Binding<
323-
crate::async_hal::interrupts::DMAC,
324-
super::async_api::InterruptHandler,
325-
>,
323+
crate::async_hal::interrupts::DMAC,
324+
super::async_api::InterruptHandler,
325+
>,
326326
{
327327
/// Release the DMAC and return the register block.
328328
///
@@ -390,9 +390,9 @@ macro_rules! define_split_future {
390390
impl<I> DmaController<I>
391391
where
392392
I: crate::async_hal::interrupts::Binding<
393-
crate::async_hal::interrupts::DMAC,
394-
super::async_api::InterruptHandler,
395-
>,
393+
crate::async_hal::interrupts::DMAC,
394+
super::async_api::InterruptHandler,
395+
>,
396396
{
397397
with_num_channels!(define_split_future);
398398
}

0 commit comments

Comments
 (0)