Commit Graph

2586 Commits

Author SHA1 Message Date
Sjoerd Simons
f0f08f298b examples: stm32f1: Optimize for size on development builds
Even the basic examples seemingly need to be build optimized for size to
allow flashing to a bluepill
2021-12-30 10:53:01 +01:00
Sjoerd Simons
92f2c6d09c adc: Implement support for f1 ADC block
Add basic support for the STM32F1xx ADC blocks.
2021-12-30 10:51:54 +01:00
Sjoerd Simons
a93b1141e9 stm32f1: Store adc clock rate in Clocks struct 2021-12-30 10:50:28 +01:00
Dario Nieuwenhuis
ecb09b7313
Merge pull request #562 from tafia/patch-1
Update stm32.adoc
2021-12-30 07:58:26 +01:00
Johann Tuffe
5d86228077
Update stm32.adoc
typo
2021-12-30 09:17:06 +08:00
Robert Walker
1028b5c671 Review changes 2021-12-29 08:17:51 +01:00
Ben Gamari
8da6471a50 stm32/dac: Fix disable_channel
Previously disable_channel enabled rather than disabled the requested
channel due to an apparent copy-paste error. Refactor to eliminate this
sort of issue by construction.
2021-12-28 23:27:59 -05:00
Robert Walker
4271226fc0 Added and tested the usart dma example for stm32f767zi using a
Nucleo-f767zi board.
2021-12-28 08:33:34 +01:00
Nikita Strygin
a94932be02 Mark clear_interrupt_flag as unsafe 2021-12-26 18:29:41 +03:00
Nikita Strygin
6b08c70273 Port buffered uart to v1 stm32 hardware
- No DMA
- Create clear_interrupt_flag function to
    handle differences between v1 and v2 hardware
2021-12-26 18:13:19 +03:00
bors[bot]
7561fa1934
Merge #555
555: Use cortex-m only on cortex-m archs. r=Dirbaio a=Dirbaio

Without this, build fails for iOS.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-12-23 12:57:55 +00:00
Dario Nieuwenhuis
7926957067 Use cortex-m only on cortex-m archs.
Without this, build fails for iOS.
2021-12-23 13:53:26 +01:00
bors[bot]
63d980df7e
Merge #556
556: Lower some verbose logs to trace. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-12-23 12:44:32 +00:00
Dario Nieuwenhuis
d1740b10f0 Lower some verbose logs to trace. 2021-12-23 13:43:14 +01:00
bors[bot]
587c003d73
Merge #554
554: Update stm32-data with F3 Timer register changes r=Dirbaio a=VasanthakumarV

Changes to `stm32-data` as part of https://github.com/embassy-rs/stm32-data/pull/112

Co-authored-by: VasanthakumarV <vasanth260m12@gmail.com>
2021-12-23 11:39:10 +00:00
VasanthakumarV
c883eedb63 Update stm32-data with f3 Timer reg changes 2021-12-23 17:05:11 +05:30
bors[bot]
79cbad501c
Merge #551
551: nrf/gpio: add infallible inherent methods, remove some duplication. r=Dirbaio a=Dirbaio

Add infallible inherent methods, so that users don't have to import a trait, or `.unwrap()`.

This implements Input and Output using FlexPin, to avoid some code duplication.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-12-21 09:31:23 +00:00
Dario Nieuwenhuis
22bc1e4ae1 nrf/gpio: add infallible inherent methods, remove some duplication.
This implements Input and Output using FlexPin, to avoid some code duplication.
2021-12-20 00:55:18 +01:00
bors[bot]
fcb43caa36
Merge #550
550: Some API documentation fixes in traits r=Dirbaio a=lulf



Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2021-12-19 07:50:33 +00:00
Ulf Lilleengen
e1545066e5 Some API documentation fixes in traits 2021-12-19 08:49:19 +01:00
Ulf Lilleengen
3811c0a401 Add adapter for implementing async traits for blocking types
This allows writing drivers relying on async traits, while still
functioning with implementations that already implement the embedded-hal
traits.

Add examples to stm32l4 for using this feature.
2021-12-17 12:54:51 +01:00
bors[bot]
ad2f469407
Merge #548
548: Set Uarte log levels to trace r=lulf a=huntc

I noticed lots of logging which really slows things down and is not useful outside of a debugging context, hence set to trace.

Co-authored-by: huntc <huntchr@gmail.com>
2021-12-17 06:39:49 +00:00
huntc
3d8eecff89 Set Uarte log levels to trace
I noticed lots of logging which really slows things down and is not useful outside of a debugging context, hence set to trace.
2021-12-17 17:06:46 +11:00
Jacob Rosenthal
e7d2c52680 example cleanup 2021-12-16 15:20:56 -07:00
Jacob Rosenthal
1d51f91368 usb_uart_io example equivilent to usb_uart 2021-12-16 14:59:35 -07:00
Jacob Rosenthal
1f2bbe3e4a simplify usb_uart example 2021-12-16 14:59:08 -07:00
bors[bot]
23c16903db
Merge #546
546: Update rust-toolchain r=Dirbaio a=lulf



Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2021-12-16 10:39:01 +00:00
Ulf Lilleengen
2bbd1ddb8a Remove unneeded rustfmt::skip 2021-12-16 11:37:53 +01:00
Ulf Lilleengen
985c11fad5 Update rust-toolchain 2021-12-16 11:34:20 +01:00
bors[bot]
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
bors[bot]
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
huntc
0642eec01e Properly initialise refcount 2021-12-16 18:15:28 +11:00
Dario Nieuwenhuis
1b3367e9a2 Update stm32-data. 2021-12-16 08:14:49 +01:00
bors[bot]
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
huntc
bb03b5cc02 Too much copy/pasta
The tx permitted reads and the rx permitted writes!
2021-12-16 07:16:38 +11:00
huntc
2493699fb3 Ref count the peripheral drop 2021-12-16 07:09:33 +11:00
Jacob Rosenthal
5d19f87acb cleanup example 2021-12-15 12:30:48 -07:00
Jacob Rosenthal
cfb5e8df57 undo T:regs in impl UsbPeripheral 2021-12-15 11:00:55 -07:00
Jacob Rosenthal
50f151e6bc use Instance regs 2021-12-15 10:29:19 -07:00
Jacob Rosenthal
cd356896ee fix nrf52820 2021-12-15 10:27:10 -07:00
Jacob Rosenthal
61f12324ff enable USB peripheral for relevant chips 2021-12-15 10:23:19 -07:00
Jacob Rosenthal
1c0a3688a4 use forked nrf-usbd 2021-12-15 10:00:17 -07:00
Jacob Rosenthal
79502330de rename to UsbBus 2021-12-15 09:59:56 -07:00
huntc
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
Jacob Rosenthal
2a6d92d641 cleanup 2021-12-14 16:53:13 -07:00
Jacob Rosenthal
5f0fefbd25 dont rely on nrf-usdb 2021-12-14 16:51:34 -07:00
Jacob Rosenthal
3debe604fb sorta works, too many interupts? 2021-12-14 16:48:48 -07:00
Grant Miller
6597e67036 Add finish_dma function 2021-12-14 17:46:25 -06:00
Grant Miller
a13a7a6616 Replace wait_for_idle with spin_until_idle 2021-12-14 17:46:25 -06:00
Jacob Rosenthal
07cbd41131 dont expose embedded_hal_common::usb 2021-12-14 15:47:54 -07:00