71 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
5df51e56da ci: test io with std and alloc features, update nightly. 2023-07-05 00:19:27 +02:00
Dario Nieuwenhuis
931dd37ad6 Remove serial traits (blocking and async). 2023-07-05 00:19:25 +02: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
d07d39e359 spi: add Operation::DelayUs(u32). 2023-05-24 13:59:38 +02:00
Dario Nieuwenhuis
1567f258bf spi: remove write-only and read-only traits. 2023-05-10 22:43:52 +02: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
Dario Nieuwenhuis
756b05519e spi: Add changelog for transaction changes. 2023-04-01 10:52:48 +02:00
Dario Nieuwenhuis
b6764ecd57 spi: SpiDevice transactiontake an operation slice instead of a closure. 2023-03-28 14:41:54 +02:00
Dario Nieuwenhuis
0584ebe8fb Misc doc fixes. 2023-03-28 13:57:56 +02:00
bors[bot]
1d74e8927d Merge #440
440: I2c: simplify, expand docs, document shared bus usage. r=eldruin a=Dirbaio

~Depends on #441 -- check that one out first.~

This does some simplifications to the trait that I think we should do:

- Implement all methods in terms of `transaction`. This way HALs have to implement just that.
- Removed byte-wise-iteration methods: `write_iter` and `write_iter_read`. The reason is that they're quite inefficient, especially with DMA implementations. We've already removed these on other traits, so I think we should do as well here.
- Removed `transaction_iter`. I don't think it's much useful in practice, because the way iterators work all the yielded `Operation`s must have the same lifetime. This means that, even if the user can generate the `Operation`s on the fly, they can't allocate buffers for these on the fly, all buffers must be pre-allocated. So it's not useful for, say, streaming a large transfer by reusing some small buffer repeatedly. See #367 
- Removed useless lifetimes
- Standardized buffer names on `read` and `write`, I think they're clearer.

It also specifies how i2c bus sharing is supposed to work. This is an alternative to #392 . After the discussions there, I don't think we should split I2C into Bus and Device anymore. For SPI it makes sense, because drivers want to enforce that there's a CS pin (`SpiDevice`) or not (`SpiBus`). This is not the case with I2C, the API is exactly the same in the shared and non-shared case. Drivers shouldn't care which case it is.

So all we have to do to "support" bus sharing is docs, This PR does:

- Document that it's allowed for implementations to be either shared or not.
- Document some guidelines for drivers and HALs on how to best use the traits, expand the examples.


Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-03-28 06:59:51 +00:00
Dario Nieuwenhuis
7b42f2430f i2c: changelog. 2023-03-15 12:08:28 +01:00
Dario Nieuwenhuis
8b984d299a i2c: implement all operations in terms of transaction. 2023-03-15 12:07:17 +01:00
Dario Nieuwenhuis
f644e8225f i2c: rename args to write/read. 2023-03-15 12:07:17 +01:00
Dario Nieuwenhuis
6236f2baf1 i2c: remove useless lifetimes. 2023-03-15 12:07:17 +01:00
Diego Barrios Romero
336eb5aaa6 Update changelog after #442 2023-03-15 09:18:58 +01:00
Dario Nieuwenhuis
002786df37 asyn/serial: add Write. 2023-03-08 00:33:14 +01:00
Dario Nieuwenhuis
d3f8fe6b2f delay: make infallible. 2023-02-28 21:41:14 +01:00
Dario Nieuwenhuis
d36ddc2009 Bump MSRV to 1.59, switch to Edition 2021. 2023-02-28 21:09:10 +01:00
Dario Nieuwenhuis
f41a73a94e update required nightly version in EHA readme. 2022-12-20 22:44:28 +01:00
Martin
83dfca59b3 Raise MSRV for embedded-hal-async to Rust 1.65.0
Gives a hint for what is needed for generic_associated_types to build
without errors without specifing it as a feature. Nightly is still
required.
2022-12-20 22:44:27 +01:00
Dario Nieuwenhuis
ad0b9f2136 Release embedded-hal-async v0.2.0-alpha.0 2022-11-23 17:17:04 +01:00
Dario Nieuwenhuis
44f01ea73f async: switch to async-fn-in-traits 2022-11-23 17:02:55 +01:00
Dario Nieuwenhuis
f2033d3817 Release embedded-hal-async v0.1.0-alpha.3 2022-10-26 15:40:47 +02:00
Alex Martens
a1dee3e47a embedded-hal-async: fix compilation on latest nightly 2022-10-21 20:22:09 -07:00
Alex Martens
ea67584c85 embedded-hal-async: fix missing link in README 2022-10-10 19:33:36 -07:00
Diego Barrios Romero
72e1ae89ae Prepare embedded-hal-async 0.1.0-alpha.2 release 2022-09-28 22:13:58 +02:00
Diego Barrios Romero
461edb687e Fix link 2022-09-28 22:13:36 +02:00
Diego Barrios Romero
db47d29558 Prepare e-h 1.0.0-alpha.9 release 2022-09-28 20:53:37 +02:00
Dario Nieuwenhuis
7824d559db Fix clippy lints. 2022-09-26 16:35:13 +02:00
Dario Nieuwenhuis
bc3fc45bb9 Reorganize READMEs
- Move "project-wide" stuff (CoC, legal boilerplate) to the main README.
- List crates in main README.
2022-09-26 13:29:34 +02:00
Dario Nieuwenhuis
6d22f986f1 Move embedded-hal to a subdir, add workspace, simplify CI. 2022-09-26 13:29:34 +02:00
Dario Nieuwenhuis
3b6b07d3e4 Split nb and can traits to separate crates. 2022-09-26 13:29:34 +02:00
Grant Miller
edcb4fc770 Remove GAT feature attribute 2022-09-20 17:54:10 -05:00
Grant Miller
c99bbdb27b Remove trailing space 2022-09-20 17:51:25 -05:00
Grant Miller
584263305a Add a note about the macro in the transaction method docs 2022-09-20 17:46:22 -05:00
Grant Miller
6c9f380b34 Improve transaction! docs 2022-09-20 16:59:37 -05:00
Grant Miller
1ae59905bc Rename transaction_helper! to transaction 2022-09-20 16:51:48 -05:00
Grant Miller
0392676216 Add support for all move combinations 2022-09-04 18:48:44 -05:00
Grant Miller
a6f623bf34 Add a compile_fail doctest 2022-09-04 17:58:40 -05:00
Grant Miller
a75b292f06 Dereference pointer before async block 2022-09-04 17:43:48 -05:00
Grant Miller
eeec3898f2 Replace drop($bus) with let $bus = $bus
Clippy doesn't like it when you `drop` a reference
2022-09-03 16:31:13 -05:00
Grant Miller
93eb20f428 async/spi: Add a transaction helper macro 2022-09-02 16:49:45 -05:00
Grant Miller
597493d7e0 Make the async SpiDevice trait unsafe to implement 2022-08-29 15:36:36 -05:00
Alex Martens
cf6fdd45b9 SpiDevice: add guidelines for behaviour of CS pin upon bus failures 2022-08-14 15:13:02 -07:00
Dario Nieuwenhuis
edc2a3f8d0 spi: clarify traits are for master mode.
All dirvers out there assume the traitsare for master mode. However, there are some HALs
out there that impl the traits for SPI in slave mode, which will break when used with drivers.
(stm32f1xx-hal, stm32f4xx-hal, stm32l4xx-hal, probably more).

If we add SPI slave traits in the future, they should be a separate set of traits because the
API would look quite different:

- you'd want the API to give extra extra info about the transaction lengths: if you start a transfer with 256-byte buffer but the master only sends 10 bytes (sets CS low, sends 10 bytes, sets CS high),
you'd want `transfer` to return, saying "I got only 10 bytes", instead of hanging waiting for the other 246 bytes.
- The bus/device split doesn't make sense in slave mode.

Also IMO the `spi, spi_slave` naming is fine even if inconsistent, since the vast majority
of uses are master mode. I wouldn't name the `spi` module `spi_master`.
2022-08-01 10:36:38 +02:00
Dario Nieuwenhuis
df73bb3e99 Change missing_docs from deny to warn.
It is annoying to get hard errors while developing, it prevents testing things out
without documenting them because it fails the build.

This changes it to warn, which has the same effect in CI (because it already has `RUSTFLAGS: '--deny warnings'`),
but still allows buildilng.
2022-07-26 14:04:21 +02:00
Anatol Ulrich
190dfdc8c3 fix inverted logic in docs 2022-07-25 22:32:36 +02:00
Diego Barrios Romero
4b5b7d0f91 Prepare embedded-hal-async 0.1.0-alpha.1 release 2022-05-24 22:06:02 +02:00
Diego Barrios Romero
72669fe266 Update changelog 2022-05-24 22:02:18 +02:00
Diego Barrios Romero
ce92d133f5 Add more content to README 2022-05-24 22:01:47 +02:00