Skip to content

Commit 0d4237a

Browse files
committed
Updating to hal v0.18
1 parent e717771 commit 0d4237a

File tree

6 files changed

+53
-53
lines changed

6 files changed

+53
-53
lines changed

boards/grand_central_m4/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ version = "0.7"
1515
optional = true
1616

1717
[dependencies.atsamd-hal]
18-
version = "0.17.0"
18+
version = "0.18"
1919
default-features = false
2020

2121
[dependencies.usb-device]
22-
version = "0.3"
22+
version = "0.3.2"
2323
optional = true
2424

2525
[dependencies.cortex-m]
@@ -47,10 +47,10 @@ chip = "ATSAMD51P20A"
4747
name = "blinky_basic"
4848

4949
[[example]]
50-
name = "neopixel_rainbow"
50+
name = "eic"
5151

5252
[[example]]
53-
name = "eic"
53+
name = "neopixel_rainbow"
5454

5555
[[example]]
5656
name = "usb_serial"

boards/grand_central_m4/examples/blinky_basic.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ fn main() -> ! {
2323
let mut peripherals = Peripherals::take().unwrap();
2424
let core = CorePeripherals::take().unwrap();
2525
let mut clocks = GenericClockController::with_external_32kosc(
26-
peripherals.GCLK,
27-
&mut peripherals.MCLK,
28-
&mut peripherals.OSC32KCTRL,
29-
&mut peripherals.OSCCTRL,
30-
&mut peripherals.NVMCTRL,
26+
peripherals.gclk,
27+
&mut peripherals.mclk,
28+
&mut peripherals.osc32kctrl,
29+
&mut peripherals.oscctrl,
30+
&mut peripherals.nvmctrl,
3131
);
32-
let pins = bsp::Pins::new(peripherals.PORT);
32+
let pins = bsp::Pins::new(peripherals.port);
3333
let mut red_led: bsp::RedLed = pin_alias!(pins.red_led).into();
3434
let mut delay = Delay::new(core.SYST, &mut clocks);
3535
loop {

boards/grand_central_m4/examples/eic.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ fn main() -> ! {
4848
let mut peripherals = Peripherals::take().unwrap();
4949
let mut core = CorePeripherals::take().unwrap();
5050
let mut clocks = GenericClockController::with_internal_32kosc(
51-
peripherals.GCLK,
52-
&mut peripherals.MCLK,
53-
&mut peripherals.OSC32KCTRL,
54-
&mut peripherals.OSCCTRL,
55-
&mut peripherals.NVMCTRL,
51+
peripherals.gclk,
52+
&mut peripherals.mclk,
53+
&mut peripherals.osc32kctrl,
54+
&mut peripherals.oscctrl,
55+
&mut peripherals.nvmctrl,
5656
);
57-
let pins = bsp::Pins::new(peripherals.PORT);
57+
let pins = bsp::Pins::new(peripherals.port);
5858
free(|cs| {
5959
RED_LED
6060
.borrow(cs)
@@ -65,11 +65,11 @@ fn main() -> ! {
6565

6666
let gclk0 = clocks.gclk0();
6767
let eic_clock = clocks.eic(&gclk0).unwrap();
68-
let mut eic = eic::init_with_ulp32k(&mut peripherals.MCLK, eic_clock, peripherals.EIC);
68+
let mut eic = eic::init_with_ulp32k(&mut peripherals.mclk, eic_clock, peripherals.eic);
6969
let button: Pin<_, PullUpInterrupt> = pins.d46.into();
7070
eic.button_debounce_pins(&[button.id()]);
7171
let mut extint_button = ExtInt6::new(button);
72-
extint_button.sense(&mut eic, Sense::BOTH);
72+
extint_button.sense(&mut eic, Sense::Both);
7373
extint_button.enable_interrupt(&mut eic);
7474
eic.finalize();
7575

@@ -95,9 +95,9 @@ fn EIC_EXTINT_6() {
9595
// clear the interrupt and toggle the led
9696
let eic = unsafe {
9797
// Accessing registers from interrupts context is safe
98-
&*pac::EIC::ptr()
98+
&*pac::Eic::ptr()
9999
};
100-
eic.intflag
100+
eic.intflag()
101101
.modify(|r, w| unsafe { w.bits(r.bits() | 1 << 6) });
102102
toggle_led();
103103
}

boards/grand_central_m4/examples/neopixel_rainbow.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ fn main() -> ! {
3131
let mut peripherals = Peripherals::take().unwrap();
3232
let core = CorePeripherals::take().unwrap();
3333
let mut clocks = GenericClockController::with_external_32kosc(
34-
peripherals.GCLK,
35-
&mut peripherals.MCLK,
36-
&mut peripherals.OSC32KCTRL,
37-
&mut peripherals.OSCCTRL,
38-
&mut peripherals.NVMCTRL,
34+
peripherals.gclk,
35+
&mut peripherals.mclk,
36+
&mut peripherals.osc32kctrl,
37+
&mut peripherals.oscctrl,
38+
&mut peripherals.nvmctrl,
3939
);
4040
let gclk0 = clocks.gclk0();
4141
let tc2_3 = clocks.tc2_tc3(&gclk0).unwrap();
42-
let mut timer = TimerCounter::tc3_(&tc2_3, peripherals.TC3, &mut peripherals.MCLK);
42+
let mut timer = TimerCounter::tc3_(&tc2_3, peripherals.tc3, &mut peripherals.mclk);
4343
timer.start(Hertz::MHz(3).into_duration());
4444

45-
let pins = bsp::Pins::new(peripherals.PORT);
45+
let pins = bsp::Pins::new(peripherals.port);
4646
let neopixel_pin = pins.neopixel.into_push_pull_output();
4747
let mut neopixel = ws2812::Ws2812::new(timer, neopixel_pin);
4848
let mut delay = Delay::new(core.SYST, &mut clocks);

boards/grand_central_m4/examples/usb_serial.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,27 @@ fn main() -> ! {
4343
let mut peripherals = Peripherals::take().unwrap();
4444
let mut core = CorePeripherals::take().unwrap();
4545
let mut clocks = GenericClockController::with_internal_32kosc(
46-
peripherals.GCLK,
47-
&mut peripherals.MCLK,
48-
&mut peripherals.OSC32KCTRL,
49-
&mut peripherals.OSCCTRL,
50-
&mut peripherals.NVMCTRL,
46+
peripherals.gclk,
47+
&mut peripherals.mclk,
48+
&mut peripherals.osc32kctrl,
49+
&mut peripherals.oscctrl,
50+
&mut peripherals.nvmctrl,
5151
);
5252
let gclk0 = clocks.gclk0();
5353
let tc2_3 = clocks.tc2_tc3(&gclk0).unwrap();
54-
let mut timer = TimerCounter::tc3_(&tc2_3, peripherals.TC3, &mut peripherals.MCLK);
54+
let mut timer = TimerCounter::tc3_(&tc2_3, peripherals.tc3, &mut peripherals.mclk);
5555
InterruptDrivenTimer::start(&mut timer, Hertz::MHz(3).into_duration());
5656

57-
let pins = bsp::Pins::new(peripherals.PORT);
57+
let pins = bsp::Pins::new(peripherals.port);
5858
let neopixel_pin = pins.neopixel.into_push_pull_output();
5959
let mut neopixel = ws2812::Ws2812::new(timer, neopixel_pin);
6060
let _ = neopixel.write((0..5).map(|_| RGB8::default()));
6161

6262
let bus_allocator = unsafe {
6363
USB_ALLOCATOR = Some(bsp::usb_allocator(
64-
peripherals.USB,
64+
peripherals.usb,
6565
&mut clocks,
66-
&mut peripherals.MCLK,
66+
&mut peripherals.mclk,
6767
pins.usb_dm,
6868
pins.usb_dp,
6969
));

boards/grand_central_m4/src/lib.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ use hal::{
2222
time::Hertz,
2323
};
2424

25-
use pac::MCLK;
25+
use pac::Mclk;
2626

2727
#[cfg(feature = "usb")]
2828
use hal::usb::{usb_device::bus::UsbBusAllocator, UsbBus};
2929

3030
hal::bsp_peripherals!(
31-
SERCOM0 { UartSercom }
32-
SERCOM1 { UartSercom2 }
33-
SERCOM5 { UartSercom3 }
34-
SERCOM3 { I2cSercom }
35-
SERCOM6 { I2cSercom2 }
36-
SERCOM7 { SpiSercom }
31+
Sercom0 { UartSercom }
32+
Sercom1 { UartSercom2 }
33+
Sercom5 { UartSercom3 }
34+
Sercom3 { I2cSercom }
35+
Sercom6 { I2cSercom2 }
36+
Sercom7 { SpiSercom }
3737
);
3838

3939
hal::bsp_pins!(
@@ -495,7 +495,7 @@ pub fn spi_master(
495495
clocks: &mut GenericClockController,
496496
baud: Hertz,
497497
sercom7: SpiSercom,
498-
mclk: &mut pac::MCLK,
498+
mclk: &mut pac::Mclk,
499499
sclk: impl Into<Sclk>,
500500
mosi: impl Into<Mosi>,
501501
miso: impl Into<Miso>,
@@ -516,8 +516,8 @@ pub fn spi_master(
516516
/// assuming 120MHz system clock, for 4MHz QSPI mode 0 operation.
517517
#[allow(clippy::too_many_arguments)]
518518
pub fn qspi_master(
519-
mclk: &mut MCLK,
520-
qspi: pac::QSPI,
519+
mclk: &mut Mclk,
520+
qspi: pac::Qspi,
521521
sclk: impl Into<FlashSclk>,
522522
cs: impl Into<FlashCs>,
523523
data0: impl Into<FlashD0>,
@@ -555,7 +555,7 @@ pub fn i2c_master(
555555
clocks: &mut GenericClockController,
556556
baud: impl Into<Hertz>,
557557
sercom: I2cSercom,
558-
mclk: &mut pac::MCLK,
558+
mclk: &mut pac::Mclk,
559559
sda: impl Into<Sda>,
560560
scl: impl Into<Scl>,
561561
) -> I2c {
@@ -581,7 +581,7 @@ pub fn uart(
581581
clocks: &mut GenericClockController,
582582
baud: impl Into<Hertz>,
583583
sercom: UartSercom,
584-
mclk: &mut pac::MCLK,
584+
mclk: &mut pac::Mclk,
585585
uart_rx: impl Into<UartRx>,
586586
uart_tx: impl Into<UartTx>,
587587
) -> Uart {
@@ -597,16 +597,16 @@ pub fn uart(
597597
#[cfg(feature = "usb")]
598598
/// Convenience function for setting up USB
599599
pub fn usb_allocator(
600-
usb: pac::USB,
600+
usb: pac::Usb,
601601
clocks: &mut GenericClockController,
602-
mclk: &mut pac::MCLK,
602+
mclk: &mut pac::Mclk,
603603
dm: impl Into<UsbDm>,
604604
dp: impl Into<UsbDp>,
605605
) -> UsbBusAllocator<UsbBus> {
606-
use pac::gclk::{genctrl::SRCSELECT_A, pchctrl::GENSELECT_A};
606+
use pac::gclk::{genctrl::Srcselect, pchctrl::Genselect};
607607

608-
clocks.configure_gclk_divider_and_source(GENSELECT_A::GCLK2, 1, SRCSELECT_A::DFLL, false);
609-
let usb_gclk = clocks.get_gclk(GENSELECT_A::GCLK2).unwrap();
608+
clocks.configure_gclk_divider_and_source(Genselect::Gclk2, 1, Srcselect::Dfll, false);
609+
let usb_gclk = clocks.get_gclk(Genselect::Gclk2).unwrap();
610610
let usb_clock = &clocks.usb(&usb_gclk).unwrap();
611611
let (dm, dp) = (dm.into(), dp.into());
612612
UsbBusAllocator::new(UsbBus::new(usb_clock, mclk, dm, dp, usb))

0 commit comments

Comments
 (0)