671 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
e4315053c1 ci: don't run on pushes. 2023-07-12 19:49:05 +02:00
Dario Nieuwenhuis
42b69fcf29 io: add separate embedded-io-adapters crate, add futures/tokio support.
If we want to release `embedded-io` 1.0 and the adapters live there, we can't make any
breaking changes to them after release. Putting them in a separate crate
allows doing breaking changes without breaking everyone using the IO traits.
2023-07-12 19:30:24 +02:00
Dario Nieuwenhuis
90b959631a io: remove adapters from main crate. 2023-07-12 19:12:04 +02:00
Dario Nieuwenhuis
3d5f10adca io: Add From impls to convert between ErrorKind and std::io::ErrorKind. 2023-07-12 19:11:22 +02:00
Dario Nieuwenhuis
463e6ee46c io: remove useless crate::. 2023-07-12 18:41:05 +02:00
Diego Barrios Romero
27be7bc8a3
Merge pull request #469 from rust-embedded/io-docs
io: expand docs.
2023-07-12 16:01:45 +00:00
Diego Barrios Romero
ae327b8887
Merge pull request #470 from rust-embedded/maybe-sized
Add `+ ?Sized` to all blanket impls.
2023-07-12 15:54:37 +00:00
Diego Barrios Romero
c5c5507828
Merge pull request #471 from rust-embedded/io-errorkinds
io: add error kinds from std.
2023-07-12 15:52:06 +00:00
Dario Nieuwenhuis
9ac61a73d7 Add + ?Sized to all blanket impls. 2023-07-12 17:44:09 +02:00
Dario Nieuwenhuis
b55faf9906 io: expand docs. 2023-07-12 17:42:41 +02:00
Dario Nieuwenhuis
e37cb225b5 io: add error kinds from std. 2023-07-12 17:42:33 +02:00
Diego Barrios Romero
64b66b5abb
Merge pull request #466 from rust-embedded/io
Add embedded-io, embedded-io-async, remove serial traits.
2023-07-12 15:40:14 +00:00
Dario Nieuwenhuis
7aaa585c63 Rename trait Io to ErrorType. 2023-07-12 13:26:23 +02:00
Dario Nieuwenhuis
e36386845c Apply suggestions from code review
Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
2023-07-12 13:25:39 +02:00
Dario Nieuwenhuis
5df51e56da ci: test io with std and alloc features, update nightly. 2023-07-05 00:19:27 +02:00
Dario Nieuwenhuis
31b62d3a07 io: add ReadReady, WriteReady. 2023-07-05 00:19:25 +02:00
Dario Nieuwenhuis
931dd37ad6 Remove serial traits (blocking and async). 2023-07-05 00:19:25 +02:00
Dario Nieuwenhuis
2c818b8b09 io-async: add std/alloc features, add Box/Vec impls. 2023-07-05 00:16:32 +02:00
Dario Nieuwenhuis
a105876f16 io-async: add impls for slices. 2023-07-05 00:16:32 +02:00
Dario Nieuwenhuis
d6f641995f Add embedded-io-async. 2023-07-05 00:16:32 +02:00
Dario Nieuwenhuis
1b5a858b12 io: add adapters to/from std::io. 2023-07-04 22:32:39 +02:00
Dario Nieuwenhuis
eb6e078b26 io: add std/alloc features, add Box/Vec impls. 2023-07-04 22:31:46 +02:00
Dario Nieuwenhuis
6eb30c50d1 io: add impls for slices. 2023-07-04 22:27:59 +02:00
Dario Nieuwenhuis
6e27094671 Add embedded-io. 2023-07-04 22:25:50 +02:00
Diego Barrios Romero
7e119bdb52
Merge pull request #465 from rust-embedded/release3
Release e-h 1.0-alpha.11, e-h-async 0.2-alpha.2, e-h-bus 0.1-alpha.3, e-h-nb 1.0-alpha.3
embedded-hal-async-v0.2.0-alpha.2 embedded-hal-bus-v0.1.0-alpha.3 embedded-hal-nb-v1.0.0-alpha.3 v1.0.0-alpha.11
2023-07-04 16:02:48 +00:00
Dario Nieuwenhuis
851dae5ec7 Release e-h 1.0-alpha.11, e-h-async 0.2-alpha.2, e-h-bus 0.1-alpha.3, e-h-nb v1.0-alpha.3 2023-07-04 18:00:15 +02:00
Dario Nieuwenhuis
a8ff64fadb
Merge pull request #462 from Dirbaio/spi-delay
spi: add Operation::DelayUs(u32).
2023-06-20 21:43:53 +00:00
Dario Nieuwenhuis
3620083e28
Merge pull request #464 from eldruin/switch-to-ghmq
Prepare switch to GHMQ
2023-06-20 21:39:12 +00:00
Diego Barrios Romero
50cceacf46 Switch to GHMQ 2023-06-20 10:20:00 +02:00
bors[bot]
7e24e0c136
Merge #463
463: embedded-hal: digital: add #[inline] hints for PinState functions r=Dirbaio a=luojia65

Add inline hints for:

- `<PinState as Not>::not`
- `<PinState as From<bool>>::from`
- `<bool as From<PinState>>::from`

Those hints would allow further optimizations if PinState structure functions is used on embedded-hal projects.

Co-authored-by: Luo Jia / Zhouqi Jiang <luojia@hust.edu.cn>
2023-05-31 12:30:36 +00:00
Luo Jia / Zhouqi Jiang
d500bfa661
embedded-hal: digital: add #[inline] hints for PinState functions
Add inline hints for:

- <PinState as Not>::not
- <PinState as From<bool>>::from
- <bool as From<PinState>>::from

Those hints would allow further optimizations if PinState structure functions is used on embedded-hal projects.

Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
2023-05-31 20:17:50 +08:00
Dario Nieuwenhuis
d07d39e359 spi: add Operation::DelayUs(u32). 2023-05-24 13:59:38 +02:00
bors[bot]
30a8190703
Merge #461
461: spi: remove write-only and read-only traits. r=Dirbaio a=Dirbaio

When introducing the Bus/Device split in #351, I kept the ability to represent "read-only" and "write-only" buses, with separate `SpiBusRead`, `SpiBusWrite` buses. This didn't have much discussion, as it was the logical consequence of keeping the separation in the already existing traits (`Read`, `Write`, `Transfer`, ...).

Later, in #443, when switching from the closure-based API to the operation-slice-based API, this required adding `SpiDeviceRead`, `SpiDeviceWrite` as well, because you can no longer put a bound on the underlying bus with the new API.

This means we now have *seven* traits, which we can reduce to *two* if we drop the distinction. So, is the distinction worth it?

I've always been on the fence about it, now I'm sort of leaning towards no.

First, using write-only or read-only SPI is rare. 
- write-only SPI: for SPI displays you don't want to read from, or to abuse it to bitbang stuff like ws2812b,
- read-only SPI: some ADCs that can't be configured at all, you just clock out bits. Or even weirder abuses, like to build a logic analyzer

Second, for it to be useful HALs have to track "read-onlyness / write-onlyness" in the type signature, so a read-only SPI really only implements `SpiBusRead` and not `SpiBus`. HALs already have enough generics. For example, Embassy HALs don't implement the distinction (you can create MOSI-only or MISO-only SPIs, but they all impl the full `SpiBus`, because I didn't want to make the types carry pin information).

Third, it makes the API easier to use. Simpler, users only have to import one trait, docs have all the methods in one place. Much less boilerplate to impl the traits (look at how shorter `embedded-hal-bus` gets!).

So I think we should remove them.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-05-19 11:25:29 +00:00
Dario Nieuwenhuis
1567f258bf spi: remove write-only and read-only traits. 2023-05-10 22:43:52 +02:00
bors[bot]
804e1de2df
Merge #456
456: spi: clarify flushing/blocking behavior. r=eldruin a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-05-09 16:12:04 +00:00
bors[bot]
800eefdf28
Merge #457
457: embedded-can: make `StandardId::as_raw` and `ExtendedId::as_raw` const r=ryankurte a=dimpolo



Co-authored-by: dimpolo <33688001+dimpolo@users.noreply.github.com>
2023-05-04 22:23:45 +00:00
bors[bot]
1439504832
Merge #458
458: bus: Add a doc example for i2c::RefCellDevice r=Dirbaio a=tomgilligan

`embedded-hal-bus` is turning out to be very useful for something I'm working on.  It wasn't too hard to work out how to use it but it feels like an example would still be helpful here.  Not sure:

- is this the best place to put such an example?
- how much of the example should be hidden with `#`?

Co-authored-by: Thomas Gilligan <thomas.gilligan@icloud.com>
2023-05-03 16:43:00 +00:00
Thomas Gilligan
6a0c442fc9 Actually commit doc test fix 🥲 2023-05-04 01:49:06 +10:00
Thomas Gilligan
baefcf241b Put i2c bus example on struct, fix doc test 2023-05-03 20:52:23 +10:00
Thomas Gilligan
d187dc0fcb Add a doc example for i2c::RefCellDevice 2023-05-03 19:31:29 +10:00
dimpolo
215d7b4fa0
embedded-can: make StandardId::as_raw and ExtendedId::as_raw const 2023-05-02 22:20:10 +02:00
Dario Nieuwenhuis
28df44c1f7 spi: clarify flushing/blocking behavior.
Fixes #455.
2023-05-02 20:08:00 +02:00
bors[bot]
3a7c3cad28
Merge #449
449: Release e-h v1.0.0-alpha.10, e-h-async v0.2.0-alpha.1, e-h-bus v0.1.0… r=eldruin a=Dirbaio

…-alpha.2, e-h-nb v1.0.0-alpha.2.

lots of crates, whew 😅 

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
embedded-hal-nb-v1.0.0-alpha.2 embedded-hal-bus-v0.1.0-alpha.2 embedded-hal-async-v0.2.0-alpha.1 v1.0.0-alpha.10
2023-04-05 06:53:27 +00:00
Dario Nieuwenhuis
76c66f3799 Release e-h v1.0.0-alpha.10, e-h-async v0.2.0-alpha.1, e-h-bus v0.1.0-alpha.2, e-h-nb v1.0.0-alpha.2. 2023-04-04 22:09:17 +02:00
bors[bot]
0c98b79766
Merge #444
444: bus/spi: add RefCell, CriticalSection and Mutex shared bus implementations. r=eldruin a=Dirbaio

Requires #443 

This adds a few bus sharing implementations, with varying tradeoffs:
- `RefCellDevice`: single thread only
- `CriticalSectionDevice`: thread-safe, coarse locking, nostd.
- `MutexDevice`: thread-safe, fine-grained locking, std only.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-04-01 09:05:22 +00:00
Dario Nieuwenhuis
756b05519e spi: Add changelog for transaction changes. 2023-04-01 10:52:48 +02:00
Dario Nieuwenhuis
76541e0766 bus/spi: add RefCell, CriticalSection and Mutex shared bus implementations. 2023-04-01 10:50:42 +02:00
bors[bot]
a8ea55f888
Merge #443
443: spi: make SpiDevice transaction take an operation slice instead of a closure. r=eldruin a=Dirbaio

As discussed in [today's WG meeting](https://matrix.to/#/!BHcierreUuwCMxVqOf:matrix.org/$l3MzRbzKQ0LGOops0ioYfM2kEr6-eT7ODboDj9iiCfY?via=matrix.org&via=psion.agg.io&via=tchncs.de).

- Fixes https://github.com/rust-embedded/linux-embedded-hal/issues/87
- Gets rid of the cursed borrow issues in async.
- Makes the trait more consistent with I2C.


Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-04-01 07:01:16 +00:00
Dario Nieuwenhuis
b6764ecd57 spi: SpiDevice transactiontake an operation slice instead of a closure. 2023-03-28 14:41:54 +02:00
bors[bot]
8aaa48b6d3
Merge #448
448: Misc doc fixes. r=eldruin a=Dirbaio

- Switch from GAT to AFIT has already happened.
- We're no longer planning to integrate EHA into EH
- Fix all broken links.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-03-28 12:28:57 +00:00