Commit Graph

1010 Commits

Author SHA1 Message Date
1d51f91368 usb_uart_io example equivilent to usb_uart 2021-12-16 14:59:35 -07:00
1f2bbe3e4a simplify usb_uart example 2021-12-16 14:59:08 -07:00
985c11fad5 Update rust-toolchain 2021-12-16 11:34:20 +01:00
5df16c6793 Merge #544
544: Introduces split on the nRF Uarte r=Dirbaio a=huntc

A new `split` method is introduced such that the Uarte tx and rx can be used from separate tasks. An MPSC is used in an example to illustrate how data may be passed between these tasks.

The approach taken within the `Uarte` struct is to split into tx and rx fields on calling `Uarte::new`. These fields are returned given a call to `Uarte::split`, but otherwise, if that call isn't made, then the API remains as it was before.

Here's a snippet from a new example introduced:

```rust
#[embassy::main]
async fn main(spawner: Spawner, p: Peripherals) {
    // ...

    let uart = uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, NoPin, NoPin, config);
    let (mut tx, rx) = uart.split();

    // ...

    // Spawn a task responsible purely for reading

    unwrap!(spawner.spawn(reader(rx, s)));

    // ...

    // Continue reading in this main task and write
    // back out the buffer we receive from the read
    // task.
    loop {
        if let Some(buf) = r.recv().await {
            info!("writing...");
            unwrap!(tx.write(&buf).await);
        }
    }
}

#[embassy::task]
async fn reader(mut rx: UarteRx<'static, UARTE0>, s: Sender<'static, Noop, [u8; 8], 1>) {
    let mut buf = [0; 8];
    loop {
        info!("reading...");
        unwrap!(rx.read(&mut buf).await);
        unwrap!(s.send(buf).await);
    }
}
```


Co-authored-by: huntc <huntchr@gmail.com>
2021-12-16 07:44:40 +00:00
d5a3064c2c Merge #540
540: Initial support for STM32F3 r=Dirbaio a=VasanthakumarV

The [companion PR](https://github.com/embassy-rs/stm32-data/pull/109) in `stm32-data` should be merged before this PR.
The examples were tested on an STM32F303VC MCU.

Co-authored-by: VasanthakumarV <vasanth260m12@gmail.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-12-16 07:30:03 +00:00
5d19f87acb cleanup example 2021-12-15 12:30:48 -07:00
61f12324ff enable USB peripheral for relevant chips 2021-12-15 10:23:19 -07:00
79502330de rename to UsbBus 2021-12-15 09:59:56 -07:00
1374ad2ab6 Introduces split on the nRF Uarte
A new `split` method is introduced such that the Uarte tx and rx can be used from separate tasks. An MPSC is used to illustrate how data may be passed between these tasks.
2021-12-15 18:31:52 +11:00
5f0fefbd25 dont rely on nrf-usdb 2021-12-14 16:51:34 -07:00
3debe604fb sorta works, too many interupts? 2021-12-14 16:48:48 -07:00
07cbd41131 dont expose embedded_hal_common::usb 2021-12-14 15:47:54 -07:00
f31140a70b revert 2021-12-14 13:51:50 -07:00
1a7b9e3279 Merge #542
542: nrf/gpiote: remove PortInput, move impls to Input/FlexPin. r=Dirbaio a=Dirbaio

`PortInput` is just a dumb wrapper around `Input`, it has no reason whatsoever to exist. This PR moves the `wait_for_x` functionality to `Input` directly.

It also adds it to `FlexPin` for completeness and consistency with `Input`.

(The reason `PortInput` exists is a while ago `GPIOTE` was an owned singleton that you had to initialize, so `PortInput::new()` would require it to enforce it's been initialized. This doesn't apply anymore now that GPIOTE is "global")

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-12-14 14:09:59 +00:00
153b1bbdbf nrf/gpiote: remove PortInput, move impls to Input. 2021-12-14 13:23:40 +01:00
535d30335a make send, consolidate usb types 2021-12-13 18:13:42 -07:00
83a1237ea3 stub out the embassy registers for usbd 2021-12-13 18:04:54 -07:00
a65c2bc2b4 [examples] Add examples for STM32F3 2021-12-13 14:50:13 +05:30
e5dc63e8e9 usb feature gate 2021-12-12 21:39:59 -07:00
f430c0e8c2 nrf-usbd 2021-12-12 19:20:02 -07:00
052abc918a Merge #537
537: Documents the nRF BufferedUarte problem r=Dirbaio a=huntc

Please see https://github.com/embassy-rs/embassy/issues/536 for the rationale.

Co-authored-by: huntc <huntchr@gmail.com>
2021-12-12 20:35:43 +00:00
e95b96f3a4 Use smoltcp 0.8.0 from crates.io. 2021-12-12 15:32:36 +01:00
dc3469b297 Documents the nRF BufferedUarte problem
Please see https://github.com/embassy-rs/embassy/issues/536 for the rationale.
2021-12-12 17:52:17 +11:00
9b01eed195 Revert blinky changes for now 2021-12-10 12:32:20 +01:00
e93f2679b1 More content 2021-12-10 12:27:44 +01:00
7256ff3e71 Provides AsyncWrite with flush
As per Tokio and others, this commit provides a `poll_flush` method on `AsyncWrite` so that a best-effort attempt at wakening once all bytes are flushed can be made.
2021-12-10 12:16:08 +11:00
484c356c03 Add DCMI example. 2021-12-09 12:56:39 +01:00
d6f3b479df Use smoltcp revision from its master branch. 2021-12-09 12:15:32 +01:00
9d62e886fb Do not use exported Result to mitigate problems with clap. 2021-12-08 22:19:13 +01:00
00a87b9a41 Fix build examples with defmt. 2021-12-06 21:58:57 +01:00
a802fd83aa Fix embassy-net documentation of running examples. 2021-12-06 14:59:15 +01:00
9a730ef692 Refactor sx127x radio to use async SPI with DMA 2021-12-03 09:53:28 +01:00
b9693c0b91 Update rust-lorawan to version supporting defmt 0.3 2021-12-02 19:10:29 +01:00
469852c667 Removed unsafe from uarte
The constructors themselves are not strictly unsafe. Interactions with DMA can be generally unsafe if a future is dropped, but that's a separate issue. It is important that we use the `unsafe` keyword diligently as it can lead to confusion otherwise.
2021-12-01 09:14:24 +11:00
3332c40705 examples: remove unused deps. 2021-11-29 02:07:48 +01:00
e40555e245 examples/stm32g4: add pwm example 2021-11-27 03:06:46 +01:00
88d4b0c00d stm32: add stm32g4 support. 2021-11-27 02:34:23 +01:00
c7d9729028 Merge #486
486: Pwm ppi events r=Dirbaio a=jacobrosenthal

More PWM yak shaving. I was going to do some safe pwm ppi events stuff but I just dont think it fits this api design.. ppi is just very low level, im not sure how safe it will be in general

* first we should probably have borrows of handlers for ppi with lifetime of the peripheral?  hal does eb4ba6ae42/nrf-hal-common/src/pwm.rs (L714-L716)
* in general having access to tasks can put the state in some configuration the api doesnt understand anymore. for `SequencePwm` ideally id hand you back either only seq_start0 or seq_start1 because youd only use one based on if your `Times` is even or odd.. but again we only know that with this api AFTER start has been called. I dont think were ready for typestates

SO I figured why not add the pwm ppi events but make them unsafe and commit this example since I started it.

Somewhat related drop IS removing the last duty cycle from the pin correctly, but stop DOES NOT..the only thing that sets the pin back is pin.conf() as far as I can tell, so I tried to document that better and got rid of stop for the `SimplePwm` again since that doesnt need it then. However its ackward we dont have a way to unset the pwm without setting a new sequence of 0s, or dropping the peripheral


Co-authored-by: Jacob Rosenthal <jacobrosenthal@gmail.com>
2021-11-26 23:08:24 +00:00
c257893da9 net: update smoltcp 2021-11-26 04:12:14 +01:00
e4de15e4de net: don't depend directly on smoltcp outside embassy-net 2021-11-24 17:48:48 +01:00
8fea6c94f6 Merge #501
501: stm32-metapac cleanups r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-11-24 01:00:22 +00:00
dfb6d407a1 stm32: rename core features from _cmX to -cmX, cleanup gen. 2021-11-23 23:49:06 +01:00
0ca6060bfd Fix interrupt_take macro by specifying path to panic macro. 2021-11-23 11:00:37 +01:00
2649984b55 Adjust the config.toml for U5.
- Correct ISA
- Remove commented-out cruft.
2021-11-17 10:35:25 -05:00
9b17b3d721 Remove unused deps 2021-11-15 20:13:22 +01:00
436eb81fc2 Adjust for bxcan API. 2021-11-15 12:00:26 -05:00
57ca241658 Further cargo muckings for smol/defmt. 2021-11-15 11:40:06 -05:00
23fdca9e52 Remove extraneous defmt-trace feature. 2021-11-15 11:33:44 -05:00
a770fc77c9 Adjust all examples to defmt 0.3. 2021-11-15 11:19:19 -05:00
c2da498263 Update to defmt 3.0ish.
Lots of gitrevs deps.
2021-11-15 11:09:08 -05:00