Commit Graph

1841 Commits

Author SHA1 Message Date
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
0642eec01e Properly initialise refcount 2021-12-16 18:15:28 +11:00
1b3367e9a2 Update stm32-data. 2021-12-16 08:14:49 +01:00
2d6111ed43 Merge #543
543: Incrementally merge STM32 SPI versions, Part 3 r=Dirbaio a=GrantM11235

Notable changes:
- `SPE` is now disabled before `TXDMAEN` and `RXDMAEN` are disabled. This is the "mandatory" sequence for v2 and v3 (and maybe v1 as well, but I can't find it in the reference manual).
- v1's `write_dma_u8` now waits for idle and disables `TXDMAEN` after the transfer is complete, just like everything else.

Co-authored-by: Grant Miller <GrantM11235@gmail.com>
2021-12-16 07:07:39 +00:00
bb03b5cc02 Too much copy/pasta
The tx permitted reads and the rx permitted writes!
2021-12-16 07:16:38 +11:00
2493699fb3 Ref count the peripheral drop 2021-12-16 07:09:33 +11: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
6597e67036 Add finish_dma function 2021-12-14 17:46:25 -06:00
a13a7a6616 Replace wait_for_idle with spin_until_idle 2021-12-14 17:46:25 -06:00
e75cb1a564 Regs type alias 2021-12-14 15:39:00 -06:00
b06658c195 Refactor new 2021-12-14 15:39:00 -06: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
78c5d65ca9 [lint] Add newline in pwr file 2021-12-13 18:16:58 +05:30
2c50ab1ebf [ci] Add STM32F3 examples to CI shell 2021-12-13 18:13:23 +05:30
3f3b7d066e Merge pull request #541 from lulf/docs-readme
Some notes in the readme about docs
2021-12-13 13:25:26 +01:00
91e0c6df73 Some notes in the readme about docs 2021-12-13 13:23:18 +01:00
a65c2bc2b4 [examples] Add examples for STM32F3 2021-12-13 14:50:13 +05:30
3f33d307ff [feature] Add rcc register support for F3 2021-12-13 14:50:13 +05:30
e2c074d133 [feature] Add pwr register support for F3 2021-12-13 13:49:41 +05:30
7733d11f90 [generate] Add stm32f3 chips to the Cargo manifest 2021-12-13 13:49:41 +05:30
629fab7e21 [manual] Add stm32f3 family to stm32-gen-features 2021-12-13 13:49:41 +05:30
2a4a133b88 Merge #533
533: Book poc r=Dirbaio a=lulf

This is a Proof of Concept for an embassy book. It's using Antora/Asciidoc.

* Asciidoc because it's a single specification with a slightly richer feature set than markdown. 
* Antora because it allows keeping content in the embassy repo, while book definition in another repo (embassy-book). 

Using antora also allows for easy embedding of embassy doc in other projects, which I think in turn increases probability of upstream contributions.

The sources of content are located in docs/ but could also be in a separate repo. However, keeping it in the embassy repo makes it easier to support one version of the book per embassy version in the future.

At present, the book is automatically built every hour from this branch and published at: https://embassy-rs.github.io/embassy-book/embassy/dev/index.html

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2021-12-13 00:07:39 +00: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
8e25ecb68e Merge #538
538: Use smoltcp 0.8.0 from crates.io. r=Dirbaio a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2021-12-12 20:23:01 +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
ff82c76935 Fix broken ci.sh 2021-12-10 13:10:02 +01:00
aa0abe976a Fix doc example compile 2021-12-10 12:58:23 +01:00
e5d4d0952b Add doc-specific example and add it to CI 2021-12-10 12:46:41 +01: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
b48fcd9229 Add more content 2021-12-10 12:04:12 +01:00
7568d0bb68 More on traits and notes on time 2021-12-10 10:47:34 +01:00
439e317ba3 Add diagrams explaining the runtime 2021-12-10 10:22:11 +01:00
d2820d5be7 Update section on async 2021-12-10 08:24:39 +01:00
08e1fcd2e4 Add example snippet inclusion 2021-12-10 08:08:56 +01:00
dce3f8c47d Merge #534
534: Provides AsyncWrite with flush r=huntc a=huntc

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.

Co-authored-by: huntc <huntchr@gmail.com>
2021-12-10 04:26:11 +00:00
45ef944457 Stm flush required implementing also, along with std alloc split 2021-12-10 15:11:41 +11:00
5d502ec0af Fix missing flush for tcp 2021-12-10 14:38:28 +11:00
29fee65616 std also required an implementation 2021-12-10 14:18:22 +11:00
0338fd2237 Merge pull request #535 from GrantM11235/example-linkedprojects
Add all example crates to linked projects (commented out)
2021-12-10 02:47:04 +01:00
87f45be1c6 Add all example crates to linked projects (commented out) 2021-12-09 19:44:41 -06: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
60b7c50d8b Merge #531
531: Rust Analyzer documentation r=Dirbaio a=huntc

Intends to clarify how to make Embassy usable from within Visual Studio Code by assuming the presence of the Rust Analyzer.

Note that IntelliJ does not support the Rust Analyzer, so an open question remains as to the whether this is a good move. If it turns out not to be a good move then we should still look at clarifying the use of a workspace file.

Co-authored-by: huntc <huntchr@gmail.com>
2021-12-10 00:44:24 +00:00
45a82cfc43 Merge #490
490: DCMI r=matoushybl a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2021-12-09 12:42:13 +00:00
08c8476145 Merge #528
528: Enable running ci.sh locally multiple times. r=lulf a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2021-12-09 12:01:27 +00:00
484c356c03 Add DCMI example. 2021-12-09 12:56:39 +01:00
1dd5a71c07 Add DCMI peripheral support. 2021-12-09 12:56:39 +01:00