Commit Graph

606 Commits

Author SHA1 Message Date
Ardelean Calin
eae67d0be8 Review comments. Corrected unused fields. 2022-11-23 14:16:18 +02:00
Ardelean Calin
4f2f375777 Corrected order of use statements. 2022-11-22 17:45:05 +02:00
Ardelean Calin
e7c876d744 Changed pin to private as it is for OutputChannel 2022-11-22 17:36:22 +02:00
Ardelean Calin
64c2e1b9b6 Switched to PeripheralRef for channel. 2022-11-22 17:35:38 +02:00
Ardelean Călin Petru
a074cd0625
Update gpiote.rs
Adding these changes enables us to define a channel using a mutable reference to `GPIOTE_CH(n)`, similar to how we can do with other drivers.
So instead of using:
```rust
let freq_in = InputChannel::new(
    p.GPIOTE_CH0,
    Input::new(&mut p.P0_19, embassy_nrf::gpio::Pull::Up),
    embassy_nrf::gpiote::InputChannelPolarity::HiToLo,
);
```
we can use:
```rust
let freq_in = InputChannel::new(
    &mut p.GPIOTE_CH0,
    Input::new(&mut p.P0_19, embassy_nrf::gpio::Pull::Up),
    embassy_nrf::gpiote::InputChannelPolarity::HiToLo,
);
```
2022-11-22 16:56:04 +02:00
bors[bot]
97cb95bbf4
Merge #1042
1042: embassy-nrf: Add SPIS module r=Dirbaio a=kalkyl

Verified to be working on nrf9160

Co-authored-by: Henrik Alsér <henrik.alser@me.com>
Co-authored-by: Henrik Alsér <henrik.alser@ucsmindbite.se>
Co-authored-by: kalkyl <henrik.alser@me.com>
2022-11-22 11:20:14 +00:00
Henrik Alsér
f09745dfe1 embassy-nrf: Default disable UARTE (nrf9160) 2022-11-22 02:21:06 +01:00
Henrik Alsér
da9f82f507 Fix pin refs 2022-11-22 02:13:03 +01:00
Henrik Alsér
e6b9722a31 Remove nrf9160 UARTE fix 2022-11-22 01:07:59 +01:00
Henrik Alsér
33ee48b9e8 Merge branch 'spis' of github.com:kalkyl/embassy into spis 2022-11-22 00:55:46 +01:00
Henrik Alsér
a6d941fac3 Fix txonly/rxonly data pin dir, _from_ram and doc 2022-11-22 00:55:05 +01:00
kalkyl
0b066b22d1 Check events_acquired 2022-11-14 16:24:21 +01:00
kalkyl
3a1ddd66c6 Cleanup interrupts 2022-11-14 16:18:11 +01:00
kalkyl
8d2d5a30a5 Single waker 2022-11-14 11:39:55 +01:00
Henrik Alsér
5cfad3f853 Feature gate UARTE disable 2022-11-13 02:37:23 +01:00
Henrik Alsér
dca11095e2 Disable UARTE in embassy-nrf::init 2022-11-13 01:49:55 +01:00
Henrik Alsér
aecfce1159 rustfmt 2022-11-05 01:36:29 +01:00
Henrik Alsér
207fa19551 Acquire semaphore on blocking 2022-11-05 01:34:52 +01:00
Henrik Alsér
7da18e194a Add status checks 2022-11-05 01:12:25 +01:00
Henrik Alsér
a3e8a6bc3a rustfmt 2022-11-05 00:19:52 +01:00
Henrik Alsér
1920e90dcd embassy-nrf: Add SPIS module 2022-11-05 00:15:43 +01: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
Dion Dokter
0c9ec8dc36 Update usb 2022-10-26 10:39:29 +02:00
Dion Dokter
ea868920e6 Update nrf pacs 2022-10-26 09:13: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]
ce1cba761c
Merge #855
855: PDM microphone support for nrf r=Dirbaio a=pbert519

PDM microphones have a long startup phase, therefore the driver samples continuously and only switches the target buffer if the user requests sampling.

Co-authored-by: pbert <pbert@posteo.net>
2022-10-21 21:03:51 +00:00
pbert
a4afab4640 add support for pdm microphones in nrf driver 2022-10-13 18:37:53 +02: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
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
Ulf Lilleengen
72c2e985bb Update embedded-hal versions and explicitly pin 2022-09-29 11:27:46 +02:00
Dario Nieuwenhuis
17d8d11f73 usb: make HALs depend only on embassy-usb-driver. 2022-09-27 13:16:49 +02:00
Dario Nieuwenhuis
7f7c14b7bc usb: split driver trait to separate crate. 2022-09-26 12:29:27 +02:00
bors[bot]
eeb1515e9f
Merge #958
958: Implement proper `Drop` for `BufferedUarte` r=lulf a=ZoeyR

The drop method in `BufferedUarte` was prone to hanging indefinitely and also didn't actually disable the peripheral. I mostly copied over the drop method from `Uarte` with some modifications since `BufferedUarte` could have a transmit lasting indefinitely.

Co-authored-by: Zoey Riordan <zoey@dos.cafe>
2022-09-23 11:58:43 +00:00
Zoey Riordan
b4f2c2a05e Re-add timer.stop() 2022-09-23 12:34:02 +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
Zoey Riordan
5f7e0eb2ae Fix builds on other nrf pacs 2022-09-21 14:06:56 +02:00
Zoey Riordan
15b4f9db90 Remove unused function 2022-09-21 11:19:47 +02:00
Zoey Riordan
0f55f5a73d Remove left-in comments and logs 2022-09-21 11:06:06 +02:00
Zoey Riordan
3d708a459c Implement proper Drop for BufferedUarte 2022-09-21 10:48:02 +02:00
Dario Nieuwenhuis
5327b9c289 time: add more tick rates, use 1mhz as default. 2022-09-02 00:59:34 +02:00
bors[bot]
838f3065ea
Merge #936
936: Add split() method to BufferedUarte in embassy-nrf r=ZoeyR a=ZoeyR

I haven't completed testing this yet. I'm creating this PR early so that I can get corrected if I went way off course.

This PR adds a `split()` method to `BufferedUarte` as discussed on matrix.

Co-authored-by: Zoey Riordan <zoey@dos.cafe>
2022-08-31 10:20:40 +00:00
bors[bot]
1fb6bfbec9
Merge #938
938: Do not use cfg_if for embedded-hal-async feature gates. r=Dirbaio a=Dirbaio

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.


bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-08-31 01:11:49 +00: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
huntc
30641d0564 Avoid context switch and wait for stop
Should be more efficient given the sub 100 cycles to wait.
2022-08-31 08:47:44 +10:00
Zoey Riordan
171077bacf
Avoid double-borrow 2022-08-30 15:57:38 +02:00
Zoey Riordan
b2720117c4
Deduplicate IO methods 2022-08-30 15:48:50 +02:00
Zoey Riordan
4781feafc4
Add split() method to BufferedUarte in embassy-nrf 2022-08-30 15:27:25 +02:00