Ulf Lilleengen
bb89a2341c
feat: embassy-boot for rp2040
...
Add embassy-boot support for RP2040, with examples for the Raspberry Pi
Pico.
Co-authored-by: Mathias Koch <mk@blackbird.online>
2022-12-02 11:28:33 +01:00
Gabriel Smith
71df28e269
rp: Add an RngCore impl based on ROSC.RANDOMBIT
...
This has the potential to not be random, but it should not be an issue
if default clock settings are used.
2022-11-30 14:06:05 -05:00
Gabriel Smith
4d84b5469e
Drive-by documentation link fixes
2022-11-27 16:32:18 -05:00
Gabriel Smith
3ca14ba4e9
usb-driver: Remove unncessary lifetime
2022-11-27 16:28:24 -05:00
Dario Nieuwenhuis
7b838d0336
rp/uart: use lockfree ringbuffer.
...
This gets rid of another PeripheralMutex usage.
2022-11-25 22:30:47 +01:00
Dario Nieuwenhuis
1e2fb0459d
Switch to async-fn-in-trait
2022-11-25 21:02:06 +01:00
Henrik Alsér
908eef2775
Change interrupt modify into write
2022-11-22 02:03:34 +01:00
Henrik Alsér
9f870a5edf
Cleanup
2022-11-15 16:31:19 +01:00
Henrik Alsér
eb149a0bd4
embassy-rp: Add basic ADC module
2022-11-15 16:12:07 +01:00
Mathias
c871fe0848
Rebase on master
2022-10-27 07:12:34 +02:00
Mathias
3c6c382465
Remove random delay from example, and move flash functions to allow using without embedded-storage in scope
2022-10-27 07:10:35 +02:00
bors[bot]
e5097a8866
Merge #959
...
959: Generic, executor-agnostic queue implementation r=ivmarkov a=ivmarkov
Hopefully relatively well documented.
Implementation relies on a fixed-size `SortedLinkedList` from `heapless`. (By default, for up to 128 timer schedules, but we can lower this number to - say - 64.)
As discussed earlier, on queue overflow, the `WakerRegistration` approach is utilized, whereas the waker that is ordered first in the queue is awoken to make room for the incoming one (which might be the waker that would be awoken after all!). Wakers are compared with `Waker::will_wake`, so the queue should actually not fill up that easily, if at all.
I've left provisions for the user to manually instantiate the queue using a dedicated macro - `generic_queue!` so that users willing to adjust the queue size, or users (like me) who have to use the queue in a complex "on-top-of-RTOS-but-the-timer-driver-calling-back-from-ISR" scenario can customize the mutex that protects the queue.
The one thing I'm not completely happy with is the need to call `{ embassy_time::queue::initialize() }` early on before any futures using embassy-time are polled, which is currently on the shoulders of the user. I'm open to any ideas where we can get rid of this and do it on the first call to `_embassy_time_schedule_wake`, without introducing very complex combinations of critical sections, atomics and whatnot.
Co-authored-by: ivmarkov <ivan.markov@gmail.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-10-26 19:14:12 +00:00
Dario Nieuwenhuis
eeb072d9cb
Update Rust nightly.
2022-10-26 16:47:29 +02:00
Mathias
1669e39565
Buffer data to be written to flash in ram if it does not already reside in ram
2022-10-26 15:02:39 +02:00
Mathias
80e58426fc
Add flash example & flash HIL test
2022-10-26 12:24:04 +02:00
Mathias
ad0eb3f4bd
Implement flash padding to 256 under assumption that all QSPI NOR flashes are MultiwriteNorFlashes
2022-10-24 12:17:22 +02:00
Mathias
8d809c96ec
Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-rp/flash
2022-10-24 12:14:26 +02:00
ivmarkov
f78c706b89
Address review feedback
2022-10-24 11:10:59 +03:00
ivmarkov
4d5550070f
Change time Driver contract to never fire the alarm synchronously
2022-10-24 09:17:43 +03:00
bors[bot]
495ca6108c
Merge #1020
...
1020: Fix mistaken EP_IN_WAKERS r=Dirbaio a=mkj
I'm not totally certain, but this looks like a typo?
Co-authored-by: Matt Johnston <matt@ucc.asn.au>
2022-10-21 20:43:14 +00:00
Matt Johnston
866a42f3ae
rp usb: wait for accept() completion
...
This ensures that the current response has finished being sent
before the subsequent set_address() happens. Otherwise connecting
a device is intermittent, can fail depending on timing.
2022-10-21 22:02:13 +08:00
Matt Johnston
f45d34ce7c
Fix mistaken EP_IN_WAKERS
2022-10-20 23:46:02 +08:00
Jeremy Fitzhardinge
02a3cdb507
Associate state with the instance rather than having a separate array
2022-10-17 21:50:40 -07:00
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
Mathias
5846b4ff7d
Correctly enable RTC_IRQ when scheduling an RTC alarm
2022-10-12 10:54:47 +02:00
Matt Johnston
aa8ba2115c
Expose Pin::pin() and Pin::bank() as public
2022-10-08 11:44:06 +08: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
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
Jeremy Fitzhardinge
e8bb8faa23
rp i2c: allow blocking ops on async contexts
2022-10-02 15:09:14 -07: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
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
Ulf Lilleengen
72c2e985bb
Update embedded-hal versions and explicitly pin
2022-09-29 11:27:46 +02:00
Mathias
7152031229
Add flash ram helpers
2022-09-29 10:03:49 +02:00
Mathias
7ee7109508
Rebase on master
2022-09-29 10:00:13 +02:00
Mathias
bf1da0497c
Allow unused fields temporarily in i2c
2022-09-27 22:08:49 +02:00
Mathias
44c46e3c93
Move async i2c implementation to new PR, to merge working blocking implementation faster
2022-09-27 22:08:49 +02:00
Mathias Koch
b0d91e9f31
Apply suggestions from code review
...
Co-authored-by: Jacob Gonzalez <jacobgonzalez5252@gmail.com>
2022-09-27 22:08:49 +02:00
Mathias
53c34ccc39
Add async API for I2C
2022-09-27 22:08:49 +02:00
Mathias
be68d8ebb7
Add further i2c error types
2022-09-27 22:08:49 +02:00
Mathias
603513e76e
Fix blocking I2C
2022-09-27 22:08:49 +02:00
Mathias
bcd3ab4ba1
Add blocking read & write for I2C
2022-09-27 22:08:49 +02:00
Mathias
820e6462b6
Add preliminary I2C implementation for RP2040
2022-09-27 22:08:49 +02:00
Dario Nieuwenhuis
17d8d11f73
usb: make HALs depend only on embassy-usb-driver.
2022-09-27 13:16:49 +02:00
Mathias
e129a97d48
Fix bufferedUart read and write tests
2022-09-27 07:45:10 +02:00
Mathias
65907204d6
Rename from {Rx,Tx}BufferedUart to BufferedUart{Rx,Tx} to be compliant with stm32 and nrf implementations
2022-09-27 05:51:31 +02:00
Mathias
f76444bdc4
Add HIL test for bufferedUart
2022-09-26 20:34:55 +02:00
Mathias
b3dfd06dd6
Remove code-duplication in async bufferedUart implementations
2022-09-26 20:34:55 +02:00
Mathias
1db9e464ff
Enable embedded-io on nightly
2022-09-26 20:34:55 +02:00
Mathias
d6af0f6286
Formatting
2022-09-26 20:34:55 +02:00
Mathias
f2239d34cc
Add bufferedUart, including a split version for only Rx or Tx
2022-09-26 20:34:55 +02:00
Mathias
ee76831f93
Add BufferedUart implementation, and feature-guard time-driver initialization, to free up TIMER peripheral if not used with embassy executor
2022-09-26 20:34:55 +02:00
Dario Nieuwenhuis
1e95c4fcff
rp: Disable intrinsics by default.
2022-09-26 19:53:22 +02:00
bors[bot]
49070c75b6
Merge #972
...
972: Restructure USB crates r=Dirbaio a=Dirbaio
- Split driver from `embassy-usb` to a separate crate. This allows making breaking changes to `embassy-usb` without having to bump all the crates with driver impls, such as HALs.
- Merge classes into `embassy-usb`. Now that breaking changes to `embassy-usb` aren't that bad, having everything in a single crate is much easier.
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-09-26 11:32:41 +00:00
Dario Nieuwenhuis
7f7c14b7bc
usb: split driver trait to separate crate.
2022-09-26 12:29:27 +02:00
Dario Nieuwenhuis
fa7781c48d
Add credits to rp-hal
2022-09-26 11:57:26 +02:00
Mathias
18dc0dea63
Drop rp2040-flash as dependency, as they pull in rp2040-hal for rom-data functions, which are now part of this HAL as well
2022-09-23 08:12:32 +02:00
Mathias
9d674f0212
First iteration attempt on implementing generic flash mutation access for RP2040
2022-09-23 07:59:10 +02:00
Mathias
816778e3fa
Add RP2040 ROM functions and intrinsics aliases
2022-09-23 07:58:48 +02:00
Dario Nieuwenhuis
4f33cc5d1a
Replace futures::future::join -> embassy_futures::join::join.
2022-09-23 07:58:48 +02:00
Dario Nieuwenhuis
2fed9f949a
Replace futures::future::poll_fn -> core::future::poll_fn.
2022-09-23 07:58:48 +02:00
Dario Nieuwenhuis
7412a859fd
Update Rust nightly.
...
Removes feature(generic_associated_types)
2022-09-23 07:58:48 +02:00
Mathias
0db1332da8
Implement RealTimeClock for embassy-rp
2022-09-23 07:58:48 +02:00
Alex Martens
4322293f63
rp: let SPI RX overflow during async write
2022-09-23 07:58:48 +02:00
Alex Martens
c14527486d
rp: fix async SPI read and write
2022-09-23 07:58:48 +02:00
Alex Martens
81298394b5
rp: remove extraneous newlines in logs
2022-09-23 07:58:48 +02:00
Mathias
5d1576ea73
Add time-driver feature to docs
2022-09-23 07:58:48 +02:00
Mathias
f46b838746
Feature-gate time-driver in embassy-rp
2022-09-23 07:58:48 +02:00
Mathias
2e7916c5fe
Add RP2040 ROM functions and intrinsics aliases
2022-09-23 06:45:44 +02:00
Dario Nieuwenhuis
10d1ad2343
Replace futures::future::join -> embassy_futures::join::join.
2022-09-22 16:48:35 +02:00
Dario Nieuwenhuis
a0487380da
Replace futures::future::poll_fn -> core::future::poll_fn.
2022-09-22 16:42:49 +02:00
Dario Nieuwenhuis
897b72c872
Update Rust nightly.
...
Removes feature(generic_associated_types)
2022-09-22 16:38:14 +02:00
bors[bot]
3b58ac1bf8
Merge #949
...
949: (embassy-rp): Implement RealTimeClock r=lulf a=MathiasKoch
Basically a 1:1 port of the great implementation effort made by `rp-hal`
Co-authored-by: Mathias <mk@blackbird.online>
2022-09-21 07:19:23 +00:00
bors[bot]
6663390224
Merge #954
...
954: rp: fix async SPI read and write r=lulf a=newAM
Closes #953
Co-authored-by: Alex Martens <alex@thinglab.org>
2022-09-19 07:26:10 +00:00
Alex Martens
0c6933fefb
rp: remove extraneous newlines in logs
2022-09-18 14:54:24 -07:00
Alex Martens
295cc997ae
rp: let SPI RX overflow during async write
2022-09-18 12:23:17 -07:00
Alex Martens
ab1a6889a6
rp: fix async SPI read and write
2022-09-18 12:02:05 -07:00
Mathias
1c657d2d55
Add time-driver feature to docs
2022-09-16 16:45:59 +02:00
Mathias
feb840c503
First iteration attempt on implementing generic flash mutation access for RP2040
2022-09-16 13:20:22 +02:00
Mathias
feead3ae89
Implement RealTimeClock for embassy-rp
2022-09-16 13:18:23 +02:00
Mathias
f7267d493f
Feature-gate time-driver in embassy-rp
2022-09-16 12:54:26 +02:00
Dario Nieuwenhuis
5327b9c289
time: add more tick rates, use 1mhz as default.
2022-09-02 00:59:34 +02:00
Henrik Alsér
efe456ab14
Fix dma
2022-09-01 15:50:08 +02:00
Henrik Alsér
71c130488b
Reorder args
2022-09-01 15:12:44 +02:00
Henrik Alsér
e2181cb439
rustfmt
2022-09-01 15:12:44 +02:00
Henrik Alsér
b934f3f12e
Remove cfg_if
2022-09-01 15:12:44 +02:00
Henrik Alsér
3fce6ec649
Rearrange new:s
2022-09-01 15:12:44 +02:00
Henrik Alsér
27905f1be1
Change DMA write/read to use raw pointers
2022-09-01 15:12:44 +02:00
Henrik Alsér
99dd2a9386
Reorder args
2022-09-01 15:12:44 +02:00
Henrik Alsér
6d347af9fa
transfer_in_place
2022-09-01 15:12:43 +02:00
Henrik Alsér
44150c4830
impl embedded-hal-async
2022-09-01 15:12:43 +02:00
Henrik Alsér
07c64d902e
example
2022-09-01 15:12:43 +02:00
Henrik Alsér
e7d4bf258a
dma
2022-09-01 15:12:43 +02:00
Dario Nieuwenhuis
8ba421f324
Do not use cfg_if for embedded-hal-async feature gates.
...
Old code used `cfg_if!` because rustc still parses code inside disabled cfg's, and Rust stable at that time couldn't parse the new GAT where-clause location. This is not the case anymore.
2022-08-31 03:11:21 +02:00
Dario Nieuwenhuis
e4d4166da2
Merge pull request #927 from embassy-rs/rp-usb
...
rp: add usb device support.
2022-08-30 19:15:44 +02:00
Mathias
bd27b9080f
Add HIL tests of DMA & UART, and correctly set DREQ for uart DMA
2022-08-26 12:55:15 +02:00
Dario Nieuwenhuis
a730e2cd0f
rp: add usb device support.
2022-08-25 00:03:55 +02:00
Dario Nieuwenhuis
f11aa9720b
rp: update PAC
2022-08-24 23:43:28 +02:00
Mathias
b88ef03214
Only check for ahb error in DMA
2022-08-23 13:46:48 +02:00
Mathias
594a64b3bf
Change to using embassy-sync
2022-08-23 13:28:14 +02:00
Mathias
36cf719a18
Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-rp/dma
2022-08-23 13:24:52 +02:00
Mathias
7e3ce2c90b
Abort DMA operation when dropping a Transfer, and panic on DMA errors
2022-08-23 13:20:36 +02:00
Mathias
f6c2e26372
Address code review comments
2022-08-23 12:28:17 +02:00
Dario Nieuwenhuis
21072bee48
split embassy-util
into embassy-futures
, embassy-sync
.
2022-08-22 22:18:13 +02:00
Dario Nieuwenhuis
f48391a685
rp: fix nvic prio bits (it's 2, not 3)
2022-08-22 16:29:34 +02:00
Mathias
295af2a057
Fix bit checking in DMA irq
2022-08-19 14:16:19 +02:00
Mathias
331a64a4ea
Add back public dma::copy, and correct dma incr settings for read/write
2022-08-19 10:43:59 +02:00
Mathias
140ef4febf
Add DMA_IRQ0 handling to Transfer
2022-08-19 09:48:58 +02:00
Mathias
aa586fe1de
Simplify waker storage for DMA state
2022-08-18 21:27:37 +02:00
Mathias
debff0980d
Don't increment read address in DMA copy from peripherals
2022-08-18 21:20:47 +02:00
Mathias
1d49b3444f
Add DMA read + write functions
2022-08-18 21:09:50 +02:00
Mathias
a7d6bc7ba5
Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-rp/dma
2022-08-18 21:08:57 +02:00
bors[bot]
aefa5275a2
Merge #910
...
910: (embassy-rp): Implement remaining logic for blocking UART r=lulf a=MathiasKoch
async read/write is still `todo!()`, awaiting DMA implementation.
Co-authored-by: Mathias <mk@blackbird.online>
2022-08-18 18:36:27 +00:00
Mathias
9c9b7b1a66
Remove unneeded NoDma struct
2022-08-18 20:34:55 +02:00
Mathias
55a63a5417
Attempt to implement future for DMA transfer
2022-08-18 20:30:50 +02:00
Mathias
3bbfc11f45
Stop active DMA transfer on drop
2022-08-18 20:30:24 +02:00
Mathias
d35a1c9790
Preliminary DMA support for RP2040
2022-08-18 19:39:13 +02:00
Mathias
0f74f870b0
Fix rp uart example
2022-08-18 14:01:37 +02:00
Mathias
d52c7ded49
Implement remaining logic for blocking UART. async is still todo, awaiting DMA
2022-08-18 10:23:29 +02:00
Dario Nieuwenhuis
5daa173ce4
Split embassy-time from embassy-executor.
2022-08-18 01:22:30 +02:00
Dario Nieuwenhuis
fc6e1e06b3
Remove HAL initialization from #[embassy::main] macro.
2022-08-17 22:16:46 +02:00
Dario Nieuwenhuis
67edea4168
Update to critical-section 1.0, atomic-polyfill 1.0
2022-08-17 19:01:56 +02: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
Dario Nieuwenhuis
a0f1b0ee01
Split embassy crate into embassy-executor, embassy-util.
2022-07-29 23:40:36 +02:00
Dario Nieuwenhuis
f02ba35482
Remove PeripheralRef::into_inner()
2022-07-23 14:27:45 +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
Dario Nieuwenhuis
be6408e202
Rename unsafe_impl_unborrow to impl_unborrow
2022-07-23 01:33:22 +02:00
Grant Miller
bff0ad9286
Update embassy-rp
2022-07-23 01:33:22 +02:00
Daniel Bevenius
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
Jan Niehusmann
aff840cf30
Fix build of embassy-rp on stable channel
2022-07-21 20:14:45 +00:00
Daniel Bevenius
8979959dd1
Add embedded_hal_async support for embassy-rp
...
This commit adds support for embedded-hal-async to the Embassy
Raspberry PI crate.
2022-07-14 13:52:22 +02:00
chemicstry
53e40860c1
Move all gpio logic to Flex
2022-07-13 02:45:37 +03:00
chemicstry
a335589f34
Change get_set_level to get_output_level
2022-07-13 02:25:09 +03:00
chemicstry
57002875d6
Add convenience GPIO functions to RP
2022-07-13 02:22:46 +03:00
bors[bot]
5f43c1d37e
Merge #850
...
850: Shared buses with SetConfig r=Dirbaio a=kalkyl
Addresses issue #830
Co-authored-by: Henrik Alsér <henrik@mindbite.se>
2022-07-10 00:03:44 +00:00
Henrik Alsér
baae64d911
Add embassy-embedded-hal nightly feature
2022-07-09 23:41:02 +02:00
Dario Nieuwenhuis
5cc5961c94
rp/gpio: add Flex.
2022-07-09 02:14:30 +02:00
Henrik Alsér
85e67d94ad
impl SetConfig for rp2040 SPI
2022-07-09 00:32:55 +02:00
Dario Nieuwenhuis
948bb93dc2
docs: Add $COMMIT to git srclinks.
2022-06-26 23:55:38 +02:00
Dario Nieuwenhuis
1f746e0939
Remove the authors field from Cargo.tomls
...
It currently contains whoever was first to write some code for the crate,
even if many more people have contributed to it later.
The field is "sort of" deprecated, it was made optional recently:
https://rust-lang.github.io/rfcs/3052-optional-authors-field.html
Due the the reasons listed there I believe removing it is better than
setting it to generic fluff like "The Embassy contributors".
2022-06-18 02:16:40 +02:00
Dario Nieuwenhuis
88e36a70bd
Update to 2021 edition. ( #820 )
2022-06-18 02:15:48 +02:00
Dario Nieuwenhuis
a8703b7598
Run rustfmt.
2022-06-12 22:22:31 +02:00
Dario Nieuwenhuis
5085100df2
Add embassy-cortex-m crate.
...
- Move Interrupt and InterruptExecutor from `embassy` to `embassy-cortex-m`.
- Move Unborrow from `embassy` to `embassy-hal-common` (nothing in `embassy` requires it anymore)
- Move PeripheralMutex from `embassy-hal-common` to `embassy-cortex-m`.
2022-06-12 21:45:38 +02:00
Dario Nieuwenhuis
6320e30adf
Update embedded-hal-async to 0.1.0-alpha.1
2022-05-29 22:34:08 +02:00