Commit Graph

6407 Commits

Author SHA1 Message Date
b1f0d6320e Improve set_vref docs 2022-07-27 01:30:32 +03:00
046778fc53 Improve ADC configuration options 2022-07-27 01:17:26 +03:00
1d63a30d5f Forever: Simplify pointer handling 2022-07-25 23:09:07 -05:00
41e392bda3 Use Forever::put_with inside Forever::put 2022-07-25 22:30:01 -05:00
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
c38755c5b7 Add defmt support to embassy-embedded-hal errors 2022-07-24 22:10:50 +02:00
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
b5ff7c5d60 rename PwmPin::new_chX, update examples. 2022-07-23 16:16:29 +02:00
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
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
709df0dc1d nrf: replace PhantomData usages with PeripheralRef. 2022-07-23 15:13:47 +02:00
19d1ef0e29 stm32/gpio: Add Peripheral<Self> bound to Pin. 2022-07-23 14:28:42 +02:00
f02ba35482 Remove PeripheralRef::into_inner() 2022-07-23 14:27:45 +02:00
a158295782 Add docs to PeripheralRef::map_into. 2022-07-23 14:04:43 +02:00
4901c34d9c Rename Unborrowed -> PeripheralRef, Unborrow -> Peripheral 2022-07-23 14:00:19 +02:00
8a9d2f59af Update embassy-stm32 2022-07-23 02:40:13 +02:00
e0521ea249 fix nrf dppi 2022-07-23 02:17:45 +02:00
be6408e202 Rename unsafe_impl_unborrow to impl_unborrow 2022-07-23 01:33:22 +02:00
f9f2de3dfb wip 2022-07-23 01:33:22 +02:00
715fa51468 Reuse unsafe_impl_unborrow in other macros. 2022-07-23 01:33:22 +02:00
bff0ad9286 Update embassy-rp 2022-07-23 01:33:22 +02:00
65a82d02d1 WIP: Make unborrow safe to use 2022-07-23 01:33:22 +02:00
96f6767167 Merge #875
875: Misc cleanups r=Dirbaio a=Dirbaio

bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-07-22 14:33:34 +00:00
ffbd9363f2 Change steal() from trait to inherent fns. 2022-07-22 16:32:19 +02:00
a77ff72197 Remove unused std_peripherals. 2022-07-22 16:30:16 +02:00
b916a912df Merge #871 #872
871: nrf/saadc: add type-erased AnyInput. r=Dirbaio a=Dirbaio



872: nrf/usb: prevent user code from constructing a PowerUsb directly. r=Dirbaio a=Dirbaio

PowerUsb must be constructed through `new()` so that it sets up the IRQ.
It must have at least one private field, otherwise user code can construct
it directly with `PowerUsb{}`.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-07-22 09:14:39 +00:00
4c0b79eaac Merge #874
874: Add inline attribute to embassy-rp async functions r=Dirbaio a=danbev

This commit adds the inline attribute to the recently added async gpio
functions. This is to enable cross-crate inlining and to be consistent
with the other functions implemented for Input and Flex.

Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2022-07-22 08:58:04 +00:00
e757b1882e Add inline attribute to embassy-rp async functions
This commit adds the inline attribute to the recently added async gpio
functions. This is to enable cross-crate inlining and to be consistent
with the other functions implemented for Input and Flex.
2022-07-22 07:24:14 +02:00
5ef40acd1d Fix set iovar buffer length. 2022-07-22 00:05:39 +02:00
92505f53e2 Get wifi credentials from envvars in example. 2022-07-21 23:50:40 +02:00
0f4c0311fe Merge #873
873: Fix build of embassy-rp on stable channel r=Dirbaio a=jannic



Co-authored-by: Jan Niehusmann <jan@gondor.com>
2022-07-21 20:59:45 +00:00
666373e2da Include embassy-rp in ci builds 2022-07-21 20:14:45 +00:00
aff840cf30 Fix build of embassy-rp on stable channel 2022-07-21 20:14:45 +00:00
c40d5f6e6f nrf/usb: prevent user code from constructing a PowerUsb directly.
PowerUsb must be constructed through `new()` so that it sets up the IRQ.
It must have at least one private field, otherwise user code can construct
it directly with `PowerUsb{}`.
2022-07-21 19:47:09 +02:00
424f6ffadb nrf/saadc: add type-erased AnyInput. 2022-07-21 16:42:46 +02:00
26fdfdb00a Merge #869
869: Add some docs. r=Dirbaio a=Dirbaio

bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-07-19 05:59:36 +00:00
d2f4a9bf8d embassy-embedded-hal: docs 2022-07-19 07:58:29 +02:00
3fb83898bc embassy-cortex-m: docs 2022-07-19 07:58:29 +02:00
e5d3f01bc4 Merge #868
868: Rename XXBusDevice to XXDevice. r=Dirbaio a=Dirbaio

I think the current naming is a bit odd, the EH traits are organized as "Bus" vs "Device", and XxxBusDevice is a Device (not a Bus, not both)

`@kalkyl` 

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-07-18 18:15:03 +00:00
a3a40bad6c Rename XXBusDevice to XXDevice. 2022-07-18 20:02:05 +02:00
726d68a706 Add status and instructions in README. 2022-07-17 00:34:41 +02:00
54269a0761 Switch default log to debug.
Trace is very VRYY verbose.
2022-07-17 00:34:27 +02:00
13c88a9ca3 Obtain the firmware blobs from the user instead of hardcoding magic flash addrs. 2022-07-17 00:33:30 +02:00
4205eef3ec Fix iovar_get, unhardcode MAC addr. 2022-07-16 19:25:35 +02:00
4dc800710d Merge #853
853: Add embedded_hal_async support for embassy-rp r=Dirbaio a=danbev

This commit adds support for embedded-hal-async to the Embassy
Raspberry PI crate.

Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2022-07-16 16:11:37 +00:00
931e3d7ee0 Switch to 32bit SPI. 2022-07-16 18:06:57 +02:00
7dfdea8797 Switch to embedded-hal SPI, GPIO traits. 2022-07-16 08:26:54 +02:00
9d388d357a Merge #866
866: F4 flash fixes r=Dirbaio a=chemicstry

This discontinuous flash sector layout is too cursed and I left some mistakes in last PR. Erasing last sector did not work and it wasn't possible to erase between memory banks for 1MB dual-bank devices. So I changed the erase function to iterate over memory addresses (which is continuous) instead of sector numbers.

It should also be possible to implement erase across memory banks for H7, but it requires special handling for write too. I don't have an H7 to test now so left it as is.

I wasn't sure how to add tests to `embassy-stm32` and it seems that there are none, except for `subghz`, but no test runner? Anyway, I tested the `get_sector` on playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=13b59339fe6c70a3249e6183e81f869e

Also fixed erase alignment requirements on `Flash::blocking_erase()`, as it previously only checked alignment on size, but not on offsets.

P.S. the diff is a bit messed up, I recommend looking at files directly

Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-07-15 06:19:05 +00:00
0b70cc554e Fix unused imports 2022-07-14 21:45:44 +03:00
f0027c9fe0 Require erase address to be aligned to page size 2022-07-14 21:21:46 +03:00