Commit Graph

2938 Commits

Author SHA1 Message Date
bors[bot]
ad6943adb3
Merge #795
795: Update stm32-metapac. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-06 22:35:47 +00:00
Dario Nieuwenhuis
0aa73f58e2 Update stm32-metapac. 2022-06-07 00:28:26 +02:00
bors[bot]
62add4b2ab
Merge #792 #794
792: Add example for using a Signal. r=Dirbaio a=hydra

I didn't find an example, so I created one for the STM32H7.  Code based on the nrf mutex.rs example.

794: Fix F1 compilation by implementig AF pullup r=Dirbaio a=chemicstry

Embassy fails to compile on `STM32F103RET6`, because `set_as_af_pull` function is missing for GPIOv1:

```
error[E0599]: no method named `set_as_af_pull` found for mutable reference `&mut CLK` in the current scope
    --> C:\Users\chemi\.cargo\git\checkouts\embassy-0cff10c9b9902273\46473ae\embassy-stm32\src\sdmmc\mod.rs:1390:21
     |
1390 |             clk_pin.set_as_af_pull(clk_pin.af_num(), AFType::OutputPushPull, Pull::None);
     |                     ^^^^^^^^^^^^^^ method not found in `&mut CLK`
```

GPIOv1 actually supports pullups in AF mode, but only for inputs. The `sdmmc` driver, which was causing compile errors uses pullups for push-pull outputs and this will silently fail. But IMO not adding pullups to sdmmc interface is a hardware design problem, not HAL.

Co-authored-by: Dominic Clifton <me@dominicclifton.name>
Co-authored-by: chemicstry <chemicstry@gmail.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-06 15:45:03 +00:00
Dario Nieuwenhuis
fdc6cfed3e stm32: add stm32f103re to CI 2022-06-06 17:43:55 +02:00
chemicstry
b0ffd9a1cc Fix AF pullup configuration for GPIOv1 2022-06-06 17:12:52 +03:00
Dominic Clifton
1bad6a4989 Add example for using a Signal. 2022-06-06 11:54:01 +02:00
bors[bot]
34673f52c9
Merge #791
791: Channel clarification r=lulf a=diondokter

This was unclear from the docs.

Co-authored-by: Dion Dokter <diondokter@gmail.com>
2022-06-03 12:31:40 +00:00
Dion Dokter
9efaae495b
Channel clarification
This was unclear from the docs.
2022-06-03 14:27:33 +02:00
Ulf Lilleengen
9d5af531e3
Update copyright holder names and add notice file (#790)
* Update copyright holder names

Fixes #472

* Add notice file to clarify copyright ownership

The NOTICE file declares that copyright is owned by the individuals
contributing to Embassy, and that all contributed work is licensed under
Apache-2.0 or MIT.
2022-06-02 13:09:37 +02:00
bors[bot]
dbff4779eb
Merge #789
789: Embassy net improvements r=lulf a=lulf

I found these useful while implementing the TcpClient traits for embedded-nal-async:

https://github.com/drogue-iot/drogue-device/blob/shared-tcp-stack/device/src/drivers/tcp/smoltcp.rs

Once e-n-a PR is merged, I might add the above client to embassy-net if you think it makes sense.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-06-01 18:09:51 +00:00
Ulf Lilleengen
8b676e65ad Add embedded-io implementation of ConnectError 2022-06-01 13:48:28 +02:00
Ulf Lilleengen
39cffdd123 Add reexport for ipv6 types with proto-ipv6 2022-06-01 13:48:09 +02:00
bors[bot]
0adb4c926b
Merge #784
784: stm32: make tick rate configurable r=Dirbaio a=willglynn

The stm32 time drivers support arbitrary tick rates but the associated Cargo features do not. Enabling any time driver presently enables `embassy/time-tick-32768hz`; instead, enable only `embassy/time`.

Additionally, `embassy/time` now functions in the absence of any `embassy/time-tick-*` feature, defaulting to 32768 Hz if left unspecified.

Co-authored-by: Will Glynn <will@willglynn.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-05-31 21:55:40 +00:00
Dario Nieuwenhuis
1089674175 fix build adding missing time-tick feature. 2022-05-31 23:53:42 +02:00
Dario Nieuwenhuis
d13d893ff2 boot/stm32: autodetect thumbv6, remove cargo feature. 2022-05-31 23:52:27 +02:00
Will Glynn
962fabe5c9 examples/stm32*, tests/stm32: specify time-tick-32768hz 2022-05-31 16:14:23 -05:00
Will Glynn
34a8a64bf5 stm32: make tick rate configurable
The stm32 time drivers support arbitrary tick rates but the associated
Cargo features do not. Enabling any time driver presently enables
`embassy/time-tick-32768hz`; instead, enable only `embassy/time`.

This is a breaking change: users must now choose a tick rate. The
previous behavior is available by enabling the
`embassy/time-tick-32768hz` feature, but now users may also choose
`embassy/time-tick-1000hz` or `embassy/time-tick-1mhz` instead.
2022-05-30 20:13:25 -05:00
bors[bot]
a0d43c863d
Merge #788
788: Misc USB improvements, for stm32 r=Dirbaio a=Dirbaio

See individual commit messages. 

These changes help implementing the driver for STM32 USBD (#709)

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-05-31 00:46:22 +00:00
bors[bot]
70e4418df9
Merge #781 #785
781:  embassy-net v2 r=Dirbaio a=Dirbaio

- No more `dyn`
- It's no longer a global singleton, you can create muliple net stacks at once.
  - You can't tear them down though, the Device it still has to be `'static` due to restrictions with smoltcp's "fake GAT" in the Device trait. :(
- Removed `_embassy_rand` hack, random seed is passed on creation.



785: stm32: g0: add PLL clock source r=Dirbaio a=willglynn

STM32G0 SYSCLK can be sourced from PLLRCLK. Given that the HSI runs at 16 MHz and the HSE range is 4-48 MHz, the PLL is the only way to reach 64 MHz. This commit adds `ClockSrc::PLL`.

The PLL sources from either HSI16 or HSE, divides it by `m`, and locks its VCO to multiple `n`. It then divides the VCO by `r`, `p`, and `q` to produce up to three associated clock signals:

  * PLLRCLK is one of the inputs on the SYSCLK mux. This is the main reason the user will configure the PLL, so `r` is mandatory and the output is enabled unconditionally.
  * PLLPCLK is available as a clock source for the ADC and I2S peripherals, so `p` is optional and the output is conditional.
  * PLLQCLK exists only on STM32G0B0xx, and exists only to feed the MCO and MCO2 peripherals, so `q` is optional and the output is conditional.

When the user specifies `ClockSrc::PLL(PllConfig)`, `rcc::init()` calls `PllConfig::init()` which initializes the PLL per [RM0454]. It disables the PLL, waits for it to stop, enables the source oscillator, configures the PLL, waits for it to lock, and then enables the appropriate outputs. `rcc::init()` then switches the clock source to PLLRCLK.

`rcc::init()` is now also resonsible for calculating and setting flash wait states. SYSCLCK < 24 MHz is fine in the reset state, but 24-48 MHz requires waiting 1 cycle and 48-64 MHz requires waiting 2 cycles. (This was likely a blocker for anyone using HSE >= 24 MHz, with or without the PLL.) Flash accesses are now automatically slowed down as needed before changing the clock source, and sped up as permitted after changing the clock source. The number of flash wait states also determines if flash prefetching will be profitable, so that is now handled automatically too.

[RM0454]: https://www.st.com/resource/en/reference_manual/rm0454-stm32g0x0-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
Co-authored-by: Will Glynn <will@willglynn.com>
2022-05-31 00:25:21 +00:00
Dario Nieuwenhuis
39ab599eed usb: set default max_packet_size_0 to 64.
Supported chips can always do 64 bytes, 8 bytes seems to be more rare.
We can add a way for the driver to specify the default in the future.
2022-05-31 02:01:22 +02:00
Dario Nieuwenhuis
a7383840e7 usb: make ControlPipe accept, reject async. 2022-05-30 00:35:27 +02:00
Dario Nieuwenhuis
883e28a0fb usb: add first, last params to ControlPipe data_in, data_out. 2022-05-30 00:08:28 +02:00
Dario Nieuwenhuis
1ec2e5672f usb: remove is_stalled, set_stalled from Endpoint.
They're unused, and I believe it's not allowed for classes to
stall EPs on their own?
2022-05-30 00:07:15 +02:00
Dario Nieuwenhuis
98d8c9373d usb: delay bus.set_address() to after ending the control transfer. 2022-05-30 00:03:36 +02:00
bors[bot]
842c7d08ab
Merge #787
787: Update embedded-hal-async to 0.1.0-alpha.1 r=Dirbaio a=Dirbaio

bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-05-29 20:34:41 +00:00
Dario Nieuwenhuis
6320e30adf Update embedded-hal-async to 0.1.0-alpha.1 2022-05-29 22:34:08 +02:00
Will Glynn
1c2b27dcad embassy-stm32: g0: add PLL clock source
STM32G0 SYSCLK can be sourced from PLLRCLK. Given that the HSI runs at
16 MHz and the HSE range is 4-48 MHz, the PLL is the only way to reach
64 MHz. This commit adds `ClockSrc::PLL`.

The PLL sources from either HSI16 or HSE, divides it by `m`, and locks
its VCO to multiple `n`. It then divides the VCO by `r`, `p`, and `q`
to produce up to three associated clock signals:

  * PLLRCLK is one of the inputs on the SYSCLK mux. This is the main
    reason the user will configure the PLL, so `r` is mandatory and
	the output is enabled unconditionally.
  * PLLPCLK is available as a clock source for the ADC and I2S
    peripherals, so `p` is optional and the output is conditional.
  * PLLQCLK exists only on STM32G0B0xx, and exists only to feed the
    MCO and MCO2 peripherals, so `q` is optional and the output is
	conditional.

When the user specifies `ClockSrc::PLL(PllConfig)`, `rcc::init()`
calls `PllConfig::init()` which initializes the PLL per [RM0454]. It
disables the PLL, waits for it to stop, enables the source
oscillator, configures the PLL, waits for it to lock, and then
enables the appropriate outputs. `rcc::init()` then switches the
clock source to PLLRCLK.

`rcc::init()` is now also resonsible for calculating and setting flash
wait states. SYSCLCK < 24 MHz is fine in the reset state, but 24-48 MHz
requires waiting 1 cycle and 48-64 MHz requires waiting 2 cycles. (This
was likely a blocker for anyone using HSE >= 24 MHz, with or without
the PLL.) Flash accesses are now automatically slowed down as needed
before changing the clock source, and sped up as permitted after
changing the clock source. The number of flash wait states also
determines if flash prefetching will be profitable, so that is now
handled automatically too.

[RM0454]: https://www.st.com/resource/en/reference_manual/rm0454-stm32g0x0-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
2022-05-27 23:56:42 -05:00
bors[bot]
82e873d920
Merge #783
783: Reimplement BufRead for BufferedUart r=Dirbaio a=chemicstry

The `AsyncBufRead` implementation for `BufferedUart` was removed in https://github.com/embassy-rs/embassy/pull/752, this PR reimplements it from `embedded-io`. This allows reading `BufferedUart` without copying slices.

Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-05-27 16:03:19 +00:00
chemicstry
9772645718 Revert "Fix irq pend behavior"
This reverts commit 9a447f1359.
2022-05-26 23:36:25 +03:00
chemicstry
9a447f1359 Fix irq pend behavior 2022-05-26 23:24:02 +03:00
chemicstry
c3b899c470 Implement BufRead for nrf BufferedUarte 2022-05-26 23:15:06 +03:00
Henrik Alsér
e10fc2bada
Async shared bus for SPI & I2C + rename embassy-traits (#769)
* Rename embassy-traits to embassy-embedded-hal

* Rename embassy-traits to embassy-embedded-hal

* Add shared bus for SPI and I2C

* rustfmt

* EHA alpha 1

* Rename embedded-traits in examples

* rustfmt

* rustfmt

Co-authored-by: Henrik Alsér <henrik@mindbite.se>
2022-05-26 18:54:58 +02:00
chemicstry
667abe6d1d Simplify example 2022-05-26 14:11:15 +03:00
chemicstry
4b6162694a Fix removed space 2022-05-26 14:05:56 +03:00
chemicstry
1d951a54be Reimplement BufRead for BufferedUart 2022-05-26 14:02:55 +03:00
Dario Nieuwenhuis
a5aea995a8 WIP embassy-net v2 2022-05-25 19:56:22 +02:00
bors[bot]
36a1f20364
Merge #770
770: Add open-drain support for embassy-rp r=danbev a=danbev

This commit adds open-drain support for embassy-rp by adding a new type
named `embassy_rp::gpio::OutputOpenDrain`.



Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2022-05-21 10:26:55 +00:00
Daniel Bevenius
027ab3371e Impl OutputPin/StatefulOutputPin/ToggleableOutputPin
This commit implements embedded_hal_02::digital::v2 OutputPin,
StatefulOutputPin, and ToggleableOutputPin for embassy-rp.
2022-05-21 10:11:12 +02:00
Daniel Bevenius
c8461709e3 Add open-drain support for embassy-rp
This commit adds open-drain support for embassy-rp by adding a new type
named embassy_rp::gpio::OutputOpenDrain.
2022-05-21 10:11:06 +02:00
bors[bot]
e4072d7ff3
Merge #780
780: Add new lines between SIO methods r=Dirbaio a=danbev

The commit adds new lines between the SIO functions which at least for
me improves readability and is consistent with the other methods in the
trait.

Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2022-05-19 20:17:32 +00:00
Daniel Bevenius
4b0dca1802 Add new lines between SIO methods
The commit adds new lines between the SIO functions which at least for
me improves readability and is consistent with the other methods in the
trait.
2022-05-19 13:45:40 +02:00
Dario Nieuwenhuis
d0fe9af458
Merge pull request #771 from embassy-rs/net-split
net: add split() to tcpsocket
2022-05-19 07:13:24 +02:00
Dario Nieuwenhuis
dd7a34fdc8
Merge pull request #773 from danbev/embassy-rp-ouput-drop
Impl drop for embassy-rp gpio Output
2022-05-19 07:13:13 +02:00
Dario Nieuwenhuis
220c6c83cb
Merge pull request #779 from danbev/embassy-rp-toggleable-output-impl
Impl ToggleableOutputPin for embassy-rp Output
2022-05-19 07:12:43 +02:00
Dario Nieuwenhuis
e3b8e35498 Make embassy-net nightly-only.
It's useless without async traits, so juggling the `nightly` feature
around is not worth the pain.
2022-05-19 06:15:01 +02:00
Dario Nieuwenhuis
0b2f43c391 net: add split() to tcpsocket 2022-05-19 06:14:05 +02:00
Daniel Bevenius
99c2defa76 squash! Impl ToggleableOutputPin for embassy-rp Output
Use value_xor as suggested in pull request feedback.
2022-05-19 06:07:14 +02:00
bors[bot]
7743b8e1ae
Merge #776
776: Automatically set ADC clock prescaler on v2 ADC to respect max frequency r=Dirbaio a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2022-05-19 04:00:23 +00:00
Daniel Bevenius
da97944322 Impl ToggleableOutputPin for embassy-rp Output 2022-05-19 05:33:42 +02:00
bors[bot]
240bef8c9f
Merge #778
778: Update embedded-io to 0.3 r=Dirbaio a=Dirbaio

bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-05-18 22:36:49 +00:00