Skip to content

Commit

Permalink
Minor examples correction
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeaurivage committed Nov 7, 2024
1 parent f6ac11b commit 6405b8c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion boards/feather_m0/examples/async_i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async fn main(_s: embassy_executor::Spawner) {

// Take SDA and SCL
let (sda, scl) = (pins.sda, pins.scl);
let i2c_sercom = periph_alias!(peripherals.i2c_sercom);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.DMAC, &mut peripherals.PM);
Expand All @@ -54,7 +55,7 @@ async fn main(_s: embassy_executor::Spawner) {
let pads = i2c::Pads::new(sda, scl);
let mut i2c = i2c::Config::new(
&peripherals.PM,
peripherals.SERCOM3,
i2c_sercom,
pads,
sercom3_clock.freq(),
)
Expand Down
3 changes: 2 additions & 1 deletion boards/feather_m0/examples/async_spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async fn main(_s: embassy_executor::Spawner) {

// Take SPI pins
let (miso, mosi, sclk) = (pins.miso, pins.mosi, pins.sclk);
let spi_sercom = periph_alias!(peripherals.spi_sercom);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.DMAC, &mut peripherals.PM);
Expand All @@ -53,7 +54,7 @@ async fn main(_s: embassy_executor::Spawner) {
let mut spi = bsp::spi_master(
&mut clocks,
100.kHz(),
peripherals.SERCOM4,
spi_sercom,
&mut peripherals.PM,
sclk,
mosi,
Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/async_uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async fn main(spawner: embassy_executor::Spawner) {
#[embassy_executor::task]
async fn send_bytes(mut uart_tx: UartFutureTxDuplexDma<Config<bsp::UartPads>, Ch1>) {
loop {
uart_tx.write(&[0x00; 10]).await;
uart_tx.write(b"Hello, world!").await;
defmt::info!("Sent 10 bytes");
Systick::delay(MillisDuration::<u32>::from_ticks(500).convert()).await;
}
Expand Down
3 changes: 2 additions & 1 deletion boards/metro_m4/examples/async_i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async fn main(_s: embassy_executor::Spawner) {

// Take SDA and SCL
let (sda, scl) = (pins.sda, pins.scl);
let i2c_sercom = periph_alias!(peripherals.i2c_sercom);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.dmac, &mut peripherals.pm);
Expand All @@ -64,7 +65,7 @@ async fn main(_s: embassy_executor::Spawner) {
let pads = i2c::Pads::new(sda, scl);
let mut i2c = i2c::Config::new(
&peripherals.mclk,
peripherals.sercom5,
i2c_sercom,
pads,
sercom5_clock.freq(),
)
Expand Down
3 changes: 2 additions & 1 deletion boards/metro_m4/examples/async_spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async fn main(_s: embassy_executor::Spawner) {

// Take SPI pins
let (miso, mosi, sclk) = (pins.miso, pins.mosi, pins.sclk);
let spi_sercom = periph_alias!(peripherals.spi_sercom);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.dmac, &mut peripherals.pm);
Expand All @@ -63,7 +64,7 @@ async fn main(_s: embassy_executor::Spawner) {
let mut spi = bsp::spi_master(
&mut clocks,
100.kHz(),
peripherals.sercom2,
spi_sercom,
&mut peripherals.mclk,
sclk,
mosi,
Expand Down
2 changes: 1 addition & 1 deletion boards/metro_m4/examples/async_uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async fn main(spawner: embassy_executor::Spawner) {
#[embassy_executor::task]
async fn send_bytes(mut uart_tx: UartFutureTxDuplexDma<Config<bsp::UartPads>, Ch1>) {
loop {
uart_tx.write(&[0x00; 10]).await;
uart_tx.write(b"Hello, world!").await;
defmt::info!("Sent 10 bytes");
Mono::delay(MillisDuration::<u32>::from_ticks(500).convert()).await;
}
Expand Down

0 comments on commit 6405b8c

Please sign in to comment.