Skip to content

Commit

Permalink
Updated XIAO M0 dependencies and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRolfFR committed Jul 15, 2024
1 parent 64cb169 commit 786fb85
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 22 deletions.
File renamed without changes.
9 changes: 8 additions & 1 deletion boards/xiao_m0/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Unreleased

- Update atsamd-hal to 0.16
- Add cortex-m critical section feature
- Update usbd-serial to 0.2
- Update ssd1306 to 0.8.4
- Update embedded-graphics to 0.8.1
- Update shared-bus to 0.3.1
- Remove unproven feature
- Update examples with new package updates
- Update atsamd-hal to 0.17

# v0.12.1

Expand Down
21 changes: 9 additions & 12 deletions boards/xiao_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,32 @@ version = "0.7"
optional = true

[dependencies.atsamd-hal]
version = "0.16"
version = "0.17"
default-features = false

[dependencies.usb-device]
version = "0.2"
version = "0.3.2"
optional = true

[dev-dependencies]
cortex-m = "0.7"
usbd-serial = "0.1"
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
usbd-serial = "0.2"
panic-halt = "0.2"
ssd1306 = "0.7"
embedded-graphics = "0.7.1"
ssd1306 = "0.8"
embedded-graphics = "0.8"
mpu6050 = "0.1.4"
shared-bus = "0.2.2"
shared-bus = "0.3.1"

[features]
default = ["rt", "atsamd-hal/samd21g", "atsamd-hal/unproven"]
default = ["rt", "atsamd-hal/samd21g"]
rt = ["cortex-m-rt", "atsamd-hal/samd21g-rt"]
unproven = ["atsamd-hal/unproven"]
usb = ["atsamd-hal/usb", "usb-device"]

[[example]]
name = "blink"
required-features = ["unproven"]

[[example]]
name = "eic"
required-features = ["unproven"]

[[example]]
name = "shared_i2c"
Expand All @@ -53,7 +50,7 @@ name = "ssd1306_i2c"

[[example]]
name = "usb_echo"
required-features = ["usb", "unproven"]
required-features = ["usb"]

[profile.release]
debug = false
Expand Down
4 changes: 2 additions & 2 deletions boards/xiao_m0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ for examples.
* Put your device in bootloader mode by bridging the `RST` pads _twice_ in
quick succession. The orange LED will pulse when the device is in bootloader
mode.
* Build and upload in one step: `cargo hf2 --release --example blink --features="unproven"`
* Build and upload in one step: `cargo hf2 --release --example blink`
* Note that if you're using an older `cargo-hf2` that you'll need to specify
the VID/PID when flashing: `cargo hf2 --vid 0x2886 --pid 0x002f --release
--example blink --features="unproven"`
--example blink`

If you are on Linux and hf2 fails to flash your board even if it is connected and in bootloader mode, you
might need to add some `udev` rules if you have not done that yet.
Expand Down
2 changes: 1 addition & 1 deletion boards/xiao_m0/examples/eic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn main() -> ! {
.configure_gclk_divider_and_source(
ClockGenId::GCLK2,
1,
pac::gclk::genctrl::SRC_A::OSC8M,
pac::gclk::genctrl::SRCSELECT_A::OSC8M,
false,
)
.unwrap();
Expand Down
5 changes: 3 additions & 2 deletions boards/xiao_m0/examples/sercom_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ use cortex_m::{interrupt::Mutex, peripheral::NVIC};
use bsp::hal::{
clock::GenericClockController,
delay::Delay,
ehal::blocking::delay::DelayMs,
ehal::delay::DelayNs,
gpio::{Pin, PushPullOutput, PA17},
nb,
pac::{self, interrupt, CorePeripherals, Peripherals},
prelude::*,
sercom::{
Expand Down Expand Up @@ -118,7 +119,7 @@ fn main() -> ! {
NVIC::unmask(interrupt::SERCOM4);
}
loop {
delay.delay_ms(1000u16);
<Delay as DelayNs>::delay_ms(&mut delay, 1000);
let _ = nb::block!(serial_sercom0.write(b'A'));
}
}
Expand Down
2 changes: 1 addition & 1 deletion boards/xiao_m0/examples/ssd1306_i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn main() -> ! {
.map(|p| State::new(width * p, height / 2. * (1. + p), 0., 0., 0., -5.));

loop {
display.clear();
display.clear(BinaryColor::Off).unwrap();
states.iter_mut().for_each(|state| {
Circle::new(state.into(), 8)
.into_styled(style)
Expand Down
9 changes: 6 additions & 3 deletions boards/xiao_m0/examples/usb_echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use usb_device::{bus::UsbBusAllocator, prelude::*};
use usbd_serial::{SerialPort, USB_CLASS_CDC};

use bsp::{entry, hal, pac, Led0, Led1};
use usb_device::prelude::UsbDeviceBuilder;
use xiao_m0 as bsp;

#[entry]
Expand Down Expand Up @@ -38,9 +39,11 @@ fn main() -> ! {
USB_SERIAL = Some(SerialPort::new(&bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(&bus_allocator, UsbVidPid(0xdead, 0xbeef))
.manufacturer("Hackers University")
.product("xiao_usb_echo")
.serial_number("42")
.strings(&[usb_device::device::StringDescriptors::default()
.manufacturer("Hackers University")
.product("xiao_usb_echo")
.serial_number("42")])
.unwrap()
.device_class(USB_CLASS_CDC)
.build(),
);
Expand Down

0 comments on commit 786fb85

Please sign in to comment.