Commit Graph

3622 Commits

Author SHA1 Message Date
Quentin Smith
a3c1522ce6 Add support for rtos-trace behind a feature flag 2022-08-10 05:04:13 -04:00
bors[bot]
de22cb9065
Merge #895
895: Implement embedded-nal-async traits for embassy-net r=lulf a=lulf



Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-08-10 08:01:59 +00:00
chemicstry
6498324b58 Implement I2C pullup configuration 2022-08-09 22:13:35 +03:00
Ulf Lilleengen
87401c49b7 Fix formatting 2022-08-09 14:51:32 +02:00
Ulf Lilleengen
2e76b13a4c Add example using embedded-nal-async traits 2022-08-09 14:44:18 +02:00
Ulf Lilleengen
80c1551153 Wrap buffers in a single state type 2022-08-09 14:43:55 +02:00
Ulf Lilleengen
18671b94ba Implement embedded-nal-async traits for embassy-net 2022-08-08 16:51:34 +02:00
bors[bot]
b7b4c84067
Merge #892
892: Merge v1, v2 DAC and update register definitions r=Dirbaio a=chemicstry

This merges v1 (unimplemented) and v2 DAC implementations, because they share most of the code except for some exotic stuff, which is not yet implemented for neither of the versions. This should allow using DAC on all chips that have v1 peripheral.

~Currently blocked on https://github.com/embassy-rs/stm32-data/pull/153~



Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-08-08 11:37:41 +00:00
bors[bot]
b400e6aa75
Merge #894
894: rp: GPIO fixes r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-08-08 10:49:51 +00:00
chemicstry
ed74bcb8d8 Update stm32-data 2022-08-08 13:14:13 +03:00
Dario Nieuwenhuis
6c10fa44d0 rp/gpio: fix wait_for_* when multiple pins are in use. 2022-08-08 00:22:08 +02:00
Dario Nieuwenhuis
89e2e25d6f rp/gpio: remove unused lifetimes. 2022-08-07 23:25:50 +02:00
bors[bot]
ba67f6d3a8
Merge #891
891: Async Pipe r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-08-04 21:40:44 +00:00
Dario Nieuwenhuis
99a97ec6c9 util/pipe: add some capacity/len getters. 2022-08-04 23:18:56 +02:00
Dario Nieuwenhuis
ac1a26b40f util/pipe: add embedded-io impls for Pipe, Reader, Writer. 2022-08-04 23:18:45 +02:00
chemicstry
8a25906eff Add DACv1 example for F4 2022-08-04 03:31:59 +03:00
chemicstry
206b7fd8ed Use RccPeripheral for DAC and add a hackfix for H7 2022-08-04 03:31:47 +03:00
chemicstry
d990740dd5 Restore F1 example chip 2022-08-04 03:07:42 +03:00
chemicstry
5f01e56728 Merge v1, v2 DAC and update register definitions 2022-08-04 03:02:57 +03:00
Dario Nieuwenhuis
3967c4194b util: add pipe 2022-08-03 13:55:46 +02:00
bors[bot]
1924f2d67d
Merge #890
890: Implement UsbSupply for a reference of SignalledSupply r=Dirbaio a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2022-08-02 20:29:29 +00:00
Matous Hybl
e4cfbf96ac Implement UsbSupply for a reference of SignalledSupply 2022-08-02 22:09:02 +02:00
bors[bot]
a903215423
Merge #888
888: Extend QSPI config with freq, delay, spi mode, and address mode r=Dirbaio a=TilBlechschmidt

Fixes #886 among some of the TODOs which have been flying around in the source file :)

I'll make one more commit to remove some old commented out code from the file and take some time this evening to verify that it works.

Co-authored-by: Til Blechschmidt <til@blechschmidt.de>
2022-08-01 15:40:05 +00:00
bors[bot]
2b0786129a
Merge #887
887: executor: miri fixes r=Dirbaio a=Dirbaio

Fixes a few MIRI errors due to loosely mixing `&TaskStorage<F>` and `&TaskHeader`. References "downgrade" the provenance. `TaskHeader` is smaller, so once you have a `&TaskHeader` you can't use pointer casts to access the whole `TaskStorage<F>`. This fixes it by always keeping the raw pointer around, which doesn't downgrade provenance.

The error was: 

```
[dirbaio@mars std]$ MIRIFLAGS=-Zmiri-disable-isolation cargo miri run --bin tick
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `/home/dirbaio/.rustup/toolchains/nightly-2022-07-13-x86_64-unknown-linux-gnu/bin/cargo-miri target/miri/x86_64-unknown-linux-gnu/debug/tick`
error: Undefined Behavior: trying to reborrow <12349> for SharedReadWrite permission at alloc2[0x30], but that tag does not exist in the borrow stack for this location
   --> /home/dirbaio/embassy/embassy/embassy-executor/src/executor/raw/mod.rs:162:20
    |
162 |         let this = &*(p.as_ptr() as *const TaskStorage<F>);
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                    |
    |                    trying to reborrow <12349> for SharedReadWrite permission at alloc2[0x30], but that tag does not exist in the borrow stack for this location
    |                    this error occurs as part of a reborrow at alloc2[0x30..0x40]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <12349> was created by a retag at offsets [0x0..0x30]
   --> src/bin/tick.rs:15:1
    |
15  | #[embassy_executor::main]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: backtrace:
    = note: inside `embassy_executor::executor::raw::TaskStorage::<std::future::from_generator::GenFuture<[static generator@src/bin/tick.rs:15:1: 15:26]>>::poll` at /home/dirbaio/embassy/embassy/embassy-executor/src/executor/raw/mod.rs:162:20
    = note: inside closure at /home/dirbaio/embassy/embassy/embassy-executor/src/executor/raw/mod.rs:390:13
    = note: inside `embassy_executor::executor::raw::run_queue::RunQueue::dequeue_all::<[closure@embassy_executor::executor::raw::Executor::poll::{closure#1}]>` at /home/dirbaio/embassy/embassy/embassy-executor/src/executor/raw/run_queue.rs:69:13
    = note: inside `embassy_executor::executor::raw::Executor::poll` at /home/dirbaio/embassy/embassy/embassy-executor/src/executor/raw/mod.rs:373:9
    = note: inside `embassy_executor::executor::Executor::run::<[closure@src/bin/tick.rs:15:1: 15:26]>` at /home/dirbaio/embassy/embassy/embassy-executor/src/executor/arch/std.rs:52:22
```

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-08-01 12:33:58 +00:00
Til Blechschmidt
43b8c0c71e
Remove commented out logging code 2022-08-01 12:57:00 +02:00
Til Blechschmidt
fa2fbcbde0
Extend QSPI config with freq, delay, spi mode, and address mode 2022-08-01 12:54:49 +02:00
Dario Nieuwenhuis
8d24cba72d executor: miri fixes 2022-08-01 12:26:37 +02:00
Dario Nieuwenhuis
bd6bab1625
Merge pull request #883 from embassy-rs/split
Split embassy crate into embassy-executor, embassy-util.
2022-07-30 00:02:12 +02:00
Dario Nieuwenhuis
a0f1b0ee01 Split embassy crate into embassy-executor, embassy-util. 2022-07-29 23:40:36 +02:00
bors[bot]
8745d646f0
Merge #882
882: Remove separation of stable vs. nightly implementations in executor/raw r=Dirbaio a=jannic

Since rust 1.61, the required const features are availabe on stable rust

Co-authored-by: Jan Niehusmann <jan@gondor.com>
2022-07-29 16:26:45 +00:00
Jan Niehusmann
3b9c26fbd8 Remove separation of stable vs. nightly implementations in executor/raw
Since rust 1.61, the required const features are availabe on stable rust
2022-07-29 16:22:49 +00:00
bors[bot]
9af68e005b
Merge #879
879: Improve ADC configuration options r=Dirbaio a=chemicstry

This smooths out a few rough edges with ADC:
- Make `Resolution::to_max_count()` pub for all ADC versions. Useful if performing conversion manually.
- `VREF` and `VREFINT` were convoluted. `VREF` is an external voltage reference used for all ADC conversions and it is exposed as a separate pin on large chips, while on smaller ones it is connected to `VDDA` internally. `VREFINT` is an internal voltage reference connected to one of the ADC channels and can be used to calculate unknown `VREF` voltage.
- Add a separate `VREF_DEFAULT_MV`, equal to 3.3V, which is the usual supply voltage and should work for most simple cases.
  - For an external voltage reference `set_vref()` can be used to set a known precise voltage.
  - If no voltage reference is present, `VREFINT` calibration can be used to calculate unknown `VREF` voltage. If I understand correctly, this is only implemented for `adc_v3` (L4?), but is not currently exposed (private). If someone is interested, this can be fixed in separate PR.

Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-07-27 12:41:03 +00:00
chemicstry
42434c75bc Make vref units explicit 2022-07-27 14:13:59 +03:00
bors[bot]
c0496f8bbe
Merge #878
878: Minor simplifications for `Forever` r=Dirbaio a=GrantM11235



Co-authored-by: Grant Miller <GrantM11235@gmail.com>
2022-07-27 07:06:23 +00:00
chemicstry
b1f0d6320e Improve set_vref docs 2022-07-27 01:30:32 +03:00
chemicstry
046778fc53 Improve ADC configuration options 2022-07-27 01:17:26 +03:00
Grant Miller
1d63a30d5f Forever: Simplify pointer handling 2022-07-25 23:09:07 -05:00
Grant Miller
41e392bda3 Use Forever::put_with inside Forever::put 2022-07-25 22:30:01 -05:00
bors[bot]
84cffc751a
Merge #876
876: Add defmt support to embassy-embedded-hal errors r=Dirbaio a=matoushybl

`defmt::unwrap!()` should now work with shared buses. I tested it only with I2C as I don't have SPI in the target project.

Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2022-07-24 20:15:57 +00:00
Matous Hybl
c38755c5b7 Add defmt support to embassy-embedded-hal errors 2022-07-24 22:10:50 +02:00
bors[bot]
6b8cd6fbb3
Merge #856
856: embassy-stm32/pwm: Generalize channel selection r=Dirbaio a=bgamari

550da471be previously refactored the STM32
PWM logic in such a way to preclude use of non-contiguous channels (e.g.
channel 2 but not channel 1). Refactor it yet again to yet again allow
this sort of usage.

Co-authored-by: Ben Gamari <ben@smart-cactus.org>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-07-23 14:16:51 +00:00
Dario Nieuwenhuis
b5ff7c5d60 rename PwmPin::new_chX, update examples. 2022-07-23 16:16:29 +02:00
Ben Gamari
042e11960e embassy-stm32/pwm: Generalize channel selection
550da471be previously refactored the STM32
PWM logic in such a way to preclude use of non-contiguous channels (e.g.
channel 2 but not channel 1). Refactor it yet again to yet again allow
this sort of usage.
2022-07-23 15:57:13 +02:00
bors[bot]
e61e36a815
Merge #842
842: WIP: Make unborrow safe to use r=Dirbaio a=GrantM11235

The basic idea is that `Unborrow::unborrow` is now safe to call and returns an `Unborrowed<'a, T>` which impls `Deref` and `DerefMut`

```rust
/// This is essentially a `&mut T`, but it is the size of `T` not the size
/// of a pointer. This is useful if T is a zero sized type.
pub struct Unborrowed<'a, T> {
    inner: T,
    _lifetime: PhantomData<&'a mut T>,
}
```

## Todo

- [x] Update other crates
  - [x] embassy-cortex-m
  - [x] embassy-hal-common
  - [x] embassy-lora
  - [x] embassy-nrf
  - [x] embassy-rp
  - [x] embassy-stm32
- [x] Remove usage of the unsafe `into_inner` method if possible
- [x] Review and amend docs for `Unborrow` and `Unborrowed`

Co-authored-by: Grant Miller <GrantM11235@gmail.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-07-23 13:15:17 +00:00
Dario Nieuwenhuis
709df0dc1d nrf: replace PhantomData usages with PeripheralRef. 2022-07-23 15:13:47 +02:00
Dario Nieuwenhuis
19d1ef0e29 stm32/gpio: Add Peripheral<Self> bound to Pin. 2022-07-23 14:28:42 +02:00
Dario Nieuwenhuis
f02ba35482 Remove PeripheralRef::into_inner() 2022-07-23 14:27:45 +02:00
Dario Nieuwenhuis
a158295782 Add docs to PeripheralRef::map_into. 2022-07-23 14:04:43 +02:00
Dario Nieuwenhuis
4901c34d9c Rename Unborrowed -> PeripheralRef, Unborrow -> Peripheral 2022-07-23 14:00:19 +02:00
Dario Nieuwenhuis
8a9d2f59af Update embassy-stm32 2022-07-23 02:40:13 +02:00