Commit graph

3147 commits

Author SHA1 Message Date
Jeremy Fitzhardinge
e4c2b2aa9a rp i2c: have separate wakers for each i2c unit
If they both share one waker, there's the possibility that some wakeups
could get lost.
2022-10-16 18:00:23 -07:00
bors[bot]
b7d0944265
Merge #984 #1006
984: rp pico async i2c implementation r=Dirbaio a=jsgf

This implements an interrupt-driven async i2c master. It is based on https://github.com/embassy-rs/embassy/pull/914, a bit of https://github.com/embassy-rs/embassy/pull/978 and `@ithinuel's` https://github.com/ithinuel/rp2040-async-i2c.git

This is still work-in-progress, and is currently untested.

1006: Removes some of the code duplication for UarteWithIdle r=Dirbaio a=huntc

This PR removes some of the code duplications for `UarteWithIdle` at the slight expense of requiring a split when using idle processing. As the nRF example illustrates though given the LoC removed, this expense seems worth the benefit in terms of maintenance, and the avoidance of copying over methods. My main motivation for this PR was actually due to the `event_endtx` method not having been copied across to the idle-related code.

Tested the uart_idle example on my nRF52840-dk, and from within my app. Both appear to work fine.

Co-authored-by: Jeremy Fitzhardinge <jeremy@goop.org>
Co-authored-by: huntc <huntchr@gmail.com>
2022-10-12 19:41:52 +00:00
bors[bot]
1559374a19
Merge #1010
1010: (embassy-rp): correctly enable RTC_IRQ when scheduling an RTC alarm r=Dirbaio a=MathiasKoch



Co-authored-by: Mathias <mk@blackbird.online>
2022-10-12 19:15:48 +00:00
Mathias
5846b4ff7d Correctly enable RTC_IRQ when scheduling an RTC alarm 2022-10-12 10:54:47 +02:00
bors[bot]
83fcc360fe
Merge #985
985: Create Sx126X LORA driver r=lulf a=ceekdee

Implementation features:

- update embassy-lora to support Semtech SX126X chips, specifically the RAK4631 chip (nrf52480 and sx1262).

- support additional SX126X packages by adding a feature (reference feature rak4631) and updating the board specific Rust file.  To enable feature rak4631, settings.json must currently enable "rust-analyzer.linkedProjects" for "examples/nrf/Cargo.toml".

- provide tx/rx examples in examples/nrf to show compatibility with the interface provided by the SX127X LORA implementation.

Only LORA P2P communication has been tested.  Implementation lines marked with ??? indicate areas for further investigation.  Furthermore, I question whether the DIO1 handler is adequate for catching all interrupt sequences.

This implementation is patterned after the C/C++ implementation provided by Semtech, available through the RAK-nRF52-RUI developers platform.

Co-authored-by: ceekdee <taigatensor@gmail.com>
Co-authored-by: Chuck Davis <91165799+ceekdee@users.noreply.github.com>
2022-10-11 08:48:55 +00:00
bors[bot]
71a56292d6
Merge #1008
1008: Add note on partition sizes to bootloader docs r=lulf a=lulf

See #1007

Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-10-11 08:27:00 +00:00
Ulf Lilleengen
4da6320e63 Add note on partition sizes to bootloader docs
See #1007
2022-10-11 10:20:31 +02:00
ceekdee
327d3cf0df Change rak4631 feature to sx126x, removing use in board-specific processing; simplify the P2P examples; correct RSSI computation. 2022-10-10 12:35:42 -05:00
Chuck Davis
79ba20d315
Merge branch 'embassy-rs:master' into master 2022-10-10 09:17:07 -05:00
bors[bot]
9d5b524bb0
Merge #1005
1005: Expose Pin::pin() and Pin::bank() as public r=lulf a=mkj



Co-authored-by: Matt Johnston <matt@ucc.asn.au>
2022-10-10 06:49:34 +00:00
bors[bot]
ef533e6df4
Merge #1004
1004: Fix internal channels for adc v2 r=lulf a=chemicstry

Internal channel reading was broken on adc_v2, because `Adc::read()` requires gpio pin trait, which was not implemented by `VrefInt`, `Temperature`, `Vbat`. The required configuration bits `tsvrefe`, `vbate` were not enabled either. This PR makes it a bit closer to how adc_v4 works.

While at it, I also changed adc_v2 to use `RccPeripheral` instead of permanently enabling all ADCs.

Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-10-10 06:28:41 +00:00
huntc
e1faf88607 Removes some of the code duplication for UarteWithIdle
This commit removes some of the code duplication for UarteWithIdle at the expense of requiring a split. As the example illustrates though, this expense seems worth the benefit in terms of maintenance, and the avoidance of copying over methods. My main motivation for this commit was actually due to the `event_endtx` method not having been copied across.
2022-10-09 13:07:25 +11:00
Chuck Davis
3d0ba58b2d
Merge branch 'embassy-rs:master' into master 2022-10-08 14:38:41 -05:00
ceekdee
f554962f54 Improve generics and consolidate antenna handling 2022-10-08 14:32:22 -05:00
Matt Johnston
aa8ba2115c Expose Pin::pin() and Pin::bank() as public 2022-10-08 11:44:06 +08:00
chemicstry
322cfafed3 Fix adc_v4 compilation 2022-10-07 14:53:03 +03:00
chemicstry
df7174ecb0 Fix internal channel reading on adc_v2 2022-10-07 14:31:55 +03:00
bors[bot]
f8fd6ab208
Merge #1003
1003: all Cargo.toml: Add license to all crate Cargo.toml files r=lulf a=chrysn

This sets the license to "MIT OR Apache-2.0" in a machine readable form on all crates, as it was already in human readable form in the README.md file, and reaffirmed in #1002.

(The statements on all the individual examples might not be strictly essential for the `cargo deny` use case as they are leaf crates, but other tools might use that information).

Co-authored-by: chrysn <chrysn@fsfe.org>
2022-10-07 11:15:14 +00:00
chrysn
6718ca3a94 all Cargo.toml: Add license to all crate Cargo.toml files
Closes: https://github.com/embassy-rs/embassy/issues/1002
2022-10-07 12:41:56 +02:00
chemicstry
9dca368c3d Use RccPeripheral for adc_v2 2022-10-07 13:29:56 +03:00
Dario Nieuwenhuis
d49d1b6b1c ci/doc: build embassy-time too. 2022-10-05 17:08:02 +02:00
bors[bot]
1b9479197d
Merge #1000
1000: Forgot to add space function to immediate publisher r=lulf a=diondokter

Title says it all really. This function was added to the normal publisher, so now also to the immediate publisher

Co-authored-by: Dion Dokter <dion@tweedegolf.com>
2022-10-05 14:05:56 +00:00
Dion Dokter
530182d668 Forgot to add space function to immediate publisher 2022-10-05 15:15:03 +02:00
bors[bot]
94606833aa
Merge #996
996: Add required info to embassy-sync package r=Dirbaio a=lulf

Updates the README.md based on embassy-futures structure.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-10-04 14:40:49 +00:00
Ulf Lilleengen
59765590e0 Add required info to embassy-sync package
Updates the README.md based on embassy-futures structure.
2022-10-04 16:38:11 +02:00
Jeremy Fitzhardinge
4fd831e4a8 rp async i2c: raise the tx_empty threshold
Assert "tx_empty" interrupt a little early so there's time to wake up
and start refilling the fifo before it drains. This avoids stalling the
i2c bus if the tx fifo completely drains.
2022-10-03 18:50:03 -07:00
Jeremy Fitzhardinge
cae8499179 rp i2c: clean up tx_abrt handling
Make sure we always wait for the stop bit if there's a reason to -
either because we sent one, or because there was a hardware tx abort.
2022-10-03 01:18:26 -07:00
Dario Nieuwenhuis
f075e62444 Use 1 thread in ci doc building. 2022-10-03 01:59:44 +02:00
Jeremy Fitzhardinge
e8bb8faa23 rp i2c: allow blocking ops on async contexts 2022-10-02 15:09:14 -07:00
Dario Nieuwenhuis
63f5602111
Merge pull request #994 from embassy-rs/ci-docs
Build docs in CI
2022-10-02 23:31:11 +02:00
Dario Nieuwenhuis
753781a263 Build docs in CI 2022-10-02 23:30:12 +02:00
bors[bot]
73208d5248
Merge #993
993: rp i2c: blocking example r=Dirbaio a=jsgf

i2c example talking to mcp23017 i2c gpio expander.

Co-authored-by: Jeremy Fitzhardinge <jeremy@goop.org>
2022-10-02 18:58:49 +00:00
Jeremy Fitzhardinge
09afece93d make I2c::write_async take an iterator
There's no other iterator async API right now.
2022-10-01 19:28:27 -07:00
Jeremy Fitzhardinge
1ee4bb22de embassy-rp i2c: async (non-blocking) example
Simple example exercising an mcp23017 GPIO expander, configured on
RP2040 GPIOs 14+15 (i2c1) with 8 inputs and 8 outputs. Input bit 0
controls whether to display a mcp23017 register dump.
2022-10-01 13:43:37 -07:00
Jeremy Fitzhardinge
5e2c52ee5b embassy-rp: async i2c implementation
This is an interrupt-driven async i2c master implementation. It makes as
best use of the RP2040's i2c block's fifos as possible to minimize
interrupts.

It implements embedded_hal_async::i2c for easy interop.
WIP async impl
2022-10-01 13:43:37 -07:00
Jeremy Fitzhardinge
72b645b0c9 rp i2c: make blocking only for Mode=Blocking 2022-10-01 13:26:13 -07:00
Jeremy Fitzhardinge
8d38eacae4 rp i2c: remove vestiges of DMA 2022-10-01 13:26:13 -07:00
Jeremy Fitzhardinge
90d392205f embassy-rp: inline I2c::regs
It just returns a literal constant, so there's no reason not to always inline it.
2022-10-01 13:26:13 -07:00
Jeremy Fitzhardinge
c96581879c update embedded-hal api
Also pin to alpha.9 since its a breaking change
2022-10-01 01:34:45 -07:00
Jeremy Fitzhardinge
d5abd32da2 rename to i2c_blocking 2022-10-01 01:29:10 -07:00
Jeremy Fitzhardinge
9f77dbf5ae rp i2c: blocking example
i2c example talking to mcp23017 i2c gpio expander.
2022-10-01 01:29:10 -07:00
bors[bot]
aabc02506b
Merge #992
992: (embassy-stm32): remove flash lock/unlock public API from stm32 flash r=lulf a=MathiasKoch

Instead, perform the unlocking and locking automatically on erase and write operations.

This makes the `embedded-storage` abstraction actually useable in libraries, while still keeping the flash peripheral locked the majority of the time.

Co-authored-by: Mathias <mk@blackbird.online>
2022-09-30 11:32:27 +00:00
bors[bot]
99284b8304
Merge #981
981: (embassy-stm32): add E-H1 uart blocking & nb implementation r=MathiasKoch a=MathiasKoch



Co-authored-by: Mathias <mk@blackbird.online>
2022-09-30 04:14:52 +00:00
Mathias
a283c47557 Implement embedded-hal-nb for uart 2022-09-30 06:04:19 +02:00
Mathias
a7fdeac560 Remove flash lock/unlock public API from stm32 flash, and perform the unlocking and locking automatically on erase and write operations 2022-09-30 06:00:46 +02:00
Mathias
88a3c360e8 Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-stm32/uart-eh1 2022-09-30 05:23:59 +02:00
bors[bot]
1d6f5493e7
Merge #991
991: usb: remove all "Direction as u8" casts. r=Dirbaio a=Dirbaio

Alternative fix for #989 , see comment there for rationale.

bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-09-29 13:53:22 +00:00
Dario Nieuwenhuis
dab1762709 usb: remove all "Direction as u8" casts. 2022-09-29 15:52:23 +02:00
bors[bot]
ebf5a92ab2
Merge #990
990: Small pubsub improvements r=Dirbaio a=diondokter

- Futures in pub & sub are now awaited instead of returned
- Added functions for reading how many messages are available

This helps people get better compiler diagnostics. For example, I forgot to call await on a future and the compiler didn't complain.
This also helps with making some decisions based on the state of the channels.

Co-authored-by: Dion Dokter <dion@tweedegolf.com>
2022-09-29 13:28:56 +00:00
Dion Dokter
874384826d Went back to named futures but now with must_use 2022-09-29 15:15:10 +02:00